VBGamer |
|
RE: Frustrum Culling A Morano (0 replies, 0 views) (2000-Sep-8) Actually, I hate to correct you, but you are wrong.
Culling, in this case, backface or frustrum, works on Half-Spaces. When you cull from a half space, you usually check the direction of the normal and the plane of the face against the normal and plane of the offending face (i.e. the objects face).
I can say I have done frustrum culling in C++ and have a quick routine for it which would easily port over to VB, just never needed it in VB.
If you are interested, drop me a mail... mailto:amorano@bworks.com
If not, the algorithm is fairly straight forward. All you need are the positive and negative front and side planes of your frustrum. In order to get those, you take half the view space (FOV * 0.5) and multiply that by each corner of the back frustrum plane ( far plane = some number). The front planes will usually be too small ( 0.1 ~ 0.00001) to discriminate a value from.
Once you have the four points, you'll only need three to form the left, right, top and bottom planes of the frustrum. Then it is a simple matter to check against each plane those objects which might be offensive to the screen :) Point in Poly test, or even a point on plane (you can easily check if the objects corners are above or below the plane with a normal test)
HTH
|