I have a simple model as a GLB file, this works in R166:
No lighting or whatever.
This is the almost the same code in R167:
(Certainly a bit rotated, since it’s spinning)
The only difference are those imports:
R166: import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
R167: import WebGPURenderer from 'three/src/renderers/webgpu/WebGPURenderer.js';
Am I missing a known issue or has the behaviour of the GLTFLoader
changed?
Well, thanks for giving me a hint, but I don’t get it:
Either this warning is masking the real error or there is something else needed…
Try changing to BasicMaterial
.
I’m not sure but it may be a bug in the WebGPU implementation…
If only for a test, maybe try loading your GLTF model in my GLTF WebGPU Viewer to see how it shows there. The viewer will allow you to manipulate the lights intensity with ALi / DLi
or the lights color with AL / DL
controls.
Just make sure that the viewer shows WebGPU
as in the attached picture - assuming that WebGPU is what you are using.
2 Likes
@GitHubDragonFly: Thanks, it works in you viewer, but even thou it reports to be Three.js R167, the used loader itself doesn’t seem to be recent:
So we know it’s not the loader itself (since there wasn’t a change between 166 and 167) and that using your tool is not helpful to check with completely recent versions of all required components
Just for the fun of it, I tried the WebLGLRenderer
instead and it fails to render the texture even in R166. Maybe it was some sort of bug that this used do work with the WebGPURenderer
in 166?
Adding a ambient light (AmbientLight
) in R166 shows the texture with the WebGLRenderer
That all sounds correct but it was just for a test.
Here is a simplified standalone version of that viewer, which includes the official GLTF Loader, so download it and run it from your device for a test.
EDIT: Just some minor corrections to the file for anyone who might be testing it
GLTF WebGPU - Standalone.zip (20.1 KB)
Got it: adding a AmbientLight
was the solution - I suppose that’s related to some sort of bugfix and that the behaviour of R166 (and certainly earlier) wasn’t on purpose. Actually I like the default mode if no light is defined. Now I need to figure out what the previous default has been.
@Lukasz_D_Mastalerz : Thanks for the hint, the old code works now (that is without AmbientLight
) by passing the model through this:
model.traverse((element) => {
if( element?.material?.type != undefined ) {
let targetMaterial = new THREE.MeshBasicMaterial();
THREE.MeshBasicMaterial.prototype.copy.call( targetMaterial, element.material );
element.material = targetMaterial;
//console.log(`Replaced texture for ${element.name}`, element)
}
});