1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029528: Visualization, TKOpenGl - allow defining sRGB textures

OpenGL rendering is now done into sRGB framebuffer.
OpenGl_ShaderManager::prepareStdProgramFboBlit() has been extended
by programs resolving MSAA texture and applying gamma correction as fallbacks.

Quantity_Color definition has been modified to store RGB components
in linear color space within Quantity_TOC_RGB type.
Standard colors defined by Quantity_NameOfColor enumeration has been updated accordingly.
New Quantity_TOC_sRGB type has been introduced to handle RGB components in non-linear sRGB color space.

OpenGl_TextureFormat class definition has been moved to dedicated files.
New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
and OpenGl_FrameBuffer::getDepthDataFormat().

Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.

vreadpixel - added argument -sRGB printing color in sRGB color space.

Test cases have been updated to new sRGB rendered results.
This commit is contained in:
kgv
2019-08-29 11:04:56 +03:00
committed by apn
parent aaf8d6a98d
commit ba00aab7a0
137 changed files with 2542 additions and 2240 deletions

View File

@@ -144,8 +144,12 @@ void main (void)
aColor = ToneMappingFilmic (aColor, uWhitePoint);
#endif // TONE_MAPPING
#ifdef THE_SHIFT_sRGB
// apply gamma correction (we use gamma = 2)
OutColor = vec4 (sqrt (aColor.rgb), 0.f);
#else
OutColor = vec4 (aColor.rgb, 0.f);
#endif
#else // not PATH_TRACING

View File

@@ -703,12 +703,15 @@ vec3 IntersectLight (in SRay theRay, in int theDepth, in float theHitDistance, o
{
if (theDepth + uSphereMapForBack == 0) // view ray and map is hidden
{
aTotalRadiance = pow (BackgroundColor().rgb, vec3 (2.f));
aTotalRadiance = BackgroundColor().rgb;
}
else
{
aTotalRadiance = pow (FetchEnvironment (Latlong (theRay.Direct)).rgb, vec3 (2.f));
aTotalRadiance = FetchEnvironment (Latlong (theRay.Direct)).rgb;
}
#ifdef THE_SHIFT_sRGB
aTotalRadiance = pow (aTotalRadiance, vec3 (2.f));
#endif
}
return aTotalRadiance;

View File

@@ -147,8 +147,12 @@ static const char Shaders_Display_fs[] =
" aColor = ToneMappingFilmic (aColor, uWhitePoint);\n"
"#endif // TONE_MAPPING\n"
"\n"
"#ifdef THE_SHIFT_sRGB\n"
" // apply gamma correction (we use gamma = 2)\n"
" OutColor = vec4 (sqrt (aColor.rgb), 0.f);\n"
"#else\n"
" OutColor = vec4 (aColor.rgb, 0.f);\n"
"#endif\n"
"\n"
"#else // not PATH_TRACING\n"
"\n"

View File

@@ -706,12 +706,15 @@ static const char Shaders_PathtraceBase_fs[] =
" {\n"
" if (theDepth + uSphereMapForBack == 0) // view ray and map is hidden\n"
" {\n"
" aTotalRadiance = pow (BackgroundColor().rgb, vec3 (2.f));\n"
" aTotalRadiance = BackgroundColor().rgb;\n"
" }\n"
" else\n"
" {\n"
" aTotalRadiance = pow (FetchEnvironment (Latlong (theRay.Direct)).rgb, vec3 (2.f));\n"
" aTotalRadiance = FetchEnvironment (Latlong (theRay.Direct)).rgb;\n"
" }\n"
" #ifdef THE_SHIFT_sRGB\n"
" aTotalRadiance = pow (aTotalRadiance, vec3 (2.f));\n"
" #endif\n"
" }\n"
" \n"
" return aTotalRadiance;\n"