-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Colors When 2D HDR Enabled #82351
Comments
When using HDR mode in 2D, we render 2D in linear color space (not gamma color space like before). So the color of the image in the Viewport is going to look different if not altered before viewing. If you treat that PNG like a linear space image in your image viewer, it should look correct. The problem is that image viewers typically assume that they are getting a gamma encoded image. I can see how this is a bit unexpected from the user perspective as Godot automagically converts your image into gamme/srgb space automatically when drawing to the screen. One option could be to convert to gamma/srgb space when calling |
I think we should document linear to sRGB conversion in the |
Just to add to this issue, we need to discuss a proper fix as a straightforward fix will likely lead to confusion. First of all, this bug report could be closed with the below code that forces the HDR render target to sRGB space before returning it in
However, this code would force users to always read back linear HDR render targets in LDR sRGB space. As background, we added the 2D HDR mode for two reasons:
The users who need it for reason number 2, need the data to stay as it is and not be changed arbitrarily by Godot. Making the change I suggest above would break use-case number 2 (only when using I have a feeling the best plan of action will be:
@Calinou Can you think of any reason why movie mode should use RGBA16 instead of RGBA8? My assumptions is that users of the movie maker mode will want RGBA8 output. |
RGBA16 output is relevant when you want MovieWriter to write linear (non-tonemapped) output for later compositing in external software, or when you're writing the depth buffer to the alpha channel (also for compositing purposes). We don't have an easy way to write the depth buffer to the alpha channel yet, but it might be feasible using a custom post-processing shader. That said, for 99% of use cases, writing RGBA8 is fine. I think it makes sense to always convert to RGBA8 sRGB for now, then we can add a project setting later once users need more advanced use cases (and there is a way to properly write this data1). Footnotes
|
Godot version
4.2.dev5
System information
Windows 11 / Godot 4.2.dev5 / Intel i7-1355U
Issue description
taking a screenshot of the screen when the 2D HDR enabled results with a really weird color shift
Here's the screenshot that I got:

How should it be:

Steps to reproduce
"Take a screenshot / take a video" when the 2D HDR disabled and compare it with the 2D HDR enabled
here's the code to speed the test process :D
Minimal reproduction project
TestRecording.zip
just remember to enable & disable the 2D HDR mode from the project settings
The text was updated successfully, but these errors were encountered: