Skip to content

Transparent objects brighten when using gammacorrectionshader #23019

@gloriousjob

Description

@gloriousjob

Describe the bug

When using sRGB textures (such as in 3DS models), the GammaCorrectionShader seems to brighten the texture more than when the EffectComposer is not used. The GammaCorrectionShader is needed when using the EffectComposer to produce similar colors to when the EffectComposer is not used. I have not been able to upgrade past r111 because of this issue.

As a side note, a similar problem was seen with generic shapes with color but it appears that setting the clearColor on the RenderPass can help with that issue but not with textured objects.

To Reproduce

  1. Create a shape with a texture and an opacity of 0.4 and use an EffectComposer, with a GammaCorrectionShader pass.
  2. Create a shape with an opacity of 0.4 just using a normal render (no EffectComposer).
  3. Note that the colors are brighter on the first shape.

Live example

The following fiddle demonstrates the issue (top is no postprocessing, bottom is using postprocessing):
https://jsfiddle.net/s5tpxq1g/1/

You can see how the bottom is brighter for the texture and a lower opacity makes the issue more apparent.

Expected behavior

Colors match when using GammaCorrectionShader in an EffectComposer compared to not using EffectComposer.

Screenshots
Snapshot from fiddle (top half does not use EffectComposer, bottom half does). The left object shows that a normal object (with clearColor set correctly) does not have an issue but the right object, having textures, differs in brightness.:
image

Platform:

  • Device: Desktop
  • OS: Windows 10, 21H2
  • Browser: Chrome/Firefox/Edge
  • Three.js version: r134 but was noted in r112, when gammaInput and gammaOutput properties were removed and GammaCorrectionShader was recommended for sRGB scenarios.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions