 #endif
 
   // Ensure that dist is big enough
-  const bool infinite = (tnear+dist != tnear && tfar+dist != tfar);
+  const bool infinite = (tbnear+dist != tbnear && tbfar+dist != tbfar);
 
   while(infinite)
   {

  const float4 o = mulPost(c_invViewMatrix, make_float4(u, v, -1.0f, 1.0f));
  const float4 d = mulPost(c_invViewMatrix, make_float4(u, v, 1.0f, 1.0f));

  Ray ray;
  ray.o = perspectiveDivide(o);
  ray.d = perspectiveDivide(d);
  ray.d = ray.d - ray.o;
  ray.d = normalize(ray.d);

  float tnear = 0.0f;
  float tfar = 0.0f;
  const bool hit = intersectBox(ray, probePos - probeSizeHalf, probePos + probeSizeHalf, &tnear, &tfar);
  if (!hit)
  {
    d_output[y * texwidth + x] = make_uchar4(0);

        justClippedSphere = clippedSphere;

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