How do i deal with vertices and indices scattered in many buffers?

Started by
6 comments, last by Krohm 10 years, 7 months ago

I thought I should make all index/vertex buffers of a fixed size,but just now,at the end i realize the big problem.

If I have a mesh that is in 2 vertex buffers,but it's indices in 3 index buffers,how do i deal with that?

Advertisement

The only way to use multiple index buffers is to use multiple draw calls, which is very inefficient.

Why do you want your buffers to all have the same size?

Because someone said nvidia recommends 2mb per buffer.I said what I'm gonna do? create buffers based on what?

And everybody said that you shouldn't create 1 buffer per mesh,so i created a simple algorithm that nests multiple meshes untill it fills the buffer(the same for indices).

Now i'm in big trouble cause i can't figure how to draw everything!

You can append some index data to the vertex structure such that all vertices that belong to the same mesh will know what world matrix to use, and what skeleton hierarchy to VTF etc. You gotta use triangle lists for this I think. This way you can draw the whole buffer (with many meshes) in one drawcall.

My suggestion would be that unless you're having performance problems, stick with one vertex buffer and one index buffer per model.

In most cases, you don't gain that much performance by packing the data from multiple models into one buffer, and it makes your code significantly more complicated.

Yeah I agree with Adam. Batching techniques become important when you start needing thousands of draw calls per frame. If you're not at that number, don't worry about it. I've never heard of anyone recommending certain sizes for vertex or index buffers, but if it's true I'd imagine that it also only comes into play with many many draw calls.

Actually i've seen that nvidia 2 meg thing. but as i recall it was about maximizing theoretical throughput for performance benchmarks.

I'm currently able to do about to 10,000 - 15,000 static meshes, one vb and ib per mesh, with fixed function pipeline (no shaders!).

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Maybe for dynamic buffers update. There has been a time (NV_VAR) in which everything had to go in a single memory blob. Personally I've never observed any performance difference WRT buffer size for static usage. Not that I benchmarked that in recent years, it just didn't matter.

Previously "Krohm"

This topic is closed to new replies.

Advertisement