Change "gammaFactor" on runtime take no effect


Why changing the WebGLRenderer gammaFactor on runtime take no effect? The renderer does not update accordingly to new gammaFactor value.
I also tried to set materials and textures needsUpdate to true but still the same.

Are there any other way than re-creating a new renderer?

Are you also using gammaOutput=true? gammaFactor affects that (and gammaInput). You’ll need to set .needsUpdate=true on all materials after changing these settings.

1 Like

Seem like the material only update accordingly to gammaFactor for only one time.

Please following these steps to reproduce:

  1. Visit any Three.js example has model & texture (like the gltf sample)
  2. Paste these line to the console to change gammaFactor:
function setGammaFactor ( value ) {
  renderer.gammaFactor = value;
  renderer.gammaInput = true;
  renderer.gammaOutput = true;

  scene.traverse( function ( child ) {
    if ( child.material ) {
      child.material.needsUpdate = true;
  } );


(Model’s textures should be washed out now, that the sign of materials update successfully)

  1. Rerun setGammaFactor with a different value and you will see materials does not update anymore. e.g. setGammaFactor(1);

Found a work-around for it:

  1. Set gamma input, output back to false and update mtl:
renderer.gammaInput = false;
renderer.gammaOutput = false;
scene.traverse( function ( child ) {
    if ( child.material ) {
      child.material.needsUpdate = true;
  } );
  1. After that, run setGammaFactor(2) and these materials will update correctly

(For each step, please paste it and execute in the console)

Ok thanks, I see.