3d Sprite Overlay
Blitz3D Forums/Blitz3D Programming/3d Sprite Overlay
| ||
Is there a way to create a sprite hud overlay that is independent from the camera zoom? My project requires the camera to have zooming features, and I have some sprites I want to us as a hud, but the zoom keeps messing with the them. Any ideas? |
| ||
Use the 2D drawimage command, after renderworld. |
| ||
There is a draw3dmouse function in the code archives. It would probably be useful if you adjusted it slightly so that it displayed other quads as well as the cursor. It uses a second camera so supposedly the zoom doesn't affect it. http://www.blitzbasic.com/codearcs/codearcs.php?code=865 |
| ||
Also, you could consider multiple-pass rendering. Do a single renderworld for the zoomed in stuff, and another for the GUI/HUD. |
| ||
scale the sprite with 1.0/camzoomvalue... that keeps it same size regardless of camerazoom. Or if you are allready scaling the sprite just multiply the scalefactor with 1.0/camzoomvalue... example: scalesprite sprite,xscale * (1.0/yourcamzoom),yscale * (1.0/yourcamzoom) |
| ||
I would render the overlay as a separate pass. Much simpler, and very fast. |
| ||
I've seen some code where they actually use a seperate camera, even though Blitz only supports one. I'll have to see if I can find that again. |
| ||
not true... blitz supports as many cameras as you like. |
| ||
I've seen some code where they actually use a seperate camera, even though Blitz only supports one. Blitz does support more than one camera. |
| ||
Not what I meant, yes it supports multiple cams but only displays one. |
| ||
Not what I meant, yes it supports multiple cams but only displays one. Again not true. You can change the camera viewport to draw many cameras at once. Also showing and hiding cameras enables and disables their rendering. You can also use entityOrder with cameras to change the order that camera render making one cmera render on top of the other. |
| ||
Wow, is that not documented? |
| ||
I dpn't think using entityorder is documented - its mentioned in versions.txt (in the 1.83 section) though. The cameraviewport command has been there since day 1 (from what I remember anyway). |
| ||
version.txt, were is that? |
| ||
In the blitz3d folder. you might use cameraprojmode to avctivate and disable cameras. Then set the CameraClsMode of the Hud-Cam to "don't clear background", so it will render semitransparent hud elements correctly. You can position the Hud Camera and the Hud Quads or Sprites (note: Sprites don't support Fog) 10 thousand or so blitzunits away from the main scene. |
| ||
I dpn't think using entityorder is documented Uh, just thought I'd clear any problem with that up. |
| ||
Uh, just thought I'd clear any problem with that up. I didn't mean that the entityOrder command isn't documented. What i meant is the fact that you can change the order cameras are rendered using entityOrder isn't documented (which that link just proved). |
| ||
It cleared up any problems anyway :P |