//! Input accumulated image.
uniform sampler2D uAccumTexture;
+//! Enabled/disbales using of single RNG seed for image 16x16 blocks.
+//! Increases performance up to 4 times, but noise becomes structured.
+uniform int uBlockedRngEnabled;
+
+#define MAX_RADIANCE vec3 (10.f)
+
// =======================================================================
// function : main
// purpose :
#else
ivec2 aWinSize = textureSize (uAccumTexture, 0);
- SeedRand (uFrameRndSeed, aWinSize.x);
+ SeedRand (uFrameRndSeed, aWinSize.x, uBlockedRngEnabled == 0 ? 1 : 16);
SRay aRay = GenerateRay (vPixel +
vec2 (RandFloat() + 1.f, RandFloat() + 1.f) / vec2 (aWinSize));
aRay.Direct.z < 0.f ? -aInvDirect.z : aInvDirect.z);
#ifdef PATH_TRACING
-
vec4 aColor = PathTrace (aRay, aInvDirect);
if (any (isnan (aColor.xyz)))
{
- aColor.xyz = ZERO;
+ aColor.rgb = ZERO;
}
- OutColor = mix (texture2D (uAccumTexture, vPixel), aColor, uSampleWeight);
+ aColor.rgb = min (aColor.rgb, MAX_RADIANCE);
+ OutColor = mix (texture2D (uAccumTexture, vPixel), aColor, uSampleWeight);
#else
-
OutColor = clamp (Radiance (aRay, aInvDirect), 0.f, 1.f);
-
#endif
}
\ No newline at end of file