Coder Social home page Coder Social logo

mccutchen / playcanvas2obj Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 751 KB

A quick and dirty script that attempts to convert a PlayCanvas JSON model into a (partial) Wavefront OBJ file

License: MIT License

Python 100.00%
playcanvas wavefront-obj

playcanvas2obj's Introduction

playcanvas2obj

A quick and dirty script that attempts to convert a PlayCanvas JSON model into a (partial) Wavefront OBJ file. See example_input.json for an example of the expected input format.

Current status

This script only knows how to extract the vertices from the input file and print those vertices in OBJ format. More complete translation is not yet a goal.

Usage

Download the playcanvas2obj.py script and run it using Python 3, passing in a URL or local file path pointing to a valid PlayCanvas JSON model.

# URL as input
python3 playcanvas2obj.py https://raw.githubusercontent.com/mccutchen/playcanvas2obj/main/example_input.json

# Local file as input
python3 playcanvas2obj.py example_input.json

By default, output is written to stdout and can be redirected to a file as necessary:

python3 playcanvas2obj.py example_input.json > example_output.obj

Specify the -o/--output argument to write output to a file instead:

python3 playcanvas2obj.py example_input.json -o example_output.obj

Output format

The output will be a list of vertexes in OBJ format:

$ python3 playcanvas2obj.py example_input.json | head -10
v -49.528900  201.930000  196.712000
v -44.706600  201.800000  196.670000
v -45.864800  202.291000  196.826000
v -49.021700  202.299000  196.830000
v -49.616000  199.781000  196.027000
v -42.772400  199.255000  195.859000
v -49.397200  199.193000  195.839000
v -47.617700  181.155000  185.601000
v -47.162200  181.472000  185.847000
v -50.034100  181.486000  185.862000

playcanvas2obj's People

Contributors

mccutchen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.