 }
 
 vec4 calculateColorOfVolumes(in int activeObjects, in int activeObjectCount,
-    in vec4 segmentStartPos_eye, in vec4 endPos_eye, in vec4 fragmentColor)
+    in vec4 segmentStartPos_eye, in vec4 endPos_eye, in vec4 fragmentColor, inout float depth)
 {
   float segmentTextureLength  = calculateSegmentTextureLength(activeObjectCount,
       activeObjects, segmentStartPos_eye, endPos_eye);


uniform sampler3D volumeSampler;

#define transferFunctionRowCount 64.0f

struct VolumeData


    if (activeObjectCount > 0)
    {
      float depth;
      fragmentColor = calculateColorOfVolumes(activeObjects, activeObjectCount,
          segmentStartPos_eye, endPos_eye, fragmentColor, depth);
      finalColor = finalColor + fragmentColor * (1.0f - finalColor.a);

      setPositionNdc(layerIndex, vec4(0, 0, depth, 1));
    }
    else
    {
