Ambient color doesn't effect GLTF model

I’m exporting GLTF model from blender. And for some reason in Threejs scene ambient color doesn’t effect imported model at all.
Directional light works, but still it looks dark.

    var al = new THREE.AmbientLight( 0x324891 );
    al.intensity = 10;
    scene.add( al );

    var dl = new THREE.DirectionalLight( 0xffffff, 1 );
    dl.position.set( 0, 100, 0 ); 	
    scene.add( dl );

fishes_ss

Can you please share your glTF model in this thread?

The material of your fish has a current metalness value of 1. If you reduce this value, the lighting should be more as you would expect.

Tip: Set the property to 0 if you are not going to use an environment map.

3 Likes

That was it! TY!

I’ve the same issue, but setting metalness to 0 doesn’t work. Setting the metalness to either 0 or 1 does show a difference, but either way the object is very dim even with bright ambient or point lights.

Looks good in https://gltf-viewer.donmccurdy.com though.

I double checked, and all materials in the GLTF import are MeshStandardMaterial, but lighting appears to have zero effect on texture.

The model is not black, but gray (it is supposed to be white, but looks as if it is in a dark room).

Anything else to try besides metalness? What other features of Three.js could lead to a MeshStandardMaterial not being affected by light?

Anything else to try besides metalness? What other features of Three.js could lead to a MeshStandardMaterial not being affected by light?

^ cc @donmccurdy, do you know?

For MeshStandardMaterial: metalness, metalnessMap, aoMap, and aoMapIntensity could all reduce diffuse lighting contributions with certain settings. Maybe also refractionRatio, but GLTFLoader doesn’t use that.

I’ve occasionally seen models that contained vertex colors full of zeroes. Having a normal map without any vertex normals might also cause similar issues. Either of these cases could be considered a bug in the model.

1 Like

Ah interesting. Well I wasn’t able to reproduce with simple examples. The following examples should represent what I’m doing in my actual app, and they use the same model from my app. In both demos we can see they are both receptive to lighting (unlike my app which has no reflectivity on the car body), however with r108 (same version as my app) the car is black in the demo (expected white), while with r121 the car is white in the demo (good):

White car, r121 (white is expected):

Black car, r108 (expected white, got black):

In my app (using r108), I don’t see a black shiny car, but the following:

As you can see, the windows are very bright, because I have a point light and directional light directly above the car, with intensities of 3. However, for some reason, in my app, the body color is a constant gray, while in the above codepen demos the same model is shiny (but black in r108, and white in r121).

Hopefully the version differences aren’t the issue. I will try updating…

I updated the project from r108 to r121, and the rendering changed a little (it added shininess along the mesh edges or something, due to my bright debug lights) but the car’s overall color remains the same:

I wish I could share the code, but it is proprietary.

The GLTF model comes from Blender. Of course it looks fine in there. I will study to see how Blender properties map to the Three.js properties you mentioned @donmccurdy.