PDA

View Full Version : point sprites vs. quads



Aeluned
04-12-2005, 07:44 AM
First of all, I know I should read the spec, blah
blah, but I'm assuming someone probably already
knows the answer so I'm being lazy about it.

I have an old particle system rendered using
screen aligned quads. Do point sprites offer a
performance boost over using quads or are they
solely for the convenience of not having to
screen align the quads.

Thanks.

zed
04-12-2005, 10:19 AM
yes they should be quicker in theory sending 1 vert vs 4 verts.
but they do suffer from lots of problems
A/ most particle systems u want the particles to rotate so theyre useless for this
B/ if the center is off the screen the whole thing willl get clipped
C/ only on texture coordinate is generated for the pointsprite perhaps causing problems with fog etc
D/ theres also a maximum size they can be drawn at i think

brinck
04-13-2005, 03:23 AM
Originally posted by zed:
yes they should be quicker in theory sending 1 vert vs 4 verts.
but they do suffer from lots of problems
A/ most particle systems u want the particles to rotate so theyre useless for this
B/ if the center is off the screen the whole thing willl get clipped
C/ only on texture coordinate is generated for the pointsprite perhaps causing problems with fog etc
D/ theres also a maximum size they can be drawn at i thinkMost of these problems are solvable:

A: You can rotate the particle in a fragment program by rotating the texture sampling.

B: If the particles are small, which they generally are, this is not much of a problem.

C: I'm not sure what you mean with this.

D: See B.

/A.B.

Aeluned
04-13-2005, 04:37 AM
ooof, B is pretty nasty. There's no guarantee
my particles will be small enough to not cause
an eye sore by that.

So, I would see roughly a 75% performance gain
then?

Still, I suppose I can't use them due to B.
Thanks a lot for the info, you saved me some time!

PsychoLns
04-13-2005, 06:04 AM
D) is pretty nasty too. It's usually less than 64 *pixels* (63 on 6800gt), independent of screen resolution etc.

Btw. it's worth noting (if not using point sprites) that element arrays of triangles are 50% faster than GL_QUADS on ati cards, while GL_QUADS are 50% faster than element arrays on nvidia cards... (you can probably use (a portion of) a static element array buffer).

zed
04-13-2005, 10:31 AM
doing the rotation in a vertex/fragment program sortta defeats the purpose of point sprites (ie send less data) if u also have to send rotation data as well per sprite.
further clarification over C
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000595
this is important for certain types of fog and shadows

brinck
04-14-2005, 07:35 AM
Originally posted by zed:
doing the rotation in a vertex/fragment program sortta defeats the purpose of point sprites (ie send less data) if u also have to send rotation data as well per sprite.
further clarification over C
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000595
this is important for certain types of fog and shadowsPoint sprites have a lot of limitations but I don't think you make a valid point. If you want to rotate your point sprites per instance you'll only have to add one extra float (the angle) to your point sprite vertex. Doing the particles as quads or pairs of triangles will require 4 or 6 times the original memory.

If you rotate all the sprites the same way it's just an extra fragment shader constant.

If you can get away with point sprites (i.e. you have small particles), use them!

/A.B.