Archived

This topic is now archived and is closed to further replies.

mimec

Using large, static vertex buffers

Recommended Posts

I have a game that has a large terrain, but only small part of it is rendered at a time. This terrain is static, so I''d like to put it in a large static vertex buffer. Together with the index buffer it will take 10 MB or more. My idea is to split the terrain into a number of small areas that occupy continuous parts of these buffers and to render only visible areas. My question is: Will the graphics card manage such buffer effectively? It would be best if only the needed part of the vertex buffer was stored in the precious video memory. When we move to another part, another path of the buffer should be loaded into video memory. So, does DirectX do something like this automatically with large static vertex buffers?

Share this post


Link to post
Share on other sites
If you have enough video memory available and create the vertex buffer with D3DPOOL_DEFAULT it will put the whole vb either in video memory or into agp memory. It will not swap parts of the buffer into video memory. You could also get some problems if you want to use index buffers. All nvidia drivers up to date have some problems with SetIndices and a BaseVertex>65535. They promised to fix this in an upcoming release though.
A possible solution to the swapping problem would be to split your terrain into handy chunks and create a vertexbuffer for each chunk with the D3DPOOL_MANAGED. DirectX will then swap it out and into video memory if necessary.

Share this post


Link to post
Share on other sites
Thanks. That's a very good idea. I'll use managed buffers not bigger that 64k vertices. Besides, this way I won't have to recreate the buffer when the device is lost.

[edited by - mimec on July 28, 2002 5:32:39 PM]

Share this post


Link to post
Share on other sites