Tuesday, June 30, 2009

Indices Edges and Culling, Oh My!

Well its been a little while but I finally got some time to make a little more progress. One of the big issues that was coming up for me has been the edge details between LOD levels. While normally this is not that difficult an issue, when it comes to getting the most out of hardware instancing for the terrain we want to keep things as simple as possible.

The skirt method of covering LOD issues was looked at, but this to me seems very hacky. As well adding in many different indices to provide all the options for different edge combinations reduces the use of instancing because of the greatly increased draw calls and tendancy not to instance nearly as much.

So while I was pondering this I came across an article on the ROAM algorithm, while the algorithm its self really provides nothing useful when it comes to an instanced terrain, it does give us an interesting triangle layout that will greatly reduce the number of indices needed to have compatible edges. Typically with this triangle layout you only need a special grid every other level of detail, since 2/3 LOD edges will match by default. As well if you build your LOD structure to use square rings, you only need to place these blending grids against the connecting LOD and don't have to match the corner by simply increasing the LOD just a long the edge of the blending grid.

So with this in mind I re-built all my indexes to see how it would fare, and the results have been pleasant. Currently I am doing brute force LOD testing based on the range from the camera, this will become much more elegant and controled when I implement a culling method like Quadtree. The real trick will be that each grid needs to know if it is next to a higher LOD grid, and if so it will be added to the instance list for the correct LOD blending grids and rotated to match the edges up.

Here are a couple screen shots of the terrain as it stands now, this is 7 levels of LOD, and I suspect I will add another 2 to deal with the really distant stuff. as it is still fairly high detailed. You will notice I am still getting around 900 FPS with the brute force LOD and no culling on my 8800 GTX at 1024x768 resolution. This is with per pixel lighting and per pixel normal mapping based on a global normal map generated as needed at run time on the GPU. And to do all this I am only making 7 draw calls and letting the GPU do the rest with instancing.




Needless to say I am hoping to really get some screaming performance out of this system once everything is optimized and I implement quadtrees and fustrum culling.

No comments:

Post a Comment