1
\$\begingroup\$

I have a local coordinate system with three camera normalised directions, D, U and R.

I also have the following information:

camera_location
lookat_point
up_direction
distance_near_plane
distance_back_plane
fov
aspect_ratio

With this I'm trying to get the information regarding the camera's frustum, the coordinates of it's 8 vertices and the 6 planes that make it up. How do I do it?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

One way would be to construct the projection matrix from your info, invert it, and send the 8 device-normalized coordinates of the corners through it. In OpenGL (and I assume Vulkan), those would be:

(-1, -1, -1),
(-1, -1, 1),
(-1, 1, -1),
(-1, 1, 1),
(1, -1, -1),
(1, -1, 1),
(1, 1, -1),
(1, 1, 1)

In DirectX or Metal, the Z values should be 0 and 1 rather than -1 and 1.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .