PDA

View Full Version : Point in viewFrustum



Nyad
11-23-2007, 05:20 PM
I want to calculate if a 3d point is in the view frustum or not.
I have my Frustum width and height calculated.
My point has its values - px,py,pz
If I want to find the frustum width at that point's z value
would I do this:
pz * fw and pz * fh

But must I first transform this point by the camera matrix, modelview matrix, and projection matrix?

noncopyable
11-24-2007, 06:59 AM
If you use modelview and projection matrices (mvp) to extract world space frustum planes, and if your point already in world space, you are done, you don't need to transform point. There are plenty good VFC tutorials out there :)

Trenki
11-24-2007, 09:38 AM
For only testing if a point is in the view frustum it is easiest to just tranform the point with the modelviewprojection matrix and then test for -w <= x <= w, -w <= y <= w etc. to see if it is inside.

For other things you might want the extract the frustum planes from the matrix and work with those.

[ www.trenki.net (http://www.trenki.net) | vector_math (3d math library) (http://www.trenki.net/content/view/16/36/) | software renderer (http://www.trenki.net/content/view/18/38/) ]