Vulkan screenshots are much brighter

Bugs that have been investigated and resolved somehow.

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.
Post Reply
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Vulkan screenshots are much brighter

Post by Nash »

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.
User avatar
Rachael
Posts: 13531
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Vulkan screenshots are much brighter

Post by Rachael »

Do you have vk_hdr enabled? Try disabling that. (That doesn't resolve this issue though, it's just diagnosing it)
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Vulkan screenshots are much brighter

Post by Nash »

No, the HDR feature was off all along.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Vulkan screenshots are much brighter

Post by dpJudas »

Pushed a fix for this. At least what I think is the source of the problem.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Vulkan screenshots are much brighter

Post by Nash »

Can confirm that fix works, thanks for the fast response! :)
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Vulkan screenshots are much brighter

Post by _mental_ »

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?
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Vulkan screenshots are much brighter

Post by dpJudas »

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.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Vulkan screenshots are much brighter

Post by _mental_ »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Vulkan screenshots are much brighter

Post by Graf Zahl »

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.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Vulkan screenshots are much brighter

Post by dpJudas »

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.
Post Reply

Return to “Closed Bugs [GZDoom]”