In three.js r71 the ambient property has been removed from THREE.Material.
Previously I used ambient to set correct rendering (lighting) effect of the materials that I used on my meshes. Now the appearance of all my meshes changed dramatically.
How can I get my materials rendered exactly as before r71?
Here comes the why...
According to @WestLangley; I quote from his post in the discussion (link from @pprchsvr):
material.ambientwas the ambient reflectance of the material. For real-world objects, it should normally matchmaterial.color, the diffuse reflectance of the material. (Objects, after all, do not know where the photons came from.)We chose to simplify the API, and hardwire
material.ambientto matchmaterial.color. Consequently,material.ambienthas been removed.
This means you will no longer be able to set an ambient color that differs from the material color and there is as far as I know no "quick fix" to get the same rendering results for those materials as before.
A possible solution would be to try make the material appear as before by tuning/changing the material color and the ambient lighting in your scene.
See also the three.js documentation for THREE.AmbientLight and THREE.MeshBasicMaterial (and the other materials) for reference.
Alternatively you could create your own shader material using THREE.ShaderMaterial where you (re)create a shader that allows you to explicitly set an ambient color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With