Coordinate transforms (optic flow)

Hi, a quick question…

The overall idea is, I have a scene with a moving camera and non-moving objects, and I’m trying to read out basic “optic flow” information. What that means is, for each pixel in the rendered frame at time T0, I want to figure out where the object that pixel is “looking at” ends up, in “rendered frame” coordinates, at time T1. This boils down to two questions:

  1. For a given rendered frame, how do I determine the 3D coordinates of the point the pixel is looking at? I assume I have to do something like render the depth buffer to a texture, and save that to disk or something…then, if I know the camera transform, I can reconstruct the 3D location. (Haven’t actually tried it, yet…)

  2. For a given 3D world coordinate, how do I figure out where in the rendered frame that coordinate would project? I played around with base.camLens.getProjectionMat(), but I couldn’t figure out how to properly apply that to a 3D world coordinate…

If you have any hints, I’d be very grateful! Thanks!

Update: For point #2, I just found the base.camLens.project() function, which I somehow missed before! Looks like it works!