     const float sample = volume<t_bpc>(texCoord);
 
     // Post-classification transfer-function lookup.
-    float4 src;
-
-    if (t_mipMode == 0)
-    {
-      src = tex1D(tfTexture, sample);
-    }
-    else if ((t_mipMode == 1) && (sample > maxIntensity))
-    {
-      dst = tex1D(tfTexture, sample);
-      maxIntensity = sample;
-    }
-    else if ((t_mipMode == 2) && (sample  < minIntensity))
-    {
-      dst = tex1D(tfTexture, sample);
-      minIntensity = sample;
+    float4 src = tex1D(tfTexture, sample);
+
+    if (t_mipMode == 1)
+    {
+      dst.x = fmaxf(src.x, dst.x);
+      dst.y = fmaxf(src.y, dst.y);
+      dst.z = fmaxf(src.z, dst.z);
+      dst.w = 1;
+    }
+    else if (t_mipMode == 2)
+    {
+      dst.x = fminf(src.x, dst.x);
+      dst.y = fminf(src.y, dst.y);
+      dst.z = fminf(src.z, dst.z);
+      dst.w = 1;
     }
 
     // Local illumination.

  }
  const float3 step = ray.d * tstep;

  float maxIntensity = 0.0f;
  float minIntensity = FLT_MAX;

  // If just clipped, shade with the normal of the clipping surface.
  bool justClippedPlane = false;
  bool justClippedSphere = false;

         bool t_clipSphere,
         bool t_useSphereAsProbe
        >
renderKernel getKernelWithSphereAsProbe(vvRayRend* rayRend)
{
  switch (rayRend->_renderState._mipMode)
  {
  case 0:
    return getKernelWithMip<
                            t_bpc,
                            t_illumination,
                            t_opacityCorrection,
                            t_earlyRayTermination,
                            t_clipPlane,
                            t_clipSphere,
                            t_useSphereAsProbe,
                            0
                           >(rayRend);
  case 1:
    // No early ray termination possible with max intensity projection.
    return getKernelWithMip<
                            t_bpc,
                            t_illumination,
                            t_opacityCorrection,
                            false,
                            t_clipPlane,
                            t_clipSphere,
                            t_useSphereAsProbe,
                            1
                           >(rayRend);
  case 2:
    // No early ray termination possible with min intensity projection.
    return getKernelWithMip<
                            t_bpc,
                            t_illumination,
                            t_opacityCorrection,
                            false,
                            t_clipPlane,
                            t_clipSphere,
                            t_useSphereAsProbe,
                            2
                           >(rayRend);
  default:
    return getKernelWithMip<
                            t_bpc,
                            t_illumination,
                            t_opacityCorrection,
                            t_earlyRayTermination,
                            t_clipPlane,
                            t_clipSphere,
                            t_useSphereAsProbe,
                            0
                           >(rayRend);
  }
}

template<
