Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading materials via the JSON model #2

Closed
andrewdeutsch opened this issue Apr 23, 2018 · 4 comments
Closed

Loading materials via the JSON model #2

andrewdeutsch opened this issue Apr 23, 2018 · 4 comments

Comments

@andrewdeutsch
Copy link

Thanks so much for this API, it's great!
I'm curious (and not very experienced with threeJS) - do you know a way to import materials via the JSON model as opposed to loading a texture image? I'm trying to determine a workflow that's as streamlined as possible.
Also, do you use JSON models purely as a preference?

@xavierjs
Copy link
Member

This is possible with THREE.JS, but you have to use external loaders.
Loaders for common 3D formats (OBJ, STL, DAE) are not in the THREE.js core. You have to include the specific .js loader scripts.
The easiest way to quickly add a new THREE.JS feature is too start from one of their examples, for example this one for .OBJ/.MTL loading : https://threejs.org/examples/#webgl_loader_obj_mtl .
But JSON based formats (either GLTF or the THREE.JS json format) are still better than other because javascript has a native JSON parser. Personally I prefer to check the 3D models and eventually change them a bit with Blender, then export them with THREE.JS Blender exporter.

If you want to have a smooth workflow I think you should use the GLTF file format (you can take a look at this example : https://threejs.org/examples/#webgl_loader_gltf) . This format is standardized, it can store all kind of 3D assets and it relies on JSON encoding.

@andrewdeutsch
Copy link
Author

Excellent, thanks man!

@xavierjs
Copy link
Member

xavierjs commented May 8, 2018

I have added the demonstration of the lib interfaced with the THREE.JS GLTF demo. It is here : https://jeeliz.com/demos/faceFilter/demos/threejs/gltf_fullScreen/
It also includes the HD video acquisition and fullscreen mode (with window resizing)

@andrewdeutsch
Copy link
Author

andrewdeutsch commented May 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants