A Simple Speed Trick for a Particle Engine...

It just came to me that NeHe’s particle engine uses 2 triangles for every particle. Why? Why not use just a single triangle for every particle? You would need to modify the texture a bit, but thats trivial. Wouldnt this give you roughly double the performance since you need to render only half the triangle for the same number of particles.

It would help if you are geometry limited but not fill rate limited.

j

Well, I just tried it out and for just a scene with a particle engine it is around twice as fast…

I was just thinking about this the other night. After it seems my VIA chipset is doomed to have terrible sys mem -> AGP mem writes.

Not only would it speed stuff up, but will reduce the number of vertices, and indices (if draw in indexed mode) by 1 quarter. Saving memory is good…

Actually come to think of it, my current billboard demo draws using the GL_QUADS primitive. And I’m using indexed vertices. Considering ever vertex is unique, would it be faster to use glDrawArrays instead of glDrawElements, and not use any indices?

Nutty

when i wrote my partcle system i used a different triangle for each particle, should i change it?

Just want to point out that this is not always a good idea. Notice what j said. This is good if you are geometry limited but not fillrate limited. In fact a close examination of the technique reveals that it requires at best twice the fillrate (I worked it out with Maple). And if you don’t use an appropriate triangle the fillrate demands can literally explode.

I dont see how using triangles instead of Quads can possibly slow a program down…
Also, the fillrate comes into play if the particle system is close to the screen and thereby takes up alot of pixels. If it is in the distance the fillrate requirements are lower.

with tris fillrate is always gonna be higher no matter if the particles are near or far, unless of course your particles are triangles

>>Considering ever vertex is unique, would it be faster to use glDrawArrays instead of glDrawElements, and not use any indices?<<

definitly if you can do drawarrays instead of elements use it it is defintly faster.

I belive Q3 used triangles for atleast some of their particles.