I use threejs that version r168.
First I load gltf with WebglRender , It dont have error and show correctly.
Then I use WebGPURender, It report an error:
three.webgpu.js:31613 Uncaught TypeError: lightNodeClass is not a constructor
This is because there is light in the model,it’s a bug?
You mean r168, I assume.
Do you mean that you are loading a Blender model that includes a light? Or that there is a three.js light on the Blender model that you loaded?
If the former, I would delete any Blender lights before exporting your Blender model to gltf/glb.
Three.js treats the contents of a g/tf/glb file as a group. But it may not be set up to handle a Blender light object because it would serve no purpose in three.js.
it’s r168.
My description is not clear,there is test code and model:GitHub - hahaxiaowai/test-three
This may not be the problem of the model light. I try four ways to load model:
- Use WebGLRenderer, it’s load normally.
- Use WebGPURenderer, and don’t add any light to scene, only load model that not include light, it’s load normally.
- Use WebGPURenderer, add light to scene, load model that not include light, it’s report an error
- Use WebGPURenderer, add light to scene, load model that include light, it’s report an error
Is there some reason you need a Blender light?
Unless I am missing something, it sounds like you have identified the program and have confirmed that the correct conclusion is that you should delete any Blender lights from the Blender scene before exporting it to a gltf/glb file.
This sounds likely to be a bug, WebGPURenderer is under ongoing development and bug reports are helpful. The glTF format supports punctual light types, Blender can export them to glTF, and THREE.GLTFLoader can load them, so the workflow you describe should not be crashing, I think we’d love to fix that. Do you mind filing an issue with the code and model?
That said — I don’t know of an easy way to match the exposure of the scene from Blender to three.js. Often the lights will look much brighter than you expect, Blender has some settings related to lighting on the exporter you could try. But in general I find it’s usually an easier workflow to do the lighting in three.js.
1 Like