View Full Version : 2D bitmap in 3D
06-21-2002, 05:40 AM
do you know any good/efficient method of rendering flat 2D bitmaps/sprites in 3D space so that bitmap is faced toward viewer (u know, like monsters in Wolfenstein)...
...without knowing transformations that were applied to an object(bitmap)..
..and so that z-buffer is filled with some const z value...?
thanks in advance
06-21-2002, 05:59 AM
So do you want to know how to display the bitmap or orientate it toward the viewer at all times? Or both?
06-21-2002, 06:56 AM
sorry if i didn't explain this well...
the only thing i want is to display bitmap facing toward viewer with proper z-value written to z-buffer
[This message has been edited by MickeyMouse (edited 06-21-2002).]
06-21-2002, 09:16 AM
What you want to do can be attained by drawing a quad (or two triangles) with your image applied as a texture. The natural pipeline will do all your z-buffer work for you--but beware, you want a constant z-buffer value, but that will not happen most of the time, since your quad will actually be rotated and re-oriented to face the origin.
Do a search on any search engine for "billboarding" This is a very commonly asked question.
An easier way to do it would be to use an orthogonal projection matrix, but then your z-buffer would be a bit tricky and you'd have to manually compute the scale factor.
06-24-2002, 06:51 AM
actually it's not that important z value is CONSTANT...
but i can't do standard billboarding, because i don't transform my model view matrix using only glRotate, glTranslate etc..
but multiplying it by some matrices...
Jeffry J Brickley
06-24-2002, 07:33 AM
If I understand what you are doing, you can still use billboarding. I use Quaternion rotations in software, but apply the final rotation only to the model view stack for faster results and smoother transforms. I use the eye/camera location and orientation to orient all the billboards and apply the finaly rotation with glrotate() and then draw. On the Geforce4 you might be able to cheat and use a PointSprite, but I have not read if that writes to the Zbuffer or just outputs rapidly to a screen. If it works like points, it writes to the screen buffer, I use points in my particle engine and they still react to the scene appropriately.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.