Advertisement

Clipping Planes

Started by September 22, 2001 12:51 PM
0 comments, last by devMerlin 23 years, 4 months ago
Hi, Could anyone Help me? I want to Calculate Polygons for the front and Far Clipping Planes in Direct 3D. I use the DX - Helper Function to create my Projection Matrix. for Example, i use a FoV of 45 degrees and a near plane of 1. then i create a Vector (0, 0, -1) and rotate it (45/2) degrees in Y and Z - Axis. Because the resulting length of the Vector == 1 and the near plane == 1 i thought it would be correct. But if i create all other 3 Points for the Surface, i got one, that was too small. Does anyone know, how i can calculate them right? I have heard, that i have to include a "User distance" to my calculations, but i couldnt find a value for it.
One quick and dirty way to find a good distance from the front clipping plane to the back clipping plane is to look at the radius of the bounding sphere of all your geometry. If you have a sphere with that radius, then all your geometry lies within it. If you then make a view frustum that can contain the entire bounding sphere, then that view frustum can also include all of your geometry. So just make sure the back clipping plane is twice the radius of the bounding sphere away from the front clipping plane.

This isn''t a completely problem-free solution. It is only guaranteed to work for any orientation of your geometry if:

1) your geometry is located such that the "centroid" point is exactly halfway between the front and back clipping planes (e.g., the geometry is centered within the center of the bounding sphere that you used to place the clipping planes).

2) your viewport clip planes (top, bottom, right, left) are also far enough apart to contain the bounding sphere.

If you want your object to be able to move around the screen without being clipped, you need to make the viewport clip planes further apart and your front/back clip planes further apart.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement