0030640: Visualization, Graphic3d_Camera - add option creating Projection matrix...
[occt.git] / src / Shaders / PathtraceBase.fs
index 46a6870..caea6c1 100644 (file)
@@ -820,7 +820,11 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse, in int theNbSamples)
       vec4 aNDCPoint = uViewMat * vec4 (theRay.Origin, 1.f);
 
       float aPolygonOffset = PolygonOffset (aHit.Normal, theRay.Origin);
       vec4 aNDCPoint = uViewMat * vec4 (theRay.Origin, 1.f);
 
       float aPolygonOffset = PolygonOffset (aHit.Normal, theRay.Origin);
+    #ifdef THE_ZERO_TO_ONE_DEPTH
+      aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE);
+    #else
       aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE) * 0.5f + 0.5f;
       aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE) * 0.5f + 0.5f;
+    #endif
     }
 
     SBSDF aBSDF;
     }
 
     SBSDF aBSDF;