mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0031196: Visualization, TKOpenGl - enable Ray-Tracing using OpenGL ES 3.2
OpenGl_Context now activates Ray-Tracing and arbTboRGB32 for GLES 3.2. Removed initialization of some uniforms from GLSL code. Fixed implicit casts within Ray-Tracing shaders.
This commit is contained in:
@@ -126,11 +126,9 @@ void main (void)
|
||||
else // showing number of samples
|
||||
{
|
||||
vec2 aRatio = vec2 (1.f, 1.f);
|
||||
|
||||
#ifdef GL_ARB_shader_image_size
|
||||
aRatio = vec2 (imageSize (uRenderImage)) / vec2 (3.f * 512.f, 2.f * 512.f);
|
||||
#endif
|
||||
|
||||
aColor = vec4 (0.5f * aColor.rgb * aSampleWeight + vec3 (0.f, sqrt (aRatio.x * aRatio.y) * aColor.w / uAccumFrames * 0.35f, 0.f), 1.0);
|
||||
}
|
||||
|
||||
@@ -138,7 +136,7 @@ void main (void)
|
||||
|
||||
#ifdef PATH_TRACING
|
||||
|
||||
aColor *= pow (2, uExposure);
|
||||
aColor *= pow (2.0, uExposure);
|
||||
|
||||
#ifdef TONE_MAPPING_FILMIC
|
||||
aColor = ToneMappingFilmic (aColor, uWhitePoint);
|
||||
|
@@ -643,25 +643,18 @@ float HandleDistantLight (in vec3 theInput, in vec3 theToLight, in float theCosM
|
||||
vec3 IntersectLight (in SRay theRay, in int theDepth, in float theHitDistance, out float thePDF)
|
||||
{
|
||||
vec3 aTotalRadiance = ZERO;
|
||||
|
||||
thePDF = 0.f; // PDF of sampling light sources
|
||||
|
||||
for (int aLightIdx = 0; aLightIdx < uLightCount; ++aLightIdx)
|
||||
{
|
||||
vec4 aLight = texelFetch (
|
||||
uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));
|
||||
vec4 aParam = texelFetch (
|
||||
uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));
|
||||
vec4 aLight = texelFetch (uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));
|
||||
vec4 aParam = texelFetch (uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));
|
||||
|
||||
// W component: 0 for infinite light and 1 for point light
|
||||
aLight.xyz -= mix (ZERO, theRay.Origin, aLight.w);
|
||||
|
||||
float aPDF = 1.f / uLightCount;
|
||||
|
||||
float aPDF = 1.0 / float(uLightCount);
|
||||
if (aLight.w != 0.f) // point light source
|
||||
{
|
||||
float aCenterDst = length (aLight.xyz);
|
||||
|
||||
if (aCenterDst < theHitDistance)
|
||||
{
|
||||
float aVisibility = HandlePointLight (
|
||||
@@ -909,14 +902,12 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse, in int theNbSamples)
|
||||
|
||||
if (uLightCount > 0 && IsNotZero (aBSDF, aThroughput))
|
||||
{
|
||||
aExpPDF = 1.f / uLightCount;
|
||||
aExpPDF = 1.0 / float(uLightCount);
|
||||
|
||||
int aLightIdx = min (int (floor (RandFloat() * uLightCount)), uLightCount - 1);
|
||||
int aLightIdx = min (int (floor (RandFloat() * float(uLightCount))), uLightCount - 1);
|
||||
|
||||
vec4 aLight = texelFetch (
|
||||
uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));
|
||||
vec4 aParam = texelFetch (
|
||||
uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));
|
||||
vec4 aLight = texelFetch (uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));
|
||||
vec4 aParam = texelFetch (uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));
|
||||
|
||||
// 'w' component is 0 for infinite light and 1 for point light
|
||||
aLight.xyz -= mix (ZERO, theRay.Origin, aLight.w);
|
||||
@@ -971,7 +962,9 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse, in int theNbSamples)
|
||||
#endif
|
||||
|
||||
// here, we additionally increase path length for non-diffuse bounces
|
||||
if (RandFloat() > aSurvive || all (lessThan (aThroughput, MIN_THROUGHPUT)) || aDepth >= theNbSamples / FRAME_STEP + step (1.f / M_PI, aImpPDF))
|
||||
if (RandFloat() > aSurvive
|
||||
|| all (lessThan (aThroughput, MIN_THROUGHPUT))
|
||||
|| aDepth >= (theNbSamples / FRAME_STEP + int(step (1.0 / M_PI, aImpPDF))))
|
||||
{
|
||||
aDepth = INVALID_BOUNCES; // terminate path
|
||||
}
|
||||
|
@@ -12,10 +12,10 @@
|
||||
//! Normalized pixel coordinates.
|
||||
in vec2 vPixel;
|
||||
|
||||
//! Sub-pixel offset in X direction for FSAA.
|
||||
uniform float uOffsetX = 0.f;
|
||||
//! Sub-pixel offset in for FSAA.
|
||||
uniform vec2 uFsaaOffset;
|
||||
//! Sub-pixel offset in Y direction for FSAA.
|
||||
uniform float uOffsetY = 0.f;
|
||||
uniform float uOffsetY;
|
||||
|
||||
//! Origin of viewing ray in left-top corner.
|
||||
uniform vec3 uOriginLT;
|
||||
@@ -124,15 +124,15 @@ uniform float uSceneEpsilon;
|
||||
#endif
|
||||
|
||||
//! Top color of gradient background.
|
||||
uniform vec4 uBackColorTop = vec4 (0.0);
|
||||
uniform vec4 uBackColorTop;
|
||||
//! Bottom color of gradient background.
|
||||
uniform vec4 uBackColorBot = vec4 (0.0);
|
||||
uniform vec4 uBackColorBot;
|
||||
|
||||
//! Aperture radius of camera used for depth-of-field
|
||||
uniform float uApertureRadius = 0.f;
|
||||
uniform float uApertureRadius;
|
||||
|
||||
//! Focal distance of camera used for depth-of field
|
||||
uniform float uFocalPlaneDist = 10.f;
|
||||
uniform float uFocalPlaneDist;
|
||||
|
||||
//! Camera position used for projective mode
|
||||
uniform vec3 uEyeOrig;
|
||||
@@ -156,7 +156,6 @@ uniform vec2 uEyeSize;
|
||||
struct SRay
|
||||
{
|
||||
vec3 Origin;
|
||||
|
||||
vec3 Direct;
|
||||
};
|
||||
|
||||
@@ -164,9 +163,7 @@ struct SRay
|
||||
struct SIntersect
|
||||
{
|
||||
float Time;
|
||||
|
||||
vec2 UV;
|
||||
|
||||
vec3 Normal;
|
||||
};
|
||||
|
||||
@@ -174,7 +171,6 @@ struct SIntersect
|
||||
struct STriangle
|
||||
{
|
||||
ivec4 TriIndex;
|
||||
|
||||
vec3 Points[3];
|
||||
};
|
||||
|
||||
|
@@ -18,7 +18,7 @@ uniform int uAccumSamples;
|
||||
|
||||
//! Maximum radiance that can be added to the pixel.
|
||||
//! Decreases noise level, but introduces some bias.
|
||||
uniform float uMaxRadiance = 50.f;
|
||||
uniform float uMaxRadiance;
|
||||
|
||||
#ifdef ADAPTIVE_SAMPLING
|
||||
//! Wrapper over imageLoad()+imageStore() having similar syntax as imageAtomicAdd().
|
||||
@@ -77,8 +77,8 @@ void main (void)
|
||||
|
||||
#endif // ADAPTIVE_SAMPLING
|
||||
|
||||
vec2 aPnt = vec2 (aFragCoord.x + RandFloat(),
|
||||
aFragCoord.y + RandFloat());
|
||||
vec2 aPnt = vec2 (float(aFragCoord.x) + RandFloat(),
|
||||
float(aFragCoord.y) + RandFloat());
|
||||
|
||||
SRay aRay = GenerateRay (aPnt / vec2 (uWinSizeX, uWinSizeY));
|
||||
|
||||
@@ -89,21 +89,16 @@ void main (void)
|
||||
#ifdef PATH_TRACING
|
||||
|
||||
#ifndef ADAPTIVE_SAMPLING
|
||||
|
||||
vec4 aColor = PathTrace (aRay, aInvDirect, uAccumSamples);
|
||||
|
||||
#else
|
||||
|
||||
float aNbSamples = addRenderImageComp (aFragCoord, ivec2 (0, 1), 1.0);
|
||||
vec4 aColor = PathTrace (aRay, aInvDirect, int (aNbSamples));
|
||||
|
||||
#endif
|
||||
|
||||
if (any (isnan (aColor.rgb)))
|
||||
{
|
||||
aColor.rgb = ZERO;
|
||||
}
|
||||
|
||||
aColor.rgb = min (aColor.rgb, vec3 (uMaxRadiance));
|
||||
|
||||
#ifdef ADAPTIVE_SAMPLING
|
||||
@@ -113,7 +108,6 @@ void main (void)
|
||||
addRenderImageComp (aFragCoord, ivec2 (1, 0), aColor.g);
|
||||
addRenderImageComp (aFragCoord, ivec2 (1, 1), aColor.b);
|
||||
addRenderImageComp (aFragCoord, ivec2 (2, 1), aColor.w);
|
||||
|
||||
if (int (aNbSamples) % 2 == 0) // accumulate luminance for even samples only
|
||||
{
|
||||
addRenderImageComp (aFragCoord, ivec2 (2, 0), dot (LUMA, aColor.rgb));
|
||||
@@ -127,7 +121,7 @@ void main (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
OutColor = mix (texture (uAccumTexture, vPixel), aColor, 1.f / (uAccumSamples + 1));
|
||||
OutColor = mix (texture (uAccumTexture, vPixel), aColor, 1.0 / float(uAccumSamples + 1));
|
||||
}
|
||||
|
||||
#endif // ADAPTIVE_SAMPLING
|
||||
|
@@ -21,8 +21,8 @@ void main (void)
|
||||
int aPixelY = int (gl_FragCoord.y);
|
||||
|
||||
// Adjust FLIPTRI pattern used for adaptive FSAA
|
||||
float anOffsetX = mix (uOffsetX, -uOffsetX, float (aPixelX % 2));
|
||||
float anOffsetY = mix (uOffsetY, -uOffsetY, float (aPixelY % 2));
|
||||
float anOffsetX = mix (uFsaaOffset.x, -uFsaaOffset.x, float (aPixelX % 2));
|
||||
float anOffsetY = mix (uFsaaOffset.y, -uFsaaOffset.y, float (aPixelY % 2));
|
||||
|
||||
vec4 aClr0 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY + 0), 0);
|
||||
vec4 aClr1 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY - 1), 0);
|
||||
@@ -71,7 +71,7 @@ void main (void)
|
||||
aRay.Direct.y < 0.f ? -aInvDirect.y : aInvDirect.y,
|
||||
aRay.Direct.z < 0.f ? -aInvDirect.z : aInvDirect.z);
|
||||
|
||||
aColor = mix (aClr0, clamp (Radiance (aRay, aInvDirect), 0.f, 1.f), 1.f / uSamples);
|
||||
aColor = mix (aClr0, clamp (Radiance (aRay, aInvDirect), 0.0, 1.0), 1.0 / float(uSamples));
|
||||
}
|
||||
|
||||
OutColor = aColor;
|
||||
|
@@ -129,11 +129,9 @@ static const char Shaders_Display_fs[] =
|
||||
" else // showing number of samples\n"
|
||||
" {\n"
|
||||
" vec2 aRatio = vec2 (1.f, 1.f);\n"
|
||||
"\n"
|
||||
"#ifdef GL_ARB_shader_image_size\n"
|
||||
" aRatio = vec2 (imageSize (uRenderImage)) / vec2 (3.f * 512.f, 2.f * 512.f);\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
" aColor = vec4 (0.5f * aColor.rgb * aSampleWeight + vec3 (0.f, sqrt (aRatio.x * aRatio.y) * aColor.w / uAccumFrames * 0.35f, 0.f), 1.0);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
@@ -141,7 +139,7 @@ static const char Shaders_Display_fs[] =
|
||||
"\n"
|
||||
"#ifdef PATH_TRACING\n"
|
||||
"\n"
|
||||
" aColor *= pow (2, uExposure);\n"
|
||||
" aColor *= pow (2.0, uExposure);\n"
|
||||
"\n"
|
||||
"#ifdef TONE_MAPPING_FILMIC\n"
|
||||
" aColor = ToneMappingFilmic (aColor, uWhitePoint);\n"
|
||||
|
@@ -646,25 +646,18 @@ static const char Shaders_PathtraceBase_fs[] =
|
||||
"vec3 IntersectLight (in SRay theRay, in int theDepth, in float theHitDistance, out float thePDF)\n"
|
||||
"{\n"
|
||||
" vec3 aTotalRadiance = ZERO;\n"
|
||||
"\n"
|
||||
" thePDF = 0.f; // PDF of sampling light sources\n"
|
||||
"\n"
|
||||
" for (int aLightIdx = 0; aLightIdx < uLightCount; ++aLightIdx)\n"
|
||||
" {\n"
|
||||
" vec4 aLight = texelFetch (\n"
|
||||
" uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));\n"
|
||||
" vec4 aParam = texelFetch (\n"
|
||||
" uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));\n"
|
||||
" vec4 aLight = texelFetch (uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));\n"
|
||||
" vec4 aParam = texelFetch (uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));\n"
|
||||
"\n"
|
||||
" // W component: 0 for infinite light and 1 for point light\n"
|
||||
" aLight.xyz -= mix (ZERO, theRay.Origin, aLight.w);\n"
|
||||
"\n"
|
||||
" float aPDF = 1.f / uLightCount;\n"
|
||||
"\n"
|
||||
" float aPDF = 1.0 / float(uLightCount);\n"
|
||||
" if (aLight.w != 0.f) // point light source\n"
|
||||
" {\n"
|
||||
" float aCenterDst = length (aLight.xyz);\n"
|
||||
"\n"
|
||||
" if (aCenterDst < theHitDistance)\n"
|
||||
" {\n"
|
||||
" float aVisibility = HandlePointLight (\n"
|
||||
@@ -912,14 +905,12 @@ static const char Shaders_PathtraceBase_fs[] =
|
||||
"\n"
|
||||
" if (uLightCount > 0 && IsNotZero (aBSDF, aThroughput))\n"
|
||||
" {\n"
|
||||
" aExpPDF = 1.f / uLightCount;\n"
|
||||
" aExpPDF = 1.0 / float(uLightCount);\n"
|
||||
"\n"
|
||||
" int aLightIdx = min (int (floor (RandFloat() * uLightCount)), uLightCount - 1);\n"
|
||||
" int aLightIdx = min (int (floor (RandFloat() * float(uLightCount))), uLightCount - 1);\n"
|
||||
"\n"
|
||||
" vec4 aLight = texelFetch (\n"
|
||||
" uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));\n"
|
||||
" vec4 aParam = texelFetch (\n"
|
||||
" uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));\n"
|
||||
" vec4 aLight = texelFetch (uRaytraceLightSrcTexture, LIGHT_POS (aLightIdx));\n"
|
||||
" vec4 aParam = texelFetch (uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx));\n"
|
||||
"\n"
|
||||
" // 'w' component is 0 for infinite light and 1 for point light\n"
|
||||
" aLight.xyz -= mix (ZERO, theRay.Origin, aLight.w);\n"
|
||||
@@ -974,7 +965,9 @@ static const char Shaders_PathtraceBase_fs[] =
|
||||
"#endif\n"
|
||||
"\n"
|
||||
" // here, we additionally increase path length for non-diffuse bounces\n"
|
||||
" if (RandFloat() > aSurvive || all (lessThan (aThroughput, MIN_THROUGHPUT)) || aDepth >= theNbSamples / FRAME_STEP + step (1.f / M_PI, aImpPDF))\n"
|
||||
" if (RandFloat() > aSurvive\n"
|
||||
" || all (lessThan (aThroughput, MIN_THROUGHPUT))\n"
|
||||
" || aDepth >= (theNbSamples / FRAME_STEP + int(step (1.0 / M_PI, aImpPDF))))\n"
|
||||
" {\n"
|
||||
" aDepth = INVALID_BOUNCES; // terminate path\n"
|
||||
" }\n"
|
||||
|
@@ -15,10 +15,10 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
"//! Normalized pixel coordinates.\n"
|
||||
"in vec2 vPixel;\n"
|
||||
"\n"
|
||||
"//! Sub-pixel offset in X direction for FSAA.\n"
|
||||
"uniform float uOffsetX = 0.f;\n"
|
||||
"//! Sub-pixel offset in for FSAA.\n"
|
||||
"uniform vec2 uFsaaOffset;\n"
|
||||
"//! Sub-pixel offset in Y direction for FSAA.\n"
|
||||
"uniform float uOffsetY = 0.f;\n"
|
||||
"uniform float uOffsetY;\n"
|
||||
"\n"
|
||||
"//! Origin of viewing ray in left-top corner.\n"
|
||||
"uniform vec3 uOriginLT;\n"
|
||||
@@ -127,15 +127,15 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"//! Top color of gradient background.\n"
|
||||
"uniform vec4 uBackColorTop = vec4 (0.0);\n"
|
||||
"uniform vec4 uBackColorTop;\n"
|
||||
"//! Bottom color of gradient background.\n"
|
||||
"uniform vec4 uBackColorBot = vec4 (0.0);\n"
|
||||
"uniform vec4 uBackColorBot;\n"
|
||||
"\n"
|
||||
"//! Aperture radius of camera used for depth-of-field\n"
|
||||
"uniform float uApertureRadius = 0.f;\n"
|
||||
"uniform float uApertureRadius;\n"
|
||||
"\n"
|
||||
"//! Focal distance of camera used for depth-of field\n"
|
||||
"uniform float uFocalPlaneDist = 10.f;\n"
|
||||
"uniform float uFocalPlaneDist;\n"
|
||||
"\n"
|
||||
"//! Camera position used for projective mode\n"
|
||||
"uniform vec3 uEyeOrig;\n"
|
||||
@@ -159,7 +159,6 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
"struct SRay\n"
|
||||
"{\n"
|
||||
" vec3 Origin;\n"
|
||||
"\n"
|
||||
" vec3 Direct;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
@@ -167,9 +166,7 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
"struct SIntersect\n"
|
||||
"{\n"
|
||||
" float Time;\n"
|
||||
"\n"
|
||||
" vec2 UV;\n"
|
||||
"\n"
|
||||
" vec3 Normal;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
@@ -177,7 +174,6 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
"struct STriangle\n"
|
||||
"{\n"
|
||||
" ivec4 TriIndex;\n"
|
||||
"\n"
|
||||
" vec3 Points[3];\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
|
@@ -21,7 +21,7 @@ static const char Shaders_RaytraceRender_fs[] =
|
||||
"\n"
|
||||
"//! Maximum radiance that can be added to the pixel.\n"
|
||||
"//! Decreases noise level, but introduces some bias.\n"
|
||||
"uniform float uMaxRadiance = 50.f;\n"
|
||||
"uniform float uMaxRadiance;\n"
|
||||
"\n"
|
||||
"#ifdef ADAPTIVE_SAMPLING\n"
|
||||
"//! Wrapper over imageLoad()+imageStore() having similar syntax as imageAtomicAdd().\n"
|
||||
@@ -80,8 +80,8 @@ static const char Shaders_RaytraceRender_fs[] =
|
||||
"\n"
|
||||
"#endif // ADAPTIVE_SAMPLING\n"
|
||||
"\n"
|
||||
" vec2 aPnt = vec2 (aFragCoord.x + RandFloat(),\n"
|
||||
" aFragCoord.y + RandFloat());\n"
|
||||
" vec2 aPnt = vec2 (float(aFragCoord.x) + RandFloat(),\n"
|
||||
" float(aFragCoord.y) + RandFloat());\n"
|
||||
"\n"
|
||||
" SRay aRay = GenerateRay (aPnt / vec2 (uWinSizeX, uWinSizeY));\n"
|
||||
"\n"
|
||||
@@ -92,21 +92,16 @@ static const char Shaders_RaytraceRender_fs[] =
|
||||
"#ifdef PATH_TRACING\n"
|
||||
"\n"
|
||||
"#ifndef ADAPTIVE_SAMPLING\n"
|
||||
"\n"
|
||||
" vec4 aColor = PathTrace (aRay, aInvDirect, uAccumSamples);\n"
|
||||
"\n"
|
||||
"#else\n"
|
||||
"\n"
|
||||
" float aNbSamples = addRenderImageComp (aFragCoord, ivec2 (0, 1), 1.0);\n"
|
||||
" vec4 aColor = PathTrace (aRay, aInvDirect, int (aNbSamples));\n"
|
||||
"\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
" if (any (isnan (aColor.rgb)))\n"
|
||||
" {\n"
|
||||
" aColor.rgb = ZERO;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" aColor.rgb = min (aColor.rgb, vec3 (uMaxRadiance));\n"
|
||||
"\n"
|
||||
"#ifdef ADAPTIVE_SAMPLING\n"
|
||||
@@ -116,7 +111,6 @@ static const char Shaders_RaytraceRender_fs[] =
|
||||
" addRenderImageComp (aFragCoord, ivec2 (1, 0), aColor.g);\n"
|
||||
" addRenderImageComp (aFragCoord, ivec2 (1, 1), aColor.b);\n"
|
||||
" addRenderImageComp (aFragCoord, ivec2 (2, 1), aColor.w);\n"
|
||||
"\n"
|
||||
" if (int (aNbSamples) % 2 == 0) // accumulate luminance for even samples only\n"
|
||||
" {\n"
|
||||
" addRenderImageComp (aFragCoord, ivec2 (2, 0), dot (LUMA, aColor.rgb));\n"
|
||||
@@ -130,7 +124,7 @@ static const char Shaders_RaytraceRender_fs[] =
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" OutColor = mix (texture (uAccumTexture, vPixel), aColor, 1.f / (uAccumSamples + 1));\n"
|
||||
" OutColor = mix (texture (uAccumTexture, vPixel), aColor, 1.0 / float(uAccumSamples + 1));\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"#endif // ADAPTIVE_SAMPLING\n"
|
||||
|
@@ -24,8 +24,8 @@ static const char Shaders_RaytraceSmooth_fs[] =
|
||||
" int aPixelY = int (gl_FragCoord.y);\n"
|
||||
"\n"
|
||||
" // Adjust FLIPTRI pattern used for adaptive FSAA\n"
|
||||
" float anOffsetX = mix (uOffsetX, -uOffsetX, float (aPixelX % 2));\n"
|
||||
" float anOffsetY = mix (uOffsetY, -uOffsetY, float (aPixelY % 2));\n"
|
||||
" float anOffsetX = mix (uFsaaOffset.x, -uFsaaOffset.x, float (aPixelX % 2));\n"
|
||||
" float anOffsetY = mix (uFsaaOffset.y, -uFsaaOffset.y, float (aPixelY % 2));\n"
|
||||
"\n"
|
||||
" vec4 aClr0 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY + 0), 0);\n"
|
||||
" vec4 aClr1 = texelFetch (uFSAAInputTexture, ivec2 (aPixelX + 0, aPixelY - 1), 0);\n"
|
||||
@@ -74,7 +74,7 @@ static const char Shaders_RaytraceSmooth_fs[] =
|
||||
" aRay.Direct.y < 0.f ? -aInvDirect.y : aInvDirect.y,\n"
|
||||
" aRay.Direct.z < 0.f ? -aInvDirect.z : aInvDirect.z);\n"
|
||||
"\n"
|
||||
" aColor = mix (aClr0, clamp (Radiance (aRay, aInvDirect), 0.f, 1.f), 1.f / uSamples);\n"
|
||||
" aColor = mix (aClr0, clamp (Radiance (aRay, aInvDirect), 0.0, 1.0), 1.0 / float(uSamples));\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" OutColor = aColor;\n"
|
||||
|
Reference in New Issue
Block a user