Archived

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

Dynamic Vertex Buffers

This topic is 5652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do proffesional games implement animating models? Do they use one dynamic VB per model instance, or do they have some sort of VB manager that lets them cram several models into one VB? I''ve got a VB manager at the moment, but i don''t know what to do for dynamic VBs. I could: 1. Allocate one IDirect3DVertexBuffer8 per object instance. This would allow me to lock the buffer using D3DLOCK_DISCARD at the end of the buffer, but would mean a lot of calls to SetStreamSource() - which is very costly 2. Cram as many objects into one IDirect3DVertexBuffer8 as possible. This would reduce the calls to SetStreamSource() per frame. I would allocate space for twice the number vertices required (or 3x, or 4x,...) and use it like a normal dynamic VB. When i reach the end of the data for that model, i could specify D3DLOCK_DISCARD, and copy all the data to where it should be (i have a system memory copy of all the data in the IDirect3DVertexBuffer8 so that the user can read from a write-only VB). Which do you think is better? 1. Seems a bit inefficient, but then 2. means a 64Kb memcpy() every second frame (3rd frame with 3x the allocated vertices, etc.) Cheers, Steve Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
*Bump*
I really have no idea about this. 1. looks nice and easy, but i want to be able to use the D3DLOCK_DISCARD flag, since a couple of weeks back, Simon (S1CA) said that when you request a dynamic VB, the GeForce driver allocates 8 VBs, and swaps between them when the D3DLOCK_DISCARD flag is specified.

Cheers, Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
I would probably go with the second option:
1) Less VB switches
2) you could just allocate the whole buffer
3) you could make the animation data smaller, and use Hermite-Curve interpolation to smooth things out on the fly

you could also look at D3D''s skinned meshes. I''m not sure how many people actually use these in the industry, and it might take a bit to get yer head round it, but they seem kinda cool. Just don''t look at the D3D sample for it!



Share this post


Link to post
Share on other sites
[Hey, i' forgot i had this username!]

Thanks for the reply.
Don't all the D3DX classes use one VB per object instance?
Anoyone know how things are organised in e.g. Unreal Tournament?
I'm starting to implement the 2nd option, but i don't really want to implement both and compare (because i'm lazy ). I'd prefer to be sure which method is better and implement that.
Is there any other ways that i'm missing?

Cheers, Steve

The one language understood by all programmers is profanity.

[edited by - Steve Macpherson on June 28, 2002 8:15:44 AM]

Share this post


Link to post
Share on other sites