PDA

View Full Version : when to clip



djbuzzkill
04-10-2002, 03:15 PM
Hello all, I am unclear as to when you clip polygons to the view volume. Is it done before the perspective transform or after? If you do it before, it seems that you would have to clip to non axis aligned planes, but if you do it after wouldnt you have to transform all the of the pvs? Thanks.

Rob The Bloke
04-10-2002, 05:58 PM
Clipping these days is generally done in hardware after the perspective transformation. Essentually is just ensures that any section of a polygon being drawn that is outside the screen is not drawn.

It is essentually pointless clipping triangles to the view frustrum when hardware can do it faster in 2D. This is then where the concept of culling comes in.

Relying entirely on clipping is generally a bad idea, the entire scene data is passed across the AGP bus and sent to the graphics hardware for perspective transformations, clipping and rasterisation. This high data throughput generally causes a bottle neck in the system.

This is where frustrum culling comes in (and PVS stuff). Removing polygons as soon as possible by testing them against the viewing volume to ignore those that are ENTIRELY outside will ultimately help to elivate this problem. The faster that you can determine that polygons aren't visible, the quicker you application runs.

One major trick (and essentually what octrees do) is to test large numbers of polygons in your scene with a bounding box to remove them all in one go. If you find that the bounding box intersects the frustrum, then you subdivide the bounding box into 8 smaller ones and then test those and so on and so forth.

to sum up, Gross culling of polygons is done by yourself before perspective transforms to remove geometry as fast as possible, but leave the polys that enter into the frustrum; clipping is then done afterwards by hardware to remove the sections of those intersecting polys that are outside the viewing frustrum.

I should write less....