Friday, April 27, 2007

Patch Culling

Brute Force Terrain. 32258 Polygons Rendered

As a further addition to the Geomipmapped terrain I have added Patch Culling.

In my original implementation of Geomipmapping the distance from the camera to the terrain patch was calculated and from this the level of detail deciphered. If you remember your maths from school you will know that getting the distance between two points always returns a number which is greater than or equal to zero. Because of this no spatial relation between the objects is known so we still rendered patches which were out of view of the camera, although at its correct Level of Detail.

Geomipmapping with no Patch Culling. 5757 Polygons Rendered

With Patch Culling we simply check if the current patch is inside the Fustrum of the Camera. A fustrum is like a pyramid on its side, the pointy part at the lens of the camera extending out into the world. By doing some simple plane tests we can quickly and easily see if a point is inside this pyramid and therefore immediately ignore it if it is not. This does not only help us ignore faces to render, but we can also ignore patches to update so is useful for the GPU and the CPU.

Geomipmapping with Patch Culling. 2192 Polygons Rendered

The final addition to my Geomipmapped Terrain (for now) is to add support for Vertex Arrays and VBO's. I hope that this will increase the fps but it will also keep the render code separate from the terrain code therefore keep me on track for an engine which should be easier to update to DX.

No comments:

Post a Comment