         }
 
         #if (VOLUME_COUNT >= 1)
-            color = add_volume_sample(volume_data[0], volume_transfer_function[0], volumes[0], ray_pos, steps, alpha_total, color);
-            alpha_total = clamp(alpha_total + color.a, 0., 1.);
+            color = add_volume_sample(volume_data[0], volume_transfer_function[0], volumes[0], ray_pos, color);
             #ifdef COORDINATE
                 weighted_coordinate += color;
             #endif
         #endif
         #if (VOLUME_COUNT >= 2)
-            color = add_volume_sample(volume_data[1], volume_transfer_function[1], volumes[1], ray_pos, steps, alpha_total, color);
-            alpha_total = clamp(alpha_total + color.a, 0., 1.);
+            color = add_volume_sample(volume_data[1], volume_transfer_function[1], volumes[1], ray_pos, color);
             #ifdef COORDINATE
                 weighted_coordinate += color;
             #endif
         #endif
 
-
-        #if (VOLUME_COUNT_MAX_INT == 0)
-            // we cannot exit early if we have max intensity algo, is it maybe more efficient to do this in a separate loop?
-            if(alpha_total >= 1.)
-                break;
-        #endif
 
         #if (VOLUME_COUNT_MAX_INT >= 1)
             float value = volume_sample(volume_data_max_int[0], volumes_max_int[0], ray_pos);

    return data_value;
}

vec4 add_volume_sample(sampler2D volume_data, sampler2D volume_transfer_function, Volume volume, vec3 ray_pos, int steps, float alpha_total, vec4 color_in) {
    vec4 color;
    vec3 pos_relative = (ray_pos+volume.offset)*volume.scale;
    if(any(lessThan(pos_relative, vec3(0.))) || any(greaterThan(pos_relative, vec3(1.))))

#endif


    for(int i = 0; i < MAX_STEPS; i++) {
        geometry_depth = texture2D(geometry_depth_tex, pixel); 
        voxel_view_space_coord = projectionMatrix * modelViewMatrix * vec4(ray_pos+vec3(-0.5, -0.5, -0.5),1.0);
        voxel_frag_depth = ((voxel_view_space_coord.z / voxel_view_space_coord.w)+1.0)/2.0;
