
Advertisement
This topic is 2943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.
If you intended to correct an error in the post then please contact us.
Recommended Posts
NiGoea 104
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 vectormatrix mul.
What do you suggest ?
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 vectormatrix mul.
What do you suggest ?
thanks ;)
0
rubicondev 296
3) Neither.
Use a dynamic VB with worldspace coordinates in it, then do the rest of the math on the vertex shader.
Use a dynamic VB with worldspace coordinates in it, then do the rest of the math on the vertex shader.
0
KulSeran 3267
I'd agree with Rubicon, but I've never done shader particles.
so
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.
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 vectormatrix 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.
0
Sign in to follow this
Followers
0

Advertisement
True, but with geometry shaders you can get around that.
Share this post
Link to post
Share on other sites