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


Fast FX drawing with Vertexbuffers?

Recommended Posts

Freeman_CIT    122
Hi everybody. I am trying to speed up the rendering of FX (under DX8). here is the details: I am using a vertexbuffer for each kind of FX (i.e. a quad for glows and particules, another VB for a simple triangle, etc..). Those VB have only 1 to 6 faces large, and I use during the rendering the appropriate VB to render the desired FX. it means that I render the same VB many time, with different transformations, and that many VB have the same texture (for exemple, when I draw 100 identical lasers). but I still set each time the appropriate texture (even to set the same one...argh...). When I make the final count of calls to drawprimitive and Settexture, it makes me sick! So my questions are: Is there''s a faster method (I am sure there''s one, but wich one???) ? Is it less "expensive" to fill only a few vertexbuffers with all the fx(mesh) of a given type and/or texture? (yet does it mean performing transformations in the code, without video hardware acceleration?) But then, how to define vertexbuffers of the appropriate size at initialization step? (I feel that creating VB during update/rendering loop is a suicide for the framerate...) Well if you can only answer one of the questions above, I would be gratefull for my whole living time... Freeman_CIT PS: Please excuse my english, I am french...

Share this post

Link to post
Share on other sites
reillyhead    122

heres a few things to consider.

pack everything of the same FVF into the one vertex buffer. its also possible create a nonFVF buffer and put absolutely everything into that. (repost for example code)
This will help minimise buffer changes.

try to batch your render calls, for example draw all you laser stuff then change textures & renderstates then draw all your glows etc.

i would also suggest pre-transforming your vertices to avoid having to change the transform state for every call.
this will also allow you pass more than one face to drawprimitive (aim for at least 200, or so they say )

if the vertices are changing fairly often then you will want to look at using a dynamic vertex buffer, and fill the buffer with the required verts each frame.

this is a fairly rough reply, but it should give you lots to think about.

your english is better than my french, all i can say is
je ne suis pas un pomme.

not the most useful phrase to know, but believe it or not the french chicks that come over here seem to love it when someone says something in french that isn''t "vouz le vouz couche avec moi".

see i''ve got no idea how to even spell it.


Share this post

Link to post
Share on other sites
Freeman_CIT    122
Thank you very much.
I gonna explore those ideas, especially about batch calling processes and dynamic vertexbuffers.

The correct spelling is
"voulez-vous coucher avec moi."
I''m not sure it works each time
maybe you should try
"je vous trouve très jolie"
it''s less direct, and with an american accent, it could do the job on a french girl...


Share this post

Link to post
Share on other sites