3d Sprite Overlay

Blitz3D Forums/Blitz3D Programming/3d Sprite Overlay

Craig H. Nisbet(Posted 2004) [#1]
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?


electronin(Posted 2004) [#2]
Use the 2D drawimage command, after renderworld.


Matty(Posted 2004) [#3]
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


N(Posted 2004) [#4]
Also, you could consider multiple-pass rendering. Do a single renderworld for the zoomed in stuff, and another for the GUI/HUD.


Bouncer(Posted 2004) [#5]
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)


John Pickford(Posted 2004) [#6]
I would render the overlay as a separate pass. Much simpler, and very fast.


Craig H. Nisbet(Posted 2004) [#7]
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.


Bouncer(Posted 2004) [#8]
not true... blitz supports as many cameras as you like.


Ken Lynch(Posted 2004) [#9]
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.


Craig H. Nisbet(Posted 2004) [#10]
Not what I meant, yes it supports multiple cams but only displays one.


Binary_Moon(Posted 2004) [#11]
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.


Craig H. Nisbet(Posted 2004) [#12]
Wow, is that not documented?


Binary_Moon(Posted 2004) [#13]
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).


Craig H. Nisbet(Posted 2004) [#14]
version.txt, were is that?


jfk EO-11110(Posted 2004) [#15]
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.


N(Posted 2004) [#16]
I dpn't think using entityorder is documented


Uh, just thought I'd clear any problem with that up.


Binary_Moon(Posted 2004) [#17]
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).


N(Posted 2004) [#18]
It cleared up any problems anyway :P