Vertex buffer question... (more particle system theory)

Started by
2 comments, last by Moe 21 years, 9 months ago
What is worse, having several vertex buffers (up to 100!) or having one large vertex buffer and locking/unlocking it 100 times? I am planning on writing a decent particle system some time in the future, and I have come across this problem. Before, for each effect (group of particles) there would be a vertex buffer that would be locked/unlocked once a frame. Now in theory, there could be as many as 100 effects, or even more. I am becoming a bit worried about performance with so many vertex buffers. In my current project, my geometry is in groups, each with its own vertex buffer. I am drawing only several hundred polys, with about 6 unique textures (using just one texture stage, no multitexturing) and 2 lights (one directional, one point). The maximum framerate I am getting on a celeron 466 with a Geforce 2 MX is only about 60 to 70 fps (vsynch disabled, of course). So what would be better to do, lock and relock a large dynamic vertex buffer several times per frame, or use several vertex buffers? Moe''s site
Advertisement
Locking a VB several times per frame would be best IMO. Switching VBs is expensive, and you certainly don''t want to switch 100 times a frame if you can help it.
If you use a dynamic VB, and lock it appropriately, you shouldn''t have many problems.
What might be better is if you have a system memory copy of the vertices, update that 100 times a frame, and then Lock(0 fill, Unlock() the whole buffer at the end of the frame.


Steve
DirectX Programmer
Soon to be the new Bill Gates
Member of the Unban Mindwipe Society (UMWS)
Not that I''m a DX guru, but couldn''t you structure the code so that the vertex buffer is only locked once per frame? If the vertex buffer''s only being used for the particle system, then instead of having separate VBs for each effect, have the particle system lock one buffer, update all the effects, then unlock the VB.
The problem with only doing one lock/unlock per frame is that I could have several thousand particles, and I would possibly be throwing too many polys at the card at one time.

Moe''s site

This topic is closed to new replies.

Advertisement