[Algorithms] On 2D and 3D Sprites
Brought to you by:
vexxed72
From: Doug C. <dc...@d-...> - 2000-08-03 15:26:49
|
I thought of an easy way to do 2D and 3D sprites but as of yet I cant get it to work well. The method involves simply grabbing the current world and view matrices and simply cancelling out the rotational components so the object can translate in world/view space but is always facing the camera. It works great if the object is just sitting there at the origin, moving the camera in any direction still appears as the object is facing right at you whether its a 2D sprite or a 3D complex object ). Billboards are easy because you can just allow rotations on one or more of the axes and it appears correct also. The weird thing is when you transform the object so it is no longer centered at the origin. The object still faces you perfectly, but it moves in relation to the camera - i.e. if you translate it along -x it moves along the -x axis with respect to the camera, not the world. For instance it would always move to the left with a -x translation matrix applied no matter what direction the camera faces it from. I cant figure out why it would do this since I am still passing though the world translation as well as the view, just not their rotations. Any ideas on this, has or anyone else tried doing 2D and 3D sprites in a similar fashon successfully? Our old method involved transforming the coordinate center of the object into view space and then reconstructing the object there ( slow - especially for 3D objects ). Doug Chism |