- vec2 back_coord = gl_FragCoord.xy*uInverseRatioMain.xy*uInverseRatioDepth.xy;
- float back_depth = texture( uTexSceneDepth, back_coord ).r;
- float front_depth = gl_FragCoord.z/gl_FragCoord.w;
+ if( uDepthCompare ){
+ vec2 back_coord = gl_FragCoord.xy * uInverseRatioMain.xy
+ * uInverseRatioDepth.xy;
+ float back_depth = texture( uTexSceneDepth, back_coord ).r;
+ float front_depth = gl_FragCoord.z/gl_FragCoord.w;