Skip to main content
gamedev.net
🔒 Locked

Vertex Buffer Manager?

Started by ProgramMax 3 replies 600+ views
Original Post
ProgramMax
ProgramMax
Vertex buffers are good and all, but have me scratching my head on a few things. Say I was making a MMORPG type game. I might need to load a character''s 3d model at some random time and then be able to unload another one at some other random time. It would be nice to put that in a seperate thread, as to not be a performance hit. Vertex buffers don''t seem to want to work with me on this though. I remember reading that Locking a VB takes a significant amount of time. I also remember that switching materials and textures takes a significant amount of time. Am I allowed to leave a VB fragmented? Is there a way to set a vertex to be ignored (and thus allow me to defrag the VB while playing)? I don''t want to get to the point where my game is switching textures and materials back and forth just because I tried to make a dynamic VB. What have you guys been doing to solve this problem? Thanks for your time!
LordShade
LordShade
I read an interesting tidbit by Carmack on multi-threading the other day. What it sounded like to me is that he has a dynamic vertex buffer in which he writes the polygons to draw, then renders them.

I''m doing the same thing in an editor atm but haven''t tried using multiple textures on my faces. I only use one so I just fill this dynamic vbuffer and draw the faces out. When using multiple textures I would assume you would have several vbuffers. Instead of having a vbuffer for each texture, I would assume you would have to reuse them else you''d be wasting alot of memory. I''m not absolutely positive on this so don''t quote me.

In my little editor I have 2 vbuffers atm. One I use for drawing polys, the other I use for drawing lines. Note: I''m not doing oclussion culling or anything and still get a great frame rate showing 5000 polys plus their normals.

As far as fragmenting a vbuffer, you can''t if you plan on using DrawPrimitive. You can do it when using DrawIndexedPrimitive.

I haven''t done performance tests on the differences between Indexed or not but I''m sure there is some. How significant it is, I haven''t a clue.
thedo
thedo
You should notice that Indexed CAN be faster.

a: It uses vertex cache on card so vertices that are reused (ie strips) are held on cache and not recomputed. This can be very beneficial.

b: However do not throw the entire index at the hardware even to render a subset of it or you''ll process every incexed vertex and probably lose performance.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
ProgramMax
ProgramMax
Don''t suppose you have a link to the words of the great Carmack, do ya?

As far as having a seperate thread to load up the VB, it sounds risky. But without risks, we wouldn''t get very far.

Also, I will read into IBs a bit more and try to find the optimal solution.

A quick question comes back up to me. I could see myself using triangle strips for a model or the such, but when loading multiple models into one VB, I don''t see it possible to use handy shortcuts like that. Just wondered if there were any tricks that people knew to get back to tri strips or if I just have to suck it up and move on.

Thanks so much for your help you guys!
ProgramMax
ProgramMax
Bump and an added question....what about animations? I am a big fan of skeletons because that allows me to adjust the animation slightly to match the scenery. An example would be the artist making a stair animation. I could apply the same animation to a hill that the character walks up and just change the angle that the feet hit the landscape.

Again, thanks for your help.

Topic Locked

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

Sign in to reply to this topic.