Search code examples
three.jsgltf

Inconsitent lighting and colors in threejs


I have been experimenting with threejs for the past few days and have been experiencing inconsistencies in the lighting of my models. So I decided to do a little experiment. Here are side-by-side pictures of scenes containing the same model and the same lighting(Ambient, color: #FFFFFF, intensity: 0.3) one created using javascript and the other using threejs editor:

  • Using threejs editor
    Model using Threejs Editor

  • Using JS
    Model using JS

Why are the colors and lighting different? Am I missing something?


Solution

  • You probably have not configured a sRGB workflow in your app. So try it with the following line:

    renderer.outputEncoding = THREE.sRGBEncoding;