Archived

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

Particles?

This topic is 5128 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

At the moment I just draw loads of GL_POINTS as "particles" The thing is, after only 5000 points or so the frame rate drops dramatically. Now I was wondering how games etc manage to do more of them faster. I had an idea, being loading a very long texture, 10 pixels high for example. Then I would have each 10*10 square represent a particle state that follows each other, such that I could go through the texture, using coords to make it "loop". Like
int particlesat = 0;
for( int j = 0; j < 100; ++j )
{
glTexCoord(0,particlesat);
i += 10;
}
 
And using alpha blending of course. Is that a decent way to do it? What other ways are there?

Share this post


Link to post
Share on other sites
There is an example of a particle engine on the Nehe site, It runs resonably fast, and its good code, apparently.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19

Share this post


Link to post
Share on other sites
He means rendering using GL_POINT. With glPointSize you can set the size of the point and with GL_ARB_point_parameters you can define dynamic distance attenuation. I've done it before and with a very high particle count (possibly impractically so) and keeping the camera far enough away, it doesn't look too bad.

EDIT: It might help us to help you if you posted some more information on how you store and render your particles and what video card and CPU you are using. . . With my particle generator on a Radeon 9700 Pro and Athlon XP 2100 I can render 220000 point particles and still get 20 frames per second. With textured quads I can manage 80000 particles at 20 fps. This is all with blending enabled, too.

[edited by - Ostsol on November 30, 2003 1:26:18 AM]

Share this post


Link to post
Share on other sites
Theres other stuff going on too, but 170 fps with 50000 particles (Radeon 9700pro, amd xp 2500+(at the speed of a 3200+)), but when I do 500 000 particles, which starts to look ok, it goes down to 39 fps. I''m using vbos if available, otherwise vertex arrays. I guess I''ll try using textured "particles" and see if it looks better

Share this post


Link to post
Share on other sites
Use textured quads for your particles. A nice, prerendered dot texture makes a great particle. There are a lot of advantages to using textured polygons instead of points for your particles, but probably the one most relevant to your question is that you can select a texture that has an image of multiple particles in it, so it looks like you''re drawing more particles than you actually are.

Share this post


Link to post
Share on other sites
If your hardware supports them...check out Point Sprites, these could potentially be faster than textured quads, I think there''s a tut on GameDev somewhere about them, have a look in the articles & resources perhaps.

GCoder

Share this post


Link to post
Share on other sites
Point Sprites might be good if you don''t need alot of control over them. If you need any kind of rotating or nonuniform scaling you can just forget about them.

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites