Deprecated gamma correction alternative

i made a three.js version upgrade in my project. The problem is, in older version i used to gammaOutput and gammaFactor for appropriate gamma control like this:

renderer.gammaOutput = true;
renderer.gammaFactor = 1.45;

Unfortunately since it has been marked as deprecated in the new version, I have no alternative.
I tried using post process like this:

 const gammaCorrectionPass = new ShaderPass(GammaCorrectionShader);
  composer.addPass(gammaCorrectionPass);

but unfortunately I don’t see a way to control the values here so that I can get the previous effect.
So is there a way to control the gamma in the same way as I had in older versions of three.js?

No, this type of (variable) gamma correction does not exist anymore. Using GammaCorrectionShader applies a fix sRGB gamma correction but there is no factor uniform. Consider to write a custom shader and then use it in combination with ShaderPass.

Question: What is your use case gammaFactor? If your are using it to control exposure, would using linear tone mapping be an option? This process can be controlled via toneMappingExposure.

before i used linear tone mapping too:

this.renderer.outputEncoding = THREE.GammaEncoding;
this.renderer.toneMapping = THREE.LinearToneMapping;
this.renderer.toneMappingExposure = 1.3;
this.renderer.gammaOutput = true;
this.renderer.gammaFactor = 1.45;

and the effect was:

now scene with only linear tone mapping looks that:

i’ve tried many combinations with tone mapping, but unfortunately I’m not able to achieve as good results as above. :frowning:

How about increasing the intensity of your lights?

1 Like