Mail Archives: djgpp/1997/05/04/22:37:23
Tudor wrote:
>
> Sorry if this message is off topic here, but I don't know where else to
> ask.
> I'm kinda a newbie to 3d and programming in general. I'm in the process
> of developing a BSP tree constructer and drawer.
> But I don't know how to implement the clipping.
> Bsicaly it goes like this:
> I give the BSP constructer a list of faces. It will then make a BSP tree
> choosing the planes from the faces I gave him.To make it easier for me
> I chose to make it triangulate the resulted faces (initially the faces
> have an arbitrary number of vertices). It recurses for the resulting
> faces, creating a BSP tree. Now that I have the tree, what do I do??
> I thought of applying the camera matrix to the faces when I traverse the
> tree then reject what's not in my sight. Bu when and how do I clip the
> faces? Do I do the perspective projection and then clip in 2D or do I
> clip all the faces to the viewing frustrum (what's this anyways ?!)
> or the viewing cone(pyramid, whatever it is) then do the persp_project
> and draw?
> Any advice would be appreciated (anything to get me out of the woods).
What I think you do is traverse the BSP tree. At each node, test to see
if the camera is in front of or behind your line or polygon at that
node. Then traverse the _other_ side of the tree, clip your polygon to
the view cone, and then project it into view, and then screen space.
Sorry if that's a bit confusing.
Henry
- Raw text -