Three.js: GLTFLoader: multipass cache getting before adding

Created on 3 Mar 2019  ·  6Comments  ·  Source: mrdoob/three.js

Description of the problem

While loading a GLTF file using GLTFLoader, I noticed that loadGeometries was trying to get from multiPassGeometryCache before adding geometries to it. So it doesn't load them.

Here is a fiddle with logs illustrating the problem:
https://codesandbox.io/s/528q8o140p

I also noticed that cached was accessed when not null but is sometimes undefined.
I precognize to test it with:
if ( geometry ) return [ geometry ];
instead of:
if ( geometry !== null ) return [ geometry ];

Three.js version
  • [x] 0.102.1
Browser
  • [x] Chrome
  • [x] Firefox
  • [ ] Internet Explorer (cannot load Promise)
OS
  • [x] Windows
Hardware Requirements (graphics card, VR Device, ...)
  • GeForce GTX 1050

Most helpful comment

Why couldn't it display as flat solids?

By default glTF uses physically-based (PBR) materials. These require at least an ambient light. It is possible to create an unlit material too (e.g. THREE.MeshBasicMaterial) that doesn't respond to or require light.

All 6 comments

Could you test this case on the “dev” branch? This multipass logic has been removed.

OK, nice! I don't have errors anymore (even if I can't see my model :( )
I think you can close this issue.

Don't forget you'll need at least one light. Add scene.add(new THREE.PointLight()); and you should see something.

Here's your project with a light in the scene:
https://codesandbox.io/s/924r9qq56r

Great! Why couldn't it display as flat solids?

Why couldn't it display as flat solids?

By default glTF uses physically-based (PBR) materials. These require at least an ambient light. It is possible to create an unlit material too (e.g. THREE.MeshBasicMaterial) that doesn't respond to or require light.

Was this page helpful?
0 / 5 - 0 ratings