# Vertex/Index buffer optimization

This topic is 3790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I have been reading up on different ways that you can reduce the detail of terrain to optimize performance, but I was wondering if there is a good technique for culling all indices that are outside the camera's possible view. To be clear, I am hoping for a method to send all of the indices x units in each direction to be drawn, instead of sending the entire landscape to be drawn. I have discovered that trying to send a single index buffer for a heightmap larger than 128x128 gives me errors with my video card, so I'd like to use this method of culling far-away indices to correct it. Basically: Given the camera's x/y/z coordinates, find all indices x indices in each direction, send this subset of indices to be drawn. Is this possible?

##### Share on other sites
quadtree, geomipmapping(possibly), frustum culling. search gamedev or google for this stuff, im sure youll find everything you need.

uh i thought limit for meshes for indices is 65536, not 128x128. anyone?

##### Share on other sites
You can use the offset parameters to DrawIndexedPrimitive() to index more than 216 vertices in a 16bit index buffer [wink]

Clever tricks this way can allow you to re-use large index buffers for optimal quadtree terrain rendering - I found that more than 32x32 patches wasn't really necessary most of the time.

You can write out a generic IB with 5 (for example) levels of LOD for various resolutions of patch, almost like an array of mip-maps. Using a quadtree and clever index/vertex offsets you can write a very efficient terrain renderer.

hth
Jack

##### Share on other sites
Quote:
 Original post by MassacrerALuh i thought limit for meshes for indices is 65536, not 128x128. anyone?
It depends on how you implement it, but yes you are correct about the 65k indices.

A pure 128x128 points giving you 127x127 'tiles' gives you 214 and 256x256 (for 255x255 tiles) is 216, but some people will want 128 tiles or 256 tiles, meaning its actually a grid of 129x129 or 257x257 - which can push you very slightly over the limit...

hth
Jack

• 18
• 11
• 19
• 9
• 52
• ### Forum Statistics

• Total Topics
631397
• Total Posts
2999810
×