Source cameras and multiple views into a scene

  • Thread starter Thread starter keltie
  • Start date Start date
K

keltie

Guest
Hi,

I'm new to the Source codebase and am reading trying to digest how parts of system and its terminology works.

If anyone can shortcut (or shortout if its really no go) the following aim that would be great.

I would like to be able add two cameras (or views?) into the scene. They would be in addition to the main first person camera, transformed by the same events transforming the main camera except with local rotational offsets (views to the sides). This is a fairly standard thing in visual simulation frameworks for correct peripheral vision but appears rarely in game engine design. With the recent 'threadification' of the SDK I was hoping that such a prospect may be possible now.

The purpose here is not to render to multiple monitors but to render multiple camera views onto the same monitor. I know that sounds a bit odd but I have worded it specifically like that in reference to other common links in the Source/HL2 network of resources.

The links I can find that come close are:

http://www.fpsbanana.com/tuts/208 : Unlimited Render Targets for Cameras
This tutorial may be relevant although it is a few years old now. Would I have to set up several render targets for supplementary concurrent FPS cameras? Is the entire scene, rendered to texture through the main camera as part of the Source gui?

http://www.snarkpit.net/editing.php?page=tutorials&game=HL2&id=131 : Cycling through cameras
The author here states pretty clearly that multiple concurrent cameras cannot happen although the statement is also tied to multiple physical monitors (dualview/horizontal span I assume, hence my comment above). This article is also quite old. Does it reflect the current state of the Source SDK?

http://developer.valvesoftware.com/wiki/Rear_View_Mirror : Rear View Mirror
This tutorial actually looks pretty close to what I may want to do, except have the mirror larger (third of the screen, no render overlap/overlay) and the camera pointing forwardsish. Again, do I need a material/texture to render to for main camera views?

Garry
 
What is the actualy aim of this like for what reason are you trying to render four views onto the screen. Looks like your best bet is to look at the rear view mirror code and make ammendments.

To do this however it will be tricky to position the camera as the code takes the current view and rotates it and displays the rotated view. Is this the sort of thing you wanted or did you want staticly placed cameras?

If this is what you want then you would have to create four functions like the ones stated. Naming them all slightly differently and using the code below

//Our view information, Origin, View Direction, window size
// location on material, and visual ratios.

to align them correctly. Make the sizing in the function with mirrorView.width = 256;
mirrorView.height = 128;
and also in the hud with SetPos( ScreenWidth() - 270 , 25 );

//Set Mirror to 256x128 pixels
m_Mirror->SetSize( 256, 128 );
m_Mirror->SetVisible( true );
and position and then

you have four views. As I said though this will be connect to the player so when the player moves they will all move. I cant understand why you would want to do that though so Im guessing I've misunderstood you.

Edit - after reading your post I realised that you actually ment two cameras and I'm guessing you want to set them slightly offset to create a false depth perception. I think this would probably work. though Im not sure the two hud elements could overlap. Unless you changed the opacity of one of them though that might not work with what you wanted. Let me know if that is what your talking about though. It sounds very interesting.
 
Back
Top