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: vec3 blendColors(const in vec3 sample_pos);
  vec3 blendNormals(const in vec3 sample_pos);
  vec3 blendCameras(const in vec3 sample_pos);
  
  void main() {
    // multiply with dimensions to scale direction by dimension relation
    vec3 sampleStep = normalize(pass_Position - CameraPos) * sampleDistance;
  
    vec3 sample_pos = pass_Position;
    bool inside = isInside(sample_pos);  
    // cache value of previous sample
    float prev_density = sample(sample_pos); 
  
negative.code:   total_color /= total_weight;
    if(total_weight <= 0.0f) total_color = vec3(1.0f);
    return total_color;
  }
  
  bool intersectBox(const vec3 origin, const vec3 dir, out float t0, out float t1) {
      vec3 invR = 1.0f / dir;
      vec3 tbot = invR * (vec3(0.0f) - origin);
      vec3 ttop = invR * (vec3(1.0f) - origin);
      vec3 tmin = min(ttop, tbot);
      vec3 tmax = max(ttop, tbot);
      vec2 t = max(tmin.xx, tmin.yz);
      t0 = max(t.x, t.y);
      t = min(tmax.xx, tmax.yz);
      t1 = min(t.x, t.y);
      return t0 <= t1;
  }
  