three.jsblenderphongambient

Can I set the ambient property of a MeshPhongMaterial to false in a three.js imported Blender model?


I'm doing a student project and I have a scene with an ambient light and a spotlight. I've imported a Blender model which has the line:

"colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],

in the JSON file.

Is there any way to turn off this property in a MeshPhongMaterial so that it only reacts to the spotlight and not the ambient light.

I've tried removing the line and setting it to zero but this has had no effect. Can I turn this property off? Or should I remove the ambient light from a scene and use a different type such as Directional?

Thanks for any help.


Solution

  • In practice, the ambient reflectance of the material should usually match the material color, also known as the diffuse reflectance. Doing so will likely make your model look better.

    For example, you can do this

    material.ambient.copy( material.color );
    

    or

    material.ambient.set( 0xff0000 );
    

    three.js r.67