     // sample accumulation
     fragmentColor = fragmentColor + sampleColor * (1.0f - fragmentColor.w);
 
-    if (fragmentColor.w > alphaThresholdForDepth && position.w == -2)
+    if (fragmentColor.w > alphaThresholdForDepth && position.w == POSITION_NOT_SET)
     {
       setPositionAndDepth(vec4(startPos_eye, 1));
     }

uniform float alphaThresholdForDepth = 0.1;

uniform sampler3D volumeSampler;

#define transferFunctionRowCount 64.0f


  if (nextFragmentReadStatus)
  {
    finalColor = blend(finalColor, nextFragment.color);
    if (position.w == POSITION_NOT_SET && nextFragment.color.w > alphaThresholdForDepth)
    {
      setPositionAndDepth(nextFragment.eyePos);
    }
  }

  if (position.w == POSITION_NOT_SET)
    position.w = 1;

  finalColor = clamp(finalColor, vec4(0.0), vec4(1.0));
