 
         if (fragmentColor.w > 0.1 && position.w == -2)
         {
-          vec4 ndcPos = projectionMatrix * vec4(startPos_eye, 1);
-          ndcPos = ndcPos / ndcPos.w;
-          float depth = ndcPos.z;
-          gl_FragDepth = depth;
-          position.xyz = ndcPos.xyz;
-          position.w = 1.0f;
+          setPositionAndDepth(vec4(startPos_eye, 1));
         }
+
         // early ray termination
         if (fragmentColor.w > 0.999)
           break;

  return segmentTextureLength;
}

void main()
{
  o_PixColor = vec4(0);


    if (nextFragmentReadStatus && objectId == 0 && position.w == -2)
    {
      setPositionAndDepth(currentFragment.eyePos);
    }

    // fetch next Fragment
