0030640: Visualization, Graphic3d_Camera - add option creating Projection matrix...
[occt.git] / src / Shaders / Shaders_PathtraceBase_fs.pxx
index ab7c0dd..6da9ccd 100644 (file)
@@ -823,7 +823,11 @@ static const char Shaders_PathtraceBase_fs[] =
   "      vec4 aNDCPoint = uViewMat * vec4 (theRay.Origin, 1.f);\n"
   "\n"
   "      float aPolygonOffset = PolygonOffset (aHit.Normal, theRay.Origin);\n"
   "      vec4 aNDCPoint = uViewMat * vec4 (theRay.Origin, 1.f);\n"
   "\n"
   "      float aPolygonOffset = PolygonOffset (aHit.Normal, theRay.Origin);\n"
+  "    #ifdef THE_ZERO_TO_ONE_DEPTH\n"
+  "      aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE);\n"
+  "    #else\n"
   "      aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE) * 0.5f + 0.5f;\n"
   "      aRaytraceDepth = (aNDCPoint.z / aNDCPoint.w + aPolygonOffset * POLYGON_OFFSET_SCALE) * 0.5f + 0.5f;\n"
+  "    #endif\n"
   "    }\n"
   "\n"
   "    SBSDF aBSDF;\n"
   "    }\n"
   "\n"
   "    SBSDF aBSDF;\n"