Archived

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

mariusf

Stuffing VertexBuffers

Recommended Posts

Hello everyone! Just a simple question to experienced ones: I got about 500+ TerrainChunks (geomipmap) per frame, that contain together about 6000+ Triangles. Since on the lowest detail, there are only 2 triangels per chunk, would it be more efficent to collect all triangles and stuff them into only a few vertexbuffers? (about 5). For the Indexbuffers the same, I would need to copy their content together in a few really big ones.. I think it should be faster, or would the copying take two much time? The final vertex and indexbuffers would be precreated, of course. Any experience? Thank you, Marius

Share this post


Link to post
Share on other sites
Hmm, I''m not sure what you mean by ''precreated'', I assume you mean that your copying the data into a few large buffers is a ''done once at startup'' operation, right?

Either way, what you are saying is good form. Good form being (and it can''t be told often enough) "Batch all the polygons you can into a single drawprimitive call. Ideally, all those sharing the same texture and renderstates."

So, if you have less buffers, you can more easily have less drawprimitive calls, which makes everything faster. Heck, you could put everything into -one- huge buffer while you''re at it. (The vertexes all have the same FVF format, right?)

De-dum, another tip: Try using indexed trianglelists, and making your big drawprimitives draw the terrain in a sort of ''wiggly'' pattern to re-use vertex indexes as soon and as much as possible - this helps modern cards with the use of their internal vertex cache. (About 10-20 vertexes in a small ultrafast memory, kept in LRU mode)

And yet, I hold no merit, I haven''t made a terrain engine. *sigh*

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Share this post


Link to post
Share on other sites