godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.28k stars 19.2k forks source link

CanvasModulate color too bright when using 2D HDR #92796

Open reimgrab opened 3 weeks ago

reimgrab commented 3 weeks ago

Tested versions

Reproducible in 4.2.2 Not reproducible in 3.x

System information

Godot v4.2.2.stable.mono - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (nvidia; 535.171.04) - Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz (4 Threads)

Issue description

When using a CanvasModulate with 2D HDR enabled the modulate color is too bright. Modulate color 1, 1, 1, 255: cm

The color should be converted to linear space to get similar results to a CanvasModulate without 2D HDR enabled.

Steps to reproduce

-Add Sprite to project -Add CanvasModulate to project -Set modulate color to anything besides pure black or white -Compare 2D HDR enabled to disabled

Minimal reproduction project (MRP)

cm_mrp.zip

Calinou commented 3 weeks ago

Can you test the latest master branch, now that https://github.com/godotengine/godot/pull/92444 was merged?

reimgrab commented 3 weeks ago

Not fixed in v4.3.beta.custom_build [e96ad5af9].

clayjohn commented 3 weeks ago

As the OP says, the canvas_modulate just needs to be converted to linear in canvas_render_items() before it is passed to the shader

feiyue-z commented 1 week ago

I tried to convert the values in CanvasModulate from sRGB to linear but then I got this seemingly weird result. I'm new to the project and I'm not quite sure if this is the expected behavior: 2D HDR off

Screenshot 2024-06-25 at 7 00 18 PM

2D HDR on

Screenshot 2024-06-25 at 6 58 32 PM
reimgrab commented 3 days ago

Did you restart the editor after switching to HDR?