       //VTK::AverageIPScalarRangeMax,
       1.0);
 
-    vec4 value;
+    vec4 sum = vec4(0.);
 
     // Declare i outside of the loop
     int i = 0;

      }

      // Sum the values across each step in the path
      value += tValue;

      if (i >= count) { break; }
      posIS += stepIS;
    }


    // Find maximum/minimum intensity along the ray.
    vec4 value = getTextureValue(posIS);

    // Define the operation we will use (min or max)
    #if vtkBlendMode == 1
    #define OP max
    #else
    #define OP min
    #endif

    // Sample along the ray until MaximumSamplesValue,
    // ending slightly inside the total distance
    for (int i = 0; i < //VTK::MaximumSamplesValue ; ++i)
    {
      // compute the scalar
      tValue = getTextureValue(posIS);

      // Update the maximum value if necessary
      value = OP(tValue, value);

      // If we have reached the last step, break
      if (i >= count) { break; }

      // Otherwise, continue along the ray
      posIS += stepIS;
    }

    // Perform the last step along the ray using the
    // residual distance
    posIS += (residual - 1.0) * stepIS;

    // Obtain the value at this position (scalar or vector, depending on the number of components)
    tValue = getTextureValue(posIS);

    // Update the minimum/maximum value if necessary
    value = OP(tValue, value);

    // Now map through opacity and color
    gl_FragData[0] = getColorForValue(value, posIS, tstep);
  #endif
  #if vtkBlendMode == 3 //AVERAGE_INTENSITY_BLEND
    vec4 averageIPScalarRangeMin = vec4 (
