question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

glTF loader fails to render some scenes loaded using loader.parse(...)

See original GitHub issue

I have thumbnail server which uses GLTFLoader to load .glb data from Buffer. The server is a node app using headless gl and three-png-stream.

Previously, I’d written a python glTF exporter which generates glbs which load and render successfully on the server. Lately, I’ve been experimenting with glTF files that are generated using the glTF C# loader(@bghgary). I’ve attached one file generated with the C# loader, box.glb.zip, to help diagnose. In each of the following cases, files written using my python exporter load correctly both in the glTF viewer and on the server. The following applies only to models generated using the C# loader.

Files generated using the C# loader visualize perfectly using @donmccurdy’s glTF viewer, but when loading on the server, nothing renders. In an effort to debug, I set the material for all meshes contained in the glb scene to draw to wireframe, and I see a wireframe in my scene where I would expect it. Perhaps there is an issue with loader.parse(...) reading materials. I’ve experimented with including both the KHR_materials_pbrSpecularGlossiness extension and pbrMetallicRoughness, and inlcuding only pbrMetallicRoughness, to no avail.

This is for an architectural application with Z up, so I have tried both setting the Matrix and the Rotation of the root node. Again, everything visualizes fine in the glTF viewer with the scene being properly transformed. And, models which have their Matrix set to make Z up, generated by the python exporter, work fine using loader.parse(...) Perhaps there is a winding issue that is caused by setting a Matrix or Rotation which is causing facets not to render correctly.

I’ve compared the simplest case, a unit box, exported with the python generator and one generated with the C# generator. The only difference that I can see (when diagnosing by saving to .gltf and inspecting the files manually) is that the C# generator does not serialize default values. Perhaps there is an issue using loader.parse(...) with a .glb which omits default values? For example, the C# loader does not serialize mode:4 (TRIANGLES) for primitives, perhaps because this is a default?

This behavior is exhibited when I run the server remotely and locally, so I don’t believe it has to do with the environment.

I did see https://github.com/mrdoob/three.js/issues/14256, which may apply as the server is running node, and I’m doing the rendering in the onLoad callback. But again, this works with models generated from my python exporter.

Three.js version
  • Dev
  • r93
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ikeoughcommented, Jun 18, 2018

Thanks @vyv03354 and @takahirox. I should have reviewed the warnings on headless gl startup more carefully. As this is not a three issue, I’m closing.

0reactions
vyv03354commented, Jun 15, 2018

Apparently the latest headless-gl trunk added support for OES_element_index_uint: https://github.com/stackgl/headless-gl/pull/121

But headless-gl 4.0.4, the latest version from npm, does not include this fix yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

THREE.js GLTFLoader not rendering with react - Stack Overflow
gltf file using the method const Loader = new GLTFLoader() however when the website is rendered and i view it in browser i...
Read more >
Load Models Three.js GLTFLoader Syntax error JSON.parse
The problem is when I want to load models coming from blender or others. I use blender 2.8 to create my model and...
Read more >
three.js | Can anyone help me in loading gltf model it's not ...
I use GridHelper to draw grid on picture. Now, i want to move center line(blue line) down y-axis 20 units, and to the...
Read more >
GLTFLoader - loaders.gl
The GLTF Loader returns an object with a json field containing the glTF Scenegraph. In its basic mode, the GLTFLoader does not modify...
Read more >
GLTFModel - xeogl
The GLTFModel begins loading the glTF file immediately. ... We can also get all the GLTFModels in a Scene, using the Scene's types...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found