3D Clipping

Started by
0 comments, last by GameDev.net 24 years, 6 months ago
I am having difficulty implementing 3D clipping using view frustrum where the view angle is non-standard (i.e. not 90 degrees). I am going to do the clipping prior to rendering. The initial direction that I am taking is doing line-plane intersection to determine where each of the planes of the view frustrum interesects the lines created by the vertices of the n-poly, the problem I have is then what? Some of the planes will intersect the line determined by the vertices outside of the poly (since both the line and the plane extend infinitely) and for those it seems like it would be a waste to do the original interesction calculation, but I don't know how I can differentiate. Also, how do you determine which vertices to replace after you find an intersection between the plane and line? Depending on how the plane intersects the poly you could either after to replace the first vertice or the second vertice in the line that was used to determine the intersection.

I know this is potentially huge question, so any help would be greatly appreciated.

Advertisement
Oke, here goes:

First clip your polys against the near and far plane (just like with the viewfrustum planes). This should eliminate any problems with planes extended to infinity. I'm assuming you know how to calculate the intersection (if any) between a linepiece and a plane. I solved adding vertices by looping through the polys vertices and copying the vertices (including intersections) to a new clipped poly. You need the unclipped version anyway and adding vertices to an existing poly structure (array/linked list) is allways hell.

Mail me if you have any further questions:
krebbers@casema.net

Jeroen

This topic is closed to new replies.

Advertisement