Page 1 of 1

Rendering to textures has a color change

Posted: Wed Aug 09, 2023 3:42 pm
by ccjulio

When I use one to render to texture and then sample back, the color is mapped from 255 to 209. I suspect that gamma conversion occurs when rendering to texture. Is there a way to avoid this situation?


Re: Rendering to textures has a color change

Posted: Wed Aug 09, 2023 5:58 pm
by Crystal Hammer

For me this was solved when I changed here:

Code: Select all

TextureGpu* renderTexture;
renderTexture->setPixelFormat(

from:
PFG_RGBA8_UNORM ); // dark jpg saved, good preview in app
to:
PFG_RGBA8_UNORM_SRGB ); // good jpg saved, white preview in app


Re: Rendering to textures has a color change

Posted: Thu Aug 10, 2023 5:19 pm
by dark_sylinc

As I said in Github, gamma conversion does NOT convert 255 into 209. In both linear and sRGB space 255 is 255.

Thus something else must be going on.

I forgot to ask: Did you try using RenderDoc? It even has source level debugging for shaders.