Archived

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

russian-bear

sending pointsprite data to vertexbuffer

Recommended Posts

Hi! I have a litle question. When you send the pointsprite data to a vertex buffer some ppl recomend to do it in chunks, like 10% of the total number of particles and some ppl say that you should fill the vertexbuffer with everything you got... What is the diference betwine those two? In my own tests, filling the whole vertexbuffer is much faster than do it in chunks. But i would like to know how they do it in real games..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
My guess is that it might have to do with the fact that if N is large enough, doing it in chunks lets the graphics card draw while you''re filling in the next chunk. But then the snag comes in when there aren''t that many vertices and you''re locking and unlocking the VB, which is overhead.

Another thing might be that it just saves memory if you do it in chunks.

Whatever the original reason might be, it''s just become a rule-of-thumb. But if the way you''re doing is working faster for your game (on yours and other test machines) then by all means keep it.


TLC

Share this post


Link to post
Share on other sites
I would have said that using a dynamic buffer and filling it a chunk at a time is faster because if you have a buffer 65536 large, clearing it every frame would be slow...
The D3D pointsprites demo fills up with about 512 points ( I think, off the top of my head) then renders what it has so far. It then continues until all the particles waiting to be rendered are actually rendered. If the buffer is full, it renders what it has added, clears the buffer, then continues.
To get this to work, tho, you have to set the buffer flags up correctly or it will be very slow. Knowing how to set up, fill and render it efficiently is the key to speed here.

Share this post


Link to post
Share on other sites
You people are thinking of Parallelism in the wrong way. Throw it all at the graphics card and it should be able to handle it (assuming that you dont go over 65536 vertices in one go. According to a recent doc by NVidia, we should actually start drawing the last loops contents at the start of the current loop. Then during the current loop you perform all your physics and whatnot in order to prepare for rendering at the start of the next loop.

Moe''s site

Share this post


Link to post
Share on other sites