Optimizing rendering of particle systems

Originally posted by Jan:
That´s great!
I was always wondering how i could do billboarding in a vp. That normal-as-position is really a nice trick.

the normal part is the one i dont like, because normals come with w=0 (thats why i need to set it to 1 in the program). i guess changing to general vertex attributes would be easier and especially less confusing with the names.

btw. trying to do that with an array didnt really end up faster and took a lot more memory, because suddenly everything needs to be stored 4x per particle (ie per vertex).

if you have a newer radeon or fx (needs fragment programs) you can see them here:
http://festini.device-zero.de/Programming/Downloads/jstart.zip

“physics” for the particles are kept extremely simple. for a bit more than lame 5000 particles:

either edit autoexec.csf and replace the 5000 (up to 200k should be safe)

or in the console type
partsetamount 1 <new number>
partresetsystem 1 1

and if the console trying to be clever is annoying you type autotype ,-)

You don’t need a matrix change per particle. You can subtract camera position from particle center get get the “particle normal” and extract right and up using cross products and normalizing. Doing this per pixel is more expensive than doing it per particle system, but it’s still cheaper to do this, and generate all particles into a vertex buffer that you draw once, than changing the matrix once per particle.

You don’t need a matrix change per particle. You can subtract camera position from particle center get get the “particle normal” and extract right and up using cross products and normalizing. Doing this per pixel is more expensive than doing it per particle system, but it’s still cheaper to do this, and generate all particles into a vertex buffer that you draw once, than changing the matrix once per particle.
Yes if you use shaders, but i think it would be even faster if you use point sprites.