Cliff Biffle  committed 886054c

Fixed a bug in my raycasting. I was assuming a fixed angle change between adjacent rays, which is of course false -- rays toward the edge of the image will be nearer to the previous ray's angle. The net effect: the edges of the XY plane were being computed incorrectly. Usefully, doing things the right way eliminates some transcendentals and may be more efficient if I refactor things a bit.

  • Participants
  • Parent commits eb776d2
  • Branches shaders

Comments (0)

Files changed (1)

File kinect_project.vs

   // Linearization equation derived by the ROS folks at CCNY.
   float linearZ = -325.616 / (point.z + -1084.61);
-  // Compute the psi/theta angles of the ray through this pixel.
-  vec2 angles = point.xy * halfFov;
-  // Find the intersection of that ray with the plane at linearZ.
-  vec2 intersection = linearZ * sin(angles);
+  vec2 unprojected = linearZ * tan(halfFov) * point.xy;
-  return vec3(intersection, linearZ);
+  return vec3(unprojected, linearZ);