Rendering to textures has a color change

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


ccjulio
Gnoblar
Posts: 1
Joined: Wed Aug 09, 2023 3:37 pm

Rendering to textures has a color change

Post 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?

User avatar
Crystal Hammer
Orc
Posts: 405
Joined: Sat Jun 23, 2007 5:16 pm
x 115

Re: Rendering to textures has a color change

Post 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

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: Rendering to textures has a color change

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