PDA

View Full Version : A Simple Speed Trick for a Particle Engine...



MrShoe
06-23-2001, 03:13 PM
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.

j
06-23-2001, 05:40 PM
It would help if you are geometry limited but not fill rate limited.

j

MrShoe
06-23-2001, 08:27 PM
Well, I just tried it out and for just a scene with a particle engine it is around twice as fast...

Nutty
06-24-2001, 04:24 AM
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.. http://www.opengl.org/discussion_boards/ubb/smile.gif

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

Eber Kain
06-24-2001, 06:35 AM
when i wrote my partcle system i used a different triangle for each particle, should i change it?

DFrey
06-24-2001, 07:21 AM
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.

MrShoe
06-24-2001, 09:22 PM
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.

zed
06-24-2001, 10:35 PM
with tris fillrate is always gonna be higher no matter if the particles are near or far, unless of course your particles are triangles

zed
06-24-2001, 10:37 PM
>>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.

AndersO
06-25-2001, 03:11 AM
I belive Q3 used triangles for atleast some of their particles.