Re: [Algorithms] On 2D and 3D Sprites
Brought to you by:
vexxed72
From: Stephen J B. <sj...@li...> - 2000-08-03 16:14:27
|
On Thu, 3 Aug 2000, Doug Chism wrote: > 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. That's certainly what most people do. It's not *perfect* though because it keeps the object parallel to the screen - which is not the same thing as "facing the camera". The difference is usually unimportant unless you have a wide field-of-view. > 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. The model will always rotate about its local origin. If you move it away from there (by changing the vertex coordinates) it's still going to rotate around the origin - I suppose that might *look* like a translation if it's sufficiently far from the origin. You have to position it billboards using the matrix and THEN nuke the rotation parts. > 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? I don't quite understand your explanation of the bug - but I can tell you that I've done this successfully *many* times in the past and if you have it implemented right, it will work. Steve Baker (817)619-2657 (Vox/Vox-Mail) L3Com/Link Simulation & Training (817)619-2466 (Fax) Work: sj...@li... http://www.link.com Home: sjb...@ai... http://web2.airmail.net/sjbaker1 |