Skip to main content
gamedev.net
🔒 Locked

Efficient Vertexbuffer Management

Started by Mattes337 Jun 28, 2007 at 9:16 AM 0 replies 500+ views
Original Post
Mattes337
Mattes337
Hey, for some time now I've been heading for a solution to my VertexBuffer Problem. Right now, I'm trying to program an engine, which is graphics-api independent, nevertheless I focus on DirectX for now. My problem is as follows: How to use Vertexbuffers efficiently when Rendering a dynamic View-Dependent scene? The first approach would be to create a RenderQueue, which enqueues all Vertices/Indices with priority to their texture (texture sorting for less state changes). Then, the renderQueue flushes all its content to one big vertex-/indexbuffer, which is dynamic, of course. Since dynamic Vertexbuffers are less efficient than static ones, the question is wether this approach can result in good performance. (The same problem I once had with my roam-based terrain algorithm, which in fact lead to framerates on my laptop of only 40-80) The second approach would be to create static Vertex/Indexbuffers for all objects in the scene. Those objects are then enqueued to the renderqueue, which then traverses for rendering. This approach is impractical because of e.g. instancing. What if I want to draw some thousands of grass billboards? I would then need to set the worldmatrix too often (since coordinates are not pretransformed as in approach one) to reach a performant result. The third approach I thought of was to create static Vertex/Indexbuffers for all sections in the scene. This would require a quad/octree or such, but I want my renderer to work independent from those algorithms, since they do not belong to it. Also, this approach would mean to generate my geometry once and leave it static, so the player cannot change anything. Does anyone know which of these (or others, of course) approaches are most practical and effient? Thanks in advance, Mattes337
Krohm
Krohm
Quote:
Original post by Mattes337
The second approach would be to create static Vertex/Indexbuffers for all objects in the scene. Those objects are then enqueued to the renderqueue, which then traverses for rendering. This approach is impractical because of e.g. instancing. What if I want to draw some thousands of grass billboards? I would then need to set the worldmatrix too often (since coordinates are not pretransformed as in approach one) to reach a performant result.

Besides the fact you can use HW instancing for this I believe you're trying to melt too much things in the same cauldron.

World geometry, is static. Even on AAA titles. Even on the few next-gen titles I've seen very little can change.

Particles, billboards and such are intrinsically dynamic. You don't want to design an algorithm which adapts to both. Rather, you should exploit the best of two different methods.
Quote:
Original post by Mattes337
The third approach I thought of was to create static Vertex/Indexbuffers for all sections in the scene. This would require a quad/octree or such, but I want my renderer to work independent from those algorithms, since they do not belong to it.
And the renderer will work independently of it! It doesn't even know where the data comes from, let alone how it was organized on the APP side. I think you're confusing your renderer with your scenegraph.
Quote:
Original post by Mattes337
Does anyone know which of these (or others, of course) approaches are most practical and effient?
I believe the static on current HW always wins. :)
Previously "Krohm"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.