Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Spinning Cube Won't Animate in Three.js and No Materials #10

Closed
pweingar opened this issue Jun 14, 2017 · 4 comments
Closed

Spinning Cube Won't Animate in Three.js and No Materials #10

pweingar opened this issue Jun 14, 2017 · 4 comments
Labels

Comments

@pweingar
Copy link

I am trying to test out creating animated objects in Blender and exporting them to GLTF to use in WebVR scenes, but I am having two problems with the export. I created a simple spinning cube by adding an animation to the default cube and setting up a simple colored material. When I export this to GLTF and try to load it into a Three.js test web-page, the cube does not have its material applied and does not spin. If I add another object to the scene (say a plane), the cube will spin but is still not textured. When I examine the GLTF files, I see animation tags in both cases... but I do not see material tags in either case.

I do not know if I am setting things up wrong in Blender, the export, or if my JavaScript is wrong. I am attaching the GLTF and Blender files for both cases as well as the HTML file for the test harness.

SpinCube.zip

@donmccurdy
Copy link
Contributor

donmccurdy commented Jun 14, 2017

@pweingar — testing your model here, I do see the animation: https://gltf-viewer.donmccurdy.com/. You may need to use a more recent version of THREE.GLTF2Loader (which in turn may require the dev branch of three.js...) or wait for r86.

Regarding the material, see the discussion here: #8. At minimum, you will probably want to set one of the experimental "common materials" options before export.

@UX3D-nopper
Copy link
Contributor

I am closing this issue, as it is not an issue with the Blender glTF 2.0 exporter:

A glTF 2.0 scene is valid, even it does not have any material assigned.
Only PBR Metallic Roughness material is in core now. To use and export PBR, please use the Blender node group:
https://github.com/KhronosGroup/glTF-Blender-Exporter/tree/master/pbr_node
Of course, your renderer does need to support PBR.

As Don mentioned, you can enable the experimental common materials export. The export works fine and is just mentioned experimental, as the extension is not 100% finalized:
KhronosGroup/glTF#947

What happened in your case:
You are using Blender Render and with the default export settings, no material is exported, as the material is not PBR and/or the experimental common materials is enabled.
In gltF 2.0, if no material is specified, a default material is used:
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#default-material

@donmccurdy
Copy link
Contributor

Of course, your renderer does need to support PBR.

And a side note @pweingar — if you are rendering with three.js, it does indeed support PBR.

@pweingar
Copy link
Author

I tried the dev branch of Three.js yesterday afternoon, and it did indeed fix my animation problem. I'll give the PBR material a try next. Thanks for your assistance.

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

No branches or pull requests

3 participants