 void setPositionAndDepthFor(in int layerIndex, in vec4 positionInEyeSpace)
 {
   vec4 ndcPos = fromEyeToNdcSpace(positionInEyeSpace);
-  setPositionNdc(layerIndex, ndcPos);
+  setPositionNdc(layerIndex, ndcPos.zzzw);
   // TODO depth
 }
 

  float endDistance = dot(endPos_eye, layerPlanes[layerIndex]);
  while (endDistance < 0)
  {
    vec4 newPosition =
        vec4(endPos_eye.xyz - endDistance * layerPlanes[layerIndex].xyz, 1.0f);
    setPositionAndDepthFor(layerIndex, newPosition);
    setColorForLayer(layerIndex, vec4(0));
    ++layerIndex;
    endDistance = dot(endPos_eye, layerPlanes[layerIndex]);

    finalColor = blend(finalColor, nextFragment.color);
    if (nextFragment.color.a > alphaThresholdForDepth)
    {
      setPositionAndDepthFor(layerIndex, nextFragment.eyePos);
    }
    float endDistance = dot(nextFragment.eyePos, layerPlanes[layerIndex]);
    while (endDistance < 0 && layerIndex < planeCount)
