Particle viewing
Hi,
I''m trying to implement a particle system, but there''s one point I''m having trouble understanding.
How do I make sure the particle polygons are facing the camera all the time?
Jake
There are two common accepted techniques for that:
- Rotate the particle''s polygon in such a way that it always faces the viewer. I do not have the required transforms handy over here, but I can look them up if you want. This becomes slow if you have many, many particles, since you have to calculate the required transform for each particle. Advantage of this method is that any object can occlude particles. The Z-buffer will do that for you without any user intervention required.
- (My preferred method) Project the particle onto the viewing plane. (in OpenGL, you could use gluProject for that) This yields screen coordinates which are the center of your particle. The particle''s size can be determined from the Z resulting from the projection. Now draw your particles as 2D sprites after rendering the rest of your scene. With OpenGL you should draw textured quads, with Direct3D you could do the same, or use a Blt for that. The advantage of this method is that it can easily handle thousands of particles. The disadvantage is that if you want an object to occlude your particles, you need to find out which particles are visible yourself.
Also remember that if you use alpha-mapped particles, you need to sort them back-to-front before drawing.
Hope this helps,
DaBit.
- Rotate the particle''s polygon in such a way that it always faces the viewer. I do not have the required transforms handy over here, but I can look them up if you want. This becomes slow if you have many, many particles, since you have to calculate the required transform for each particle. Advantage of this method is that any object can occlude particles. The Z-buffer will do that for you without any user intervention required.
- (My preferred method) Project the particle onto the viewing plane. (in OpenGL, you could use gluProject for that) This yields screen coordinates which are the center of your particle. The particle''s size can be determined from the Z resulting from the projection. Now draw your particles as 2D sprites after rendering the rest of your scene. With OpenGL you should draw textured quads, with Direct3D you could do the same, or use a Blt for that. The advantage of this method is that it can easily handle thousands of particles. The disadvantage is that if you want an object to occlude your particles, you need to find out which particles are visible yourself.
Also remember that if you use alpha-mapped particles, you need to sort them back-to-front before drawing.
Hope this helps,
DaBit.
Well in DX, couldnt you just make your particals D3DTLVERTEX so that they are never transformed in the first place. I dont exactly understand Partical Systems so please tell me if Im wrong.
I don''t know much D3D, but couldn''t you just use a billboard?
"When people tell you they want to hear the truth, you know that their lying."
"When people tell you they want to hear the truth, you know that their lying."
Hi
I am using the up and side Vectors of my camera, to draw the particles. I am using the Positional Vector of my Particle, and then add the up, and the side Vector. Then i recieve 3 Vertexe to draw a Triangle.
This way is faster than the Vertex Transformation (when you have the up and side Vectors) and it uses the Z-Buffer.
Lars W.
I am using the up and side Vectors of my camera, to draw the particles. I am using the Positional Vector of my Particle, and then add the up, and the side Vector. Then i recieve 3 Vertexe to draw a Triangle.
This way is faster than the Vertex Transformation (when you have the up and side Vectors) and it uses the Z-Buffer.
Lars W.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement