Git Product home page Git Product logo

obj2drcs's Introduction

obj2drcs

We need to convert many obj files with sub-objects (children) to Draco files. Unfortunately the current version of draco_encoder converts all sub-objects into a single mesh. This electron (nodejs) app takes an obj file with sub-objects and creates a directory of individual drc files of those sub-objects to be used in a three.js project.

setup

you'll need to clone both draco and this repo

git clone https://github.com/brangerbriz/obj2drcs
git clone https://github.com/google/draco

then create a build folder for draco in obj2drcs

mkdir obj2drcs/draco_build

navigate in there and build it (you'll need cmake)

cd obj2drcs/draco_build
cmake ../../draco
make

navigate back up to the root and download the node dependencies

cd ../
npm install

using it

to launch the app run

npm start

you should see a black screen with a number field and a 'Choose File' button. The number field can be set from 1 to 10, this is the compression level to set the draco_encoder to. click the 'Choose File' to choose an obj file (assumes an obj file with sub-objects) and you should see some status print to the screen:

screenshot

After that the mesh should appear in the window, use the mouse wheel to zoom in/out and the mouse to rotate and inspect the mesh. Make sure that hovering over the individual sub-objects changes their color.

If all is working well you can inspect the directory created for this mesh inside the OUTPUT directory. There you should find a file-obj.drc of the full mesh (this can be ignored) as well as folders with the individual sub-objects as objs and drcs. You'll also find a js folder and index.html page. This page uses the drcs objects to create a similar mouse controlled raycasting demo as in the app. Use this as a template for how to use the generated drcs in a three.js project.

debugging

if somethings not working, you can launch the app with the dev console open to debug:

npm run dev

please submit any issues for errors that show up in the console.

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.