Too Transformation Heavy?

In my game I am using the classic rocket-trail effect as seen in Half-Life or any number of games; basically a rocket has behind it a set of vertices and they are connected by (effectively) billboarded quads with a smokey texture to give the impression of a contrail behind the rocket.

However, in rendering this effect I use the procedure:

render the rocket
for each vertex in the contrail
push tranformation matrix
translate to that vertex
calculate and create the matrix for the billboard effect here (i.e. for a quad that goes from this vertex to the next)
multiply that matrix
draw the quad
pop the matrix

That too me seems to be a bit intensive for one rocket render, with (depending on contrail length and the amount of time between “vertices” being dropped along the path) probably ~10 vertices per rocket. I could just do the billboard transformation once, or another one of my plans was to have the contrail follow a helical pattern along an axis coaxial with its path giving a more interesting path, but I dunno.

But am I right, given a scenario of like 20-30 rockets being on the screen at the same time, plus the rest of the scene, I’m guessing this present scheme won’t scale very well?

Computing the matrix for each frame seems effectively a bottleneck. You should look more deeply at that.

Sorry but I can’t help you more.

Too much work.

investigate point sprites…this will save you having to use a tailored modelviewmatrix that doesn’t perform rotations - as point sprites are always screen aligned.
(The problem is that if the center of the sprite gets clipped, the whole thing gets clipped - because of this, I couldn’t use them)

You’re essentially creating a particle system that emits from the thruster of the rocket.

Don’t draw each quad seperately - use a data structure to store your particles, batch translate them all at once, and then use a vertex array to batch render them.

something like this:

struct particle
posX,Y,Z; //position
life; //die off rate
velX,Y,Z; //velocity
particle particles[100];

render rocket.
transform each particle.

this is all skim surface pseudocode, but hopefully you get the idea.
always try and batch your work as oft as possible.

hope some of that makes sense.