filament icon indicating copy to clipboard operation
filament copied to clipboard

Out-of-gamut colors produced by inverse tone mapping cause hue shifts

Open grassydragon opened this issue 4 years ago • 8 comments

Hello! As stated in this issue in the maintained Sceneform repository (https://github.com/ThomasGorisse/sceneform-android-sdk/issues/60) the inverseTonemapSRGB function makes the colors with the full pixel intensity appear incorrectly. Is it because the inverseTonemapSRGB function is an approximation and isn't suitable for converting colors from the sRGB space to the linear space (I think that is why it is used in the ViewRenderable material in Sceneform)?

grassydragon avatar May 07 '21 06:05 grassydragon

Can you define "incorrectly" please? What's the expected output and the actual output?

This function will be exact if you choose the FILMIC tone mapper in the ColorGrading API. It will be an approximation with other tone mappers.

romainguy avatar May 07 '21 15:05 romainguy

Here is what happens when I set the color in the hello-triangle example to #0000ff. Without inverseTonemapSRGB: Screenshot_20210507-184859 With inverseTonemapSRGB: Screenshot_20210507-184354 I expect the color to be close to blue.

grassydragon avatar May 07 '21 16:05 grassydragon

It should be blue, the approximation should not cause this.

romainguy avatar May 07 '21 16:05 romainguy

Oh never mind I understand what's going on. It's a hue skew caused by out of gamut colors. You can workaround the problem for now by using the FILMIC tone mapping operator instead of the default ACES_LEGACY.

romainguy avatar May 07 '21 19:05 romainguy

Thank you for the quick reply!

grassydragon avatar May 07 '21 19:05 grassydragon

@romainguy any ETA on this issue?

alexey-pelykh avatar May 31 '21 14:05 alexey-pelykh

No ETA yet. It's probably going to be a while.

pixelflinger avatar Jul 07 '21 18:07 pixelflinger

Sorry for asking it again but we are updating to the last 1.10.6 and we'd like to know if we can suppress our workaround:

filamentView.setColorGrading(
    new ColorGrading.Builder()
        .toneMapping(ColorGrading.ToneMapping.FILMIC)
        .build(EngineInstance.getEngine().getFilamentEngine())
);

ThomasGorisse avatar Jul 09 '21 14:07 ThomasGorisse