Login  Register

Re: sRGB and gamma correction in Java3d

Posted by philjord on Jun 18, 2018; 9:26pm
URL: https://forum.jogamp.org/sRGB-and-gamma-correction-in-Java3d-tp4038946p4038950.html

Jim,
This is a great question and I'm fairly embarrassed to say I had no real idea how sRGB was handled until you asked this question.

The reason for that (I've discovered) is that S3TC compressed images don't separately express that they are sRGB and these are the images I've worked with mainly (through an extension to Java3D that's available in Java3D 1.7).
See issue 9 here:
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB.txt 

The open GL definition for Images states they are linear unless the GL_EXT_texture_sRGB is available
https://www.khronos.org/opengl/wiki/Image_Format
The JoglPipeline in Java3D does not query for nor use that extension.

So loading and  blending entirely in linear space is appropriate.

For more on how the fixed pipeline loads images see
https://github.com/philjord/java3d-core/blob/master/src/main/java/org/jogamp/java3d/JoglPipeline.java#L5656

For the programmable equivalent see
https://github.com/philjord/java3d-core/blob/master/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java#L5717