mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0028794: Visualization, Ray tracing - Implement tone mapping
Added enum Graphic3d_ToneMappingMethod for choosing tone mapping mode. Added new rendering parameters. Added tone mapping to Display.fs shader.
This commit is contained in:
@@ -1148,6 +1148,15 @@ TCollection_AsciiString OpenGl_View::generateShaderPrefix (const Handle(OpenGl_C
|
||||
{
|
||||
aPrefixString += TCollection_AsciiString ("\n#define TWO_SIDED_BXDF");
|
||||
}
|
||||
|
||||
switch (myRaytraceParameters.ToneMappingMethod)
|
||||
{
|
||||
case Graphic3d_ToneMappingMethod_Disabled:
|
||||
break;
|
||||
case Graphic3d_ToneMappingMethod_Filmic:
|
||||
aPrefixString += TCollection_AsciiString ("\n#define TONE_MAPPING_FILMIC");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return aPrefixString;
|
||||
@@ -1412,6 +1421,12 @@ Standard_Boolean OpenGl_View::initRaytraceResources (const Handle(OpenGl_Context
|
||||
aToRebuildShaders = Standard_True;
|
||||
}
|
||||
|
||||
if (myRenderParams.ToneMappingMethod != myRaytraceParameters.ToneMappingMethod)
|
||||
{
|
||||
myRaytraceParameters.ToneMappingMethod = myRenderParams.ToneMappingMethod;
|
||||
aToRebuildShaders = true;
|
||||
}
|
||||
|
||||
if (aToRebuildShaders)
|
||||
{
|
||||
// Reject accumulated frames
|
||||
@@ -2931,6 +2946,19 @@ Standard_Boolean OpenGl_View::runPathtrace (const Standard_Integer
|
||||
myOutImageProgram->SetUniform (theGlContext, "uDebugAdaptive", myRenderParams.ShowSamplingTiles ? 1 : 0);
|
||||
}
|
||||
|
||||
if (myRaytraceParameters.GlobalIllumination)
|
||||
{
|
||||
myOutImageProgram->SetUniform(theGlContext, "uExposure", myRenderParams.Exposure);
|
||||
switch (myRaytraceParameters.ToneMappingMethod)
|
||||
{
|
||||
case Graphic3d_ToneMappingMethod_Disabled:
|
||||
break;
|
||||
case Graphic3d_ToneMappingMethod_Filmic:
|
||||
myOutImageProgram->SetUniform (theGlContext, "uWhitePoint", myRenderParams.WhitePoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (theReadDrawFbo != NULL)
|
||||
{
|
||||
theReadDrawFbo->BindBuffer (theGlContext);
|
||||
|
Reference in New Issue
Block a user