How do i calculate the 3d Frustrum clipping pyramid?

hi
this is about the other post i did before this one…
well what i do wanna know is How do i calculate the 3d Frustrum clipping pyramid?

from the camera point to sumwhere i need to know the planes equations of each pyramid’s side right? how do i calc the pyramid ?
thanks

The “camera” point (although it is rendered
through model transforms) is on each of
those planes except the near and far planes.
(think about it).

Thus, with a camera at position P and with
direction D (the length of which is a unit
vector) and a FOV of (Fx,Fy) will have
plane equations with a point at the “camera”
and a normal that’s D, rotated as follows:
right plane: D+90+Fx/2
left plane: D-90-Fx/2
top plane: D+90+Fy/2
bottom plane: D-90-Fy/2
assuming you want the normals pointing out
of the frustum (just reverse the sign of the
90 degrees to get them pointing in).
+/- are the rotation operator on the normal
here, in degrees.

The near clipping plane has a point which is
the “camera” point, translated along D by the
near field limit, and the normal is simply -D.

The far clipping plane is similarly the
camera point translated along D, and the
normal is D itself.

well the camera point should be the pyramids top vertice i guess, right?

im doing this under opengl, i know opengl has some culling thingy, but i guess we still must have a frustum, or whatever its called… that pyramid that is your view volume

thanks for the help, still does it only work for 90 degree? or what does it really mean that 90?
what do you mean by FOV(fx, fy)?!?
isnt FOV one single value?
sorry for this questions, just trying to understand whats going on in all this “clipping” world eheheh
vic

try this http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/000412.html

vic, check out this excellent article: http://www.foxfiber.net/frenzy/3dclip.htm
I bet things will become clear after reading it…

ok thanks guys… ill go check it out!
vic

ok i’ve noticed he calculates some matrix there to use with his own camera or sumtin… ok didnt got much of it but ill see what i can get from that =) thanks frogger…

other thing…
anyone can tell me what glFrustum is supposed to do for opengl?
i see it requires 6 values for each of the six clipping planes right?
well but it is some float value… what does it really mean?
well im going confused here… what does we need, a plane and its equation or a single value or what? ah well
vic

glFrustum sets up the six plane equations that opengl uses to clip against for a perspective view which in that code that is posted on that link is retrieving from opengl…

you then test you object or a bounding box against those six plane equations and if you are in then send to gl if not don’t draw

*/(camera->clip_plane)[0][0]=(real)(clipmat[3]-clipmat[0]);
(camera->clip_plane)[0][1]=(real)(clipmat[7]-clipmat[4]);
(camera->clip_plane)[0][2]=(real)(clipmat[11]-clipmat[8]);
(camera->clip_plane)[0][3]=(real)(clipmat[15]-clipmat[12]);

each one of these is a plane equations…
namely [0][0] is the normal to the first clipping planes x component
[0][1]=normals to the first clipping planes y coordinate
and [0][2]=normal to the first clipping plane z coordinate

and [0][3]= distance from viewer…
(these are the params (A,B, C, D) or
Ax+By+Cz+D=0) to the plane equation…

these ARE the six eqs

btw you can ignore all the real junk it is just floats…
hth

[This message has been edited by frogger (edited 11-03-2000).]

[This message has been edited by frogger (edited 11-03-2000).]

When you find yourself asking:
“What does glXxxx() do?”

Please go to msdn.microsoft.com and type in
the call in the search field. Chances are,
the friendly people at Microsoft have already
written up a reasonable description of the
call. Yes, there may be some windows-isms in
the description, but mostly it’s quite useful
documentation (and instantly available).

You may also wish to bookmark the linked-to
references for OpenGL 1.1 and 1.2 found on
this very site, and refer to them for
documentation. However, I’ve found the MSDN
documentation to often be better written,
and thus prefer that (even when not writing
for Windows!)