BlueCrab wrote:I think he is solely speaking about the X/Y plane. Later in the same article, he says that Direct3D has to do the near plane clipping:
While the Dreamcast hardware does the viewport clipping, Direct3D does the near plane clipping if the DONOTCLIP flag is not set. The DONOTCLIP flag tells Direct3D not to do clipping calculations. It is best to turn the DONOTCLIP flag on whenever possible. Test each object to see if it touches the near plane. If it does, then you know that all of its triangles won't have the DONOTCLIP flag set.
Right you are! I should have continued reading through the whole article lol.
bogglez wrote:
Now that sounds completely opposite of what I quoted before..
microsoft wrote:
Send as many vertices as possible in a single DrawPrimitive call. This is the most important optimization you can do. Do everything you can to keep from breaking up primitives.
PH3NOM wrote:If that is true that there is no need for clipping tests, why do we seem to need to clip vertices to the Near-Z Plane? Are we doing something wrong with the PVR in KOS?
I got that like BlueCrab.
We don't do the optimization they mention right now at all..
1. Check in rendering engine whether bounding volume is completely in front of the near clip plane
2. If it is, set a flag, call glDraw*
3. In OpenGL, if the flag is set, don't do clipping at all.
Right now we lack such a flag to communicate this. Completely dodging the clipping algorithm would be a huge optimization I think.
Well, the single DrawPrimitive call is sort of how my GL API interacts with the PVR.
It only requires one transfer per list of vertex data to the PVR, and that includes PVR polygon headers in-line with the vertex data.
About the polygon clipping, that part is up to your 3D engine, as mentioned in the article.
And that is how I have arranged things in the Quake 3 BSP renderer I have been working on and off on.
Quake 3 level geometry is based on Faces. A face can contain several triangles.
I use the Bounding Boxes of each Face to determine if the Face is behind the Near-Z plane ( remember my 8 dot-product function you commented on? )
My engine walks the faces, marking with one of 3 flags:
1.) Completely Behind Camera, Cull the Face ( do not send to GL for rendering )
2.) Partially Behind Camera, Clip the Face ( send to GL for rendering with Z-Clipping Enabled )
3.) Completely in Front of Camera ( send to GL for rendering with Z-Clipping Disabled )