Three.js: Fog and `scene.background` not affected by gammaOutput=true

Created on 6 Dec 2018  路  2Comments  路  Source: mrdoob/three.js

I'm not entirely sure they _should_ be affected, but this surprised me a bit when refactoring A-Frame to automatically call .convertSRGBToLinear() on user-provided colors before passing them to three.js objects.

Question

Most helpful comment

since ... one would normally want the fog color to match the clear color, fog is not affected either.

Ah, that makes sense.

Can you provide an example to demonstrate where [scene.background + gammaOutput] is not working?

Oh, I was referring to a solid color, like scene.background = new THREE.Color(0x4285f4). Now that I check the docs, it just sets clear color anyway, so that explains that. :)

I won't suggest changing this, then. As we discuss an API to replace gammaInput/gammaOutput, this behavior seems fine. I'll get inconsistent results when setting #4285f4 on fog vs on a material in the scene, but if anything I think that's an argument to reconsider how color inputs to materials are handled, rather than changing this.

Thanks!

All 2 comments

Fog is not affected by gammaOutput=true

Correct. The fog fragment follows the encoding fragment.

My recollection is that since the clear color is not affected by output encoding, and one would normally want the fog color to match the clear color, fog is not affected either. This can be changed, of course.

scene.background is not affected by gammaOutput=true

It should be. I implemented that in https://github.com/mrdoob/three.js/pull/15186 and https://github.com/mrdoob/three.js/pull/15187.

Can you provide an example to demonstrate where it is not working?

since ... one would normally want the fog color to match the clear color, fog is not affected either.

Ah, that makes sense.

Can you provide an example to demonstrate where [scene.background + gammaOutput] is not working?

Oh, I was referring to a solid color, like scene.background = new THREE.Color(0x4285f4). Now that I check the docs, it just sets clear color anyway, so that explains that. :)

I won't suggest changing this, then. As we discuss an API to replace gammaInput/gammaOutput, this behavior seems fine. I'll get inconsistent results when setting #4285f4 on fog vs on a material in the scene, but if anything I think that's an argument to reconsider how color inputs to materials are handled, rather than changing this.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fuzihaofzh picture fuzihaofzh  路  3Comments

boyravikumar picture boyravikumar  路  3Comments

danieljack picture danieljack  路  3Comments

zsitro picture zsitro  路  3Comments

Bandit picture Bandit  路  3Comments