# Problems To Get Xy Plane Aligned Particles To Work

This topic is 876 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey

I work on a particle system with the following transformation to align the particles with the view point:

vY = particleToCameraVec   (in world space)

vX = Vec3( vY.y, -vY.x, 0 )

vZ = cross( vX, vY )

These 3 vectors form the orthogonal basis that the particle sprites are transformed with. As you can see vX is aligned to the XY plane. The benefit from using this setup is that the particles appear to preserve their relative orientation even when the camera rotates. This works all fine except from when viewing the particle system along the Z axis. When panning across the emitter the particle orientation gets rapidly flipped (as vY.x & vY.x is insignificant compared to vY.z).

I've tried to work out the math so that the orientation can be improved when panning along the XY plane while looking in the Z direction but none of my attempts have been fully satisfactory yet.

Does anyone know how to solve this? Or maybe you would have done it differently altogether?

Thanks!

Edited by 51mon

##### Share on other sites

If you take your camera matrix used to draw the world, this takes obejcts from the world relative to the camera (because you are essentially using the dot product to determine vectors relative to the camera). If you inverse this matrix, which is actually the transpose as well, you can get the cameras x,y,z axis in world coordinates.  That should help you. I send the same 3Dpoint 4 times and move it's position by the camera world space vectors based on the texture coordinate.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013739
×