Hello TD community!
I’m trying to build something to visualize a cameraCOMP’s view frustum by finding its 8 corner points in world space (each represented by a NullCOMP in the attached .toe file).
My understanding is that the process is to invert transformation between world->view->clip->NDC spaces. Namely, I’m taking the NDCs of the 8 frustum corner points with “w” set to 1:
[(-1, -1, 0, 1), (1, -1, 0, 1), (-1, 1, 0, 1), (1, 1, 0, 1),
(-1, -1, 1, 1), (1, -1, 1, 1), (-1, 1, 1, 1), (1, 1, 1, 1)]
First, multiply the near and far values of the camera with the 4 corresponding points to invert the perspective division. In my case, near is 1.0, and far is 10.0, so the first 4 points are * 1.0 and the last 4 are * 10.0.
Then multiply them by the inverse view-projection matrix of the camera. My understanding is that the result then should be the coordinates of the corner points in world space… But currently, that’s not the case. What I’m getting seems to be somewhere in between view space and world space? What am I missing?
Attached is the .toe file.
I should mention that the end goal is to be able to construct a custom projection matrix by providing the frustum entents (left, right, top, bottom, near. far), which is then applied to a camera COMP, so that the near plane of the frustum can be something like the “near face” of an arbitrary screen geometry’s bounding box. Something that acts similar to the “Quad Reproject” function of a cameraCOMP, only that instead of having a quad as the screen, the screen can be an arbitrary shape.
CameraFrustumVisualizer_Demo.toe (5.9 KB)