[Fixed] Vulkan screenshots are much brighter

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Vulkan screenshots are much brighter

Postby Nash » Fri May 10, 2019 10:17 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Vulkan screenshots are much brighter

Postby Rachael » Fri May 10, 2019 10:38 am

Do you have vk_hdr enabled? Try disabling that. (That doesn't resolve this issue though, it's just diagnosing it)
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Vulkan screenshots are much brighter

Postby Nash » Fri May 10, 2019 10:41 am

No, the HDR feature was off all along.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Vulkan screenshots are much brighter

Postby dpJudas » Fri May 10, 2019 11:02 am

Pushed a fix for this. At least what I think is the source of the problem.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Vulkan screenshots are much brighter

Postby Nash » Fri May 10, 2019 11:12 am

Can confirm that fix works, thanks for the fast response! :)
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Vulkan screenshots are much brighter

Postby _mental_ » Mon May 20, 2019 3:56 am

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?
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Vulkan screenshots are much brighter

Postby dpJudas » Mon May 20, 2019 5:02 am

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Vulkan screenshots are much brighter

Postby _mental_ » Mon May 20, 2019 5:15 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Vulkan screenshots are much brighter

Postby Graf Zahl » Mon May 20, 2019 5:20 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Vulkan screenshots are much brighter

Postby dpJudas » Mon May 20, 2019 5:43 am

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.
dpJudas
 
 
 
Joined: 28 May 2016


Return to Closed Bugs

Who is online

Users browsing this forum: MSN [Bot] and 2 guests