mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0026601: Visualization, Ray Tracing - make Path Tracing results reproducible for the same camera position
OpenGl_View - reset Random Number Generator seed on progressive render restart to produce the same visual results.
This commit is contained in:
parent
1581d6511b
commit
1bd2fee414
@ -2396,6 +2396,11 @@ Standard_Boolean OpenGl_View::runRaytraceShaders (const Graphic3d_CView&
|
||||
|
||||
if (myRaytraceParameters.GlobalIllumination)
|
||||
{
|
||||
if (myAccumFrames == 0)
|
||||
{
|
||||
myRNG.SetSeed();
|
||||
}
|
||||
|
||||
// Set frame accumulation weight
|
||||
myRaytraceProgram->SetUniform (theGlContext,
|
||||
myUniformLocations[0][OpenGl_RT_uSampleWeight], 1.f / (myAccumFrames + 1));
|
||||
|
@ -24,14 +24,21 @@ class math_BullardGenerator
|
||||
public:
|
||||
|
||||
//! Creates new Xorshift 64-bit RNG.
|
||||
Standard_EXPORT math_BullardGenerator(unsigned int theSeed = 1)
|
||||
: myStateHi (theSeed)
|
||||
math_BullardGenerator (unsigned int theSeed = 1)
|
||||
: myStateHi (theSeed)
|
||||
{
|
||||
SetSeed (theSeed);
|
||||
}
|
||||
|
||||
//! Setup new seed / reset defaults.
|
||||
void SetSeed (unsigned int theSeed = 1)
|
||||
{
|
||||
myStateHi = theSeed;
|
||||
myStateLo = theSeed ^ 0x49616E42;
|
||||
}
|
||||
|
||||
//! Generates new 64-bit integer value.
|
||||
Standard_EXPORT unsigned int NextInt()
|
||||
unsigned int NextInt()
|
||||
{
|
||||
myStateHi = (myStateHi >> 2) + (myStateHi << 2);
|
||||
|
||||
@ -42,7 +49,7 @@ public:
|
||||
}
|
||||
|
||||
//! Generates new floating-point value.
|
||||
Standard_EXPORT Standard_Real NextReal()
|
||||
Standard_Real NextReal()
|
||||
{
|
||||
return NextInt() / static_cast<Standard_Real> (0xFFFFFFFFu);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user