Jump to content
  • Advertisement
Sign in to follow this  

Problems To Get Xy Plane Aligned Particles To Work

This topic is 789 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


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?




Edited by 51mon

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!