     dst = make_float4(0.0f);
   }
 
-  float t = tnear;
-  float3 pos = ray.o + ray.d * tnear;
+  float t = tbnear;
+  float3 pos = ray.o + ray.d * tbnear;
   const float3 step = ray.d * dist;
 
   // If just clipped, shade with the normal of the clipping surface.

    return;
  }

  if (fmodf(tnear, dist) != 0.0f)
  {
    int tmp = (tnear / dist);
    tnear = dist * tmp;
  }

  if (tnear < 0.0f)
  {
    tnear = 0.0f;
  }

  // Calc hits with clip sphere.

    }

    t += dist;
    if (t > tbfar)
    {
      break;
    }
