Three.js: Second pass in composer breaks sRGBEncoding (darkens objects)

Created on 22 Jan 2020  路  13Comments  路  Source: mrdoob/three.js

If you set renderer.outputEncoding = THREE.sRGBEncoding and you use an EffectComposer with more than one pass to render the scene colors appear as they would without sRGBEncoding.

Here is a fiddle demonstrating the problem.
https://jsfiddle.net/cvumeLpx/2/

Comment out the second composer.addPass(renderPass); and colors will render as expected.

The second pass can be anything https://jsfiddle.net/cvumeLpx.

Help (please use the forum)

All 13 comments

See if this helps to clarify things: https://github.com/mrdoob/three.js/issues/15285#issuecomment-576882742.

physicallyCorrectLights should have nothing to do with this issue.

Yeah sorry. I removed that part.

As mentioned by @WestLangley, you have to produce the first render pass in liner space when using post processing. So remove this line from your code:

renderer.outputEncoding = THREE.sRGBEncoding

and use a gamma correction pass at the end of your chain. You can use WebGLRenderer.gammaFactor to adjust the result (e.g. a value of 2.2 closely matches to sRGBEncoding).

https://jsfiddle.net/5t7fbgou/1/

Please use the forum if you need more help.

As mentioned by @WestLangley, you have to produce the first render pass in liner space when using post processing.

Actually, I did not say that. I said that was a reasonable option -- and it happens to be my preference. But you can post-process in any color space you want -- you just have to ensure the correct workflow.

You said in https://github.com/mrdoob/three.js/issues/15285#issuecomment-576882742

It would be reasonable to set renderer.outputEncoding = THREE.LinearEncoding and then apply a Composer tone mapping pass at the end.

I was referring on that sentence.

@Mugen87 I said it would be reasonable to use that workflow. I did not say you have to, because saying so would not be true. Please do not misquote me. And if you do, please correct your statement.

Okay, okay. I will not refer to any statements of the delicate @WestLangley anymore...

Guys guys... 馃槝

@Mugen87 said

I will not refer to any statements of the delicate @WestLangley anymore...

@Mugen87 Please refrain from making personal attacks.

You know... I think the actual issue here is the API. It's "forcing" users to learn about color spaces when using post-processing.

That's why I was considering something like https://github.com/mrdoob/three.js/pull/18322 so the renderer can take care of color spaces for the user.

I tried to use a gamma correction pass but the results are too different.

Composer with gamma correction pass: https://jsfiddle.net/kbgxhodn/
Renderer with sRGBEncoding: https://jsfiddle.net/kbgxhodn/

@viperphase1 Please do not post in old/closed issues. Please focus on #18468.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clawconduce picture clawconduce  路  3Comments

seep picture seep  路  3Comments

konijn picture konijn  路  3Comments

yqrashawn picture yqrashawn  路  3Comments

ghost picture ghost  路  3Comments