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

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


void setPositionAndDepth(vec4 positionInEyeSpace)
{
  if (position.w == POSITION_NOT_SET)
  {
    vec4 ndcPos = projectionMatrix * positionInEyeSpace;
    ndcPos = ndcPos / ndcPos.w;
    float depth = ndcPos.z;
    gl_FragDepth = depth;
    position.xyz = ndcPos.xyz;
    position.w = 1.0f;
  }
}

vec4 calculateSampleColor(in uint remainingActiveObjects, in int activeObjectCount,
