Rendering Two Cameras at Once

Blitz3D Forums/Blitz3D Programming/Rendering Two Cameras at Once

Uber Lieutenant(Posted 2004) [#1]
At the moment I'm experimenting with trying to make a mesh-based HUD similar to the concept's application in Metroid Prime and Metroid Prime 2. So there's no chance that the hud will clip through walls and objects, I'm going to isolate the visor mesh in a location in 3D space distant from the player and the level and use a camera to render it on the player's screen. In case it didn't hit you yet, I'd also like the player to see the actual gameplay as well.

How can I project whatever is rendered from the HUD camera to be seen on top of what's rendered in the gameplay camera in real-time?


GfK(Posted 2004) [#2]
Pretty easily. Just create the main camera before you create the HUD camera (or use EntityOrder to define the draw order), and use CameraClsMode HUDCamera,False,False.


Uber Lieutenant(Posted 2004) [#3]
Got it working brilliantly. Thanks!


Uber Lieutenant(Posted 2004) [#4]
Another question relative to this issue. When I get to RenderWorld, will this work? It doesn't seem to be at the moment as far as I've seen.

	CameraProjMode(hudCamera,0)
	CameraProjMode(gameCamera,1)
	
	RenderWorld(tween#) ;Render Game-World
	
	CameraProjMode(gameCamera,0)
	CameraProjMode(hudCamera,1)
	
	RenderWorld(tween#) ;Render HUD
	
	Flip



WolRon(Posted 2004) [#5]
Man, I love these questions.... ((irony))

When I get to RenderWorld

Well, which Renderworld are you talking about? The first one, or the second one? Or do you just mean the entire code you supplied?

will this work?
Well, that really depends on what you want to achieve, now doesn't it?
If you want the second camera to completely draw over what the first camera drew, then YES, I guess it will work.
If, however, you want the second camera to only draw over parts of what the first camera drew, then it appears that you are missing a CameraCLSMode command (unless you included it elsewhere).
If, however, you meant something else by "will this work?", then I guess you will have to explain what it was that you were referring to...


Uber Lieutenant(Posted 2004) [#6]
Read the thread, you tool.


_PJ_(Posted 2004) [#7]
If it helps, check the Galactic Source code. The Cockpit-View mode contains 2 cameras rendered. One being the main viewscreen, with a smaller radar image displayed also.

Yes.


Will effectively render both camera views. However, ensure that the CameraViewports are set correctly and it will be fine.