[DX10] Applying transformation to only some vertices in a super vertex buffer

Started by
6 comments, last by n3Xus 15 years, 4 months ago
I hope I used the correct terms.. Anyway, I read some people suggest to join more vertex and index buffers into one big vertex and index buffer to prevent too many draw calls and buffer changing. How would I then apply, for example, the rotation transformation to only some vertices in that big vertex buffer?
Advertisement
Your request it's too many generic.
How have you organized your large vertex buffer? Are you using a subsets system? How about a your subset structure?

If you need to rotate only subset 1, you can simply write a for statement and make your updates...
Well right now I haven't even organized anything.
I'm not sure what exactly you mean by a subset system-you mean the one in the dx mesh? I don't use it, I use my own model format.

I also don't know how exactly to organize it. I was thinking that I would 1st create all buffers from many objects and then join them into one big one.
Yes you can pack several objects to a single vertex buffer.
You can then use the buffer offset to draw only subsets of it, whereby you always set the transformation matrix you want, usually you will need some other unique material parameters too. You still save switching the buffer then. However, afaik state changes are not that expensive with DirectX 10.

Another way would be to add a matrix index or something like that to the vertices. The you can select the correct matrix from an array.
The best way is to organize large vertex buffers by state changes.
Thanks Lui, that would be one way of doing it.

XVincentX, what exactly do you mean by organizing large vertex buffers by state changes?
I think he means that it would be better to first group everything by shared states and put it ordered by that in the vertex buffer somehow.
So if you are packing stuff, because you want to get better performance, that should be the best way.

From my experience it is mostly sufficient to just sort by material/shader, that would be the most expensive to switch.

If you tell us more about your application, we could give you more specific advice.
Ah, yes, now I understand. I think I'm gonna try the indexed matrices method and sort them by shaders.

Thanks for your help.

This topic is closed to new replies.

Advertisement