Particle quick question

Started by
12 comments, last by DensitY 13 years, 11 months ago
Hi ! To make a particle system, do you prefer using pointsprite or normal quads (sprite) ? What do you suggest (for an FPS engine) ? thanks !!
Advertisement
Quads tend to be more flexible I would say. In case you are using D3D 10 (and upwards) pointsprites aren't really supported by the API, but you could use a geometry shader instead.
I prefer normal quads. It gives you more flexibility, like stretching a spark particle, or tumbling a leaf particle.
Are pointsprites rendered with the center offscreen in DirectX? If not, another vote on quads.
Thanks you guys !

I was just thinking about the fact that with quads you have to send 4 vertexes for each quad, instead of just one needed by a pointsprite.

Quote:Original post by KulSeran
I prefer normal quads. It gives you more flexibility, like stretching a spark particle, or tumbling a leaf particle.


What do you mean with "tumbling a leaf particle" ?

thanks ;)

A "smoke" particle might be a screen-facing billboard quad.
A "spark" particle would be a screen-facing billboard that is stretched along the velocity of the particle.
A explosion might have a world oriented shockwave that is parallel to the ground.
A leaf or confetti might rotate or tumble on one or more axis in world space ( for instance a coworker made the effect in
">this using a particle that tumbled on the single long axis of the confetti )
Quote:Original post by NiGoea
I was just thinking about the fact that with quads you have to send 4 vertexes for each quad, instead of just one needed by a pointsprite.

True, but with geometry shaders you can get around that.

Thanks !

So let's use quads.
I was looking for a way to have quads always facing the camera.
I found two solutions:

1. Billboards. But this forces to have a DrawPrimitive for each single quad, that is for each particle, because the worldView matrix is different for each particle. It sounds slow to me.

2. Compute world space vertexes for each quad, rotated accordingly to the (inverse) camera matrix. In this way you can pack many particles in a single draw call. But the CPU has to perform lots of vector-matrix mul.

What do you suggest ?

thanks ;)
3) Neither.

Use a dynamic VB with world-space coordinates in it, then do the rest of the math on the vertex shader.
------------------------------Great Little War Game
I'd agree with Rubicon, but I've never done shader particles.
so
Quote:
2. Compute world space vertexes for each quad, rotated accordingly to the (inverse) camera matrix. In this way you can pack many particles in a single draw call. But the CPU has to perform lots of vector-matrix mul.

for billboards, you only need to do vector addition.
Take the world center of the particle, and just add/subtract the camera's up and left vectors to generate your 4 corners.

You could likely do that in a shader too.

This topic is closed to new replies.

Advertisement