Vulkan screenshots are much brighter
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Vulkan screenshots are much brighter
When taking a screenshot with the Vulkan renderer, it seems the gamma is blown up significantly compared to OpenGL.
With OpenGL, the image result is 1:1 with the in-game rendering.
With OpenGL, the image result is 1:1 with the in-game rendering.
Re: Vulkan screenshots are much brighter
Do you have vk_hdr enabled? Try disabling that. (That doesn't resolve this issue though, it's just diagnosing it)
Re: Vulkan screenshots are much brighter
No, the HDR feature was off all along.
Re: Vulkan screenshots are much brighter
Pushed a fix for this. At least what I think is the source of the problem.
Re: Vulkan screenshots are much brighter
Can confirm that fix works, thanks for the fast response! :)
Re: Vulkan screenshots are much brighter
While that multiplier was redundant, its removal revealed the real issue with screenshots in Vulkan backend. Gamma is not applied to screenshots at all.
It's enough to assign a value of Gamma CVAR instead of 1.0 at here to fix this. Although, it's a different from what OpenGL backend does. So, is this solution correct?
It's enough to assign a value of Gamma CVAR instead of 1.0 at here to fix this. Although, it's a different from what OpenGL backend does. So, is this solution correct?
Re: Vulkan screenshots are much brighter
Doom itself has always operated in sRGB space (approx 2.2 gamma). Before postprocess was added the Gamma CVAR would be applied by hardware and thus not applied to the screenshot. I'm not sure what the gamma multiplier was set to back then. It doesn't make much sense to me to try apply the Gamma CVAR as it still will not show exactly what the user is seeing as the brightness and contrast CVARs are not included. Maybe it did anyway, I can't remember.
Because early versions of postprocess also had to support OpenGL 2 where postprocess would be completely disabled, the OpenGL backend has always created the screenshot by reading directly from the back buffer. It does this by pretending it is a completely normal render to screen, including running the Present shader and creating black borders and scaling. If the game is running at 640x480 but the monitor is 1920x1080, then its reading a 1920x1080 image. That is why you see the OpenGL backend attempt to scale the image back down to 640x480. This also means the gamma, brightness and contrast CVARs will have been applied.
The Vulkan backend does it differently. It reads the image directly from postprocess - the original 640x480 image before present. Since this is before gamma, bright and contrast those will not have been applied.
So the answer to your question comes down to what people expect from a screenshot. Should it be the raw original image, or the gamma adjusted one? Vulkan does the first, OpenGL the second. In any case, simply applying the Gamma CVAR won't be enough since that doesn't include brightness, contrast and dithering.
Because early versions of postprocess also had to support OpenGL 2 where postprocess would be completely disabled, the OpenGL backend has always created the screenshot by reading directly from the back buffer. It does this by pretending it is a completely normal render to screen, including running the Present shader and creating black borders and scaling. If the game is running at 640x480 but the monitor is 1920x1080, then its reading a 1920x1080 image. That is why you see the OpenGL backend attempt to scale the image back down to 640x480. This also means the gamma, brightness and contrast CVARs will have been applied.
The Vulkan backend does it differently. It reads the image directly from postprocess - the original 640x480 image before present. Since this is before gamma, bright and contrast those will not have been applied.
So the answer to your question comes down to what people expect from a screenshot. Should it be the raw original image, or the gamma adjusted one? Vulkan does the first, OpenGL the second. In any case, simply applying the Gamma CVAR won't be enough since that doesn't include brightness, contrast and dithering.
Re: Vulkan screenshots are much brighter
I'm expecting to get a screenshot which is exactly the same as a picture on the screen, i.e. with all necessary adjustments applied.
As far as I know, software renderers work like this. OpenGL does the same as well.
As far as I know, software renderers work like this. OpenGL does the same as well.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Vulkan screenshots are much brighter
I'd expect an image with all effects applied in the original size before scaling to the screen. The main question here is how the dithering gets applied so it doesn't get exaggerated for the screenshot.
Re: Vulkan screenshots are much brighter
I pushed a fix so it applies the present shader to the screenshot on vulkan as well.
About the dithering, we could always turn it off for screenshots if it turns out problematic. I don't know if there should be a threshold size for that or not.
About the dithering, we could always turn it off for screenshots if it turns out problematic. I don't know if there should be a threshold size for that or not.