anchor.diff:        // approximate ray-cell intersection
         sample_pos = (sample_pos - sampleStep) - sampleStep * (prev_density / (density - prev_density));
   
  -      float final_density = sample(sample_pos);
  -      #ifdef GRAD_NORMALS
  -      vec3 view_normal = normalize((NormalMatrix * vec4(get_gradient(sample_pos), 0.0f)).xyz);
  -      #else
  -      vec3 view_normal = normalize((NormalMatrix * vec4(blendNormals(sample_pos), 0.0f)).xyz);
  -      #endif
  -      vec3 view_pos = (gl_ModelViewMatrix * vol_to_world * vec4(sample_pos, 1.0f)).xyz;
  -
  -      if (g_shade_mode == 3u) {
  -        out_Color = vec4(blendCameras(sample_pos), 1.0f);
  -      }
  -      else {
  -        vec3 diffuseColor = blendColors(sample_pos);
  -        out_Color = vec4(shade(view_pos, view_normal, diffuseColor), 1.0f);
  -      }
  -      // apply projection matrix on z component of view-space position
  -      gl_FragDepth = (gl_ProjectionMatrix[2].z *view_pos.z + gl_ProjectionMatrix[3].z) / -view_pos.z * 0.5f + 0.5f;
  +      submitFragment(sample_pos);
         return;
       }
   
  
positive.code: out float gl_FragDepth;
  
  #include </shading.glsl>
  
  #define GRAD_NORMALS
  
  
negative.code: vec3 blendColors(const in vec3 sample_pos);
  vec3 blendNormals(const in vec3 sample_pos);
  vec3 blendCameras(const in vec3 sample_pos);
  // cube-ray intersection from http://prideout.net/blog/?p=64
  bool intersectBox(const vec3 origin, const vec3 dir, out float t0, out float t1);
  void submitFragment(const in vec3 sample_pos);
  
  void main() {
    // multiply with dimensions to scale direction by dimension relation
    vec3 sampleStep = normalize(pass_Position - CameraPos) * sampleDistance;
    // get ray beginning in volume cube
    float t0, t1 = 0.0f;
    bool is_t0 = intersectBox(CameraPos, sampleStep, t0, t1);
    float t_near = (is_t0 ? t0 : t1);
    // if camera is within cube, start from camera, else move inside a little
    t_near = (t_near < 0.0f ? 0.0f : t_near * 1.0000001f);
  
    vec3 sample_pos = CameraPos + sampleStep * t_near;
  
    bool inside = isInside(sample_pos);  
    // cache value of previous sample
    float prev_density = sample(sample_pos); 
  