User avatar
Gazoo
Topic Author
Posts: 36
Joined: 14 Sep 2022, 10:00
Contact:

GLFactory::CreateDevice's sRGB bool parameter is a bit confusing to me

27 Dec 2022, 11:31

Hello y'all,

I thought I'd pass along an interpretive conundrum that I've been wrestling with. I use an OpenGL-based renderer to output Noesis' visuals and hence rely on `NoesisApp::GLFactory::CreateDevice` to setup a part of this environment. `CreateDevice` takes one parameter labelled `sRGB` which after a bit of searching gets passed into a property entitled `linearRendering` (on line 3241 in GLRenderDevice.cpp).

What I can tell from observations is that I get a much brighter image if `sRGB` is set to false, and a much darker one if it's set to true.

What I'm less clear on is how to interpret the meaning of the bool sRGB being passed into linearRendering. From my short online research (https://www.willgibbons.com/linear-workflow/) sRGB is supposed to be a non-linear color space, so if sRGB is set to true, then it's a bit confusing to me that linearRendering also becomes true.

Is it because it's like the user saying, yes I'll be handling things in sRGB so Noesis should do linearRendering and I'll take care of the non-linear correction at the end?

Cheers,
Gazoo
 
User avatar
jsantos
Site Admin
Posts: 3925
Joined: 20 Jan 2012, 17:18
Contact:

Re: GLFactory::CreateDevice's sRGB bool parameter is a bit confusing to me

02 Jan 2023, 12:58

When sRGB parameter is set to true, we render internally in linear space, using SRGB textures (in D3D12 parlance, using DXGI_FORMAT_R8G8B8A8_UNORM_SRGB instead of DXGI_FORMAT_R8G8B8A8_UNORM for example) for internal render targets and texture gradients.

This affects the way ramps are interpolated and also the way alpha-blending is calculated (basically every calculation is taken to linear space, applied and then moved back to gamma space). Theoretically, this is more correct (at least from the point of view of mathematics) but definitely a deviation from WPF/Blend.

Solid colors and images without transparency should look exactly the same.

Who is online

Users browsing this forum: No registered users and 3 guests