Underhell is a Source Engine game developed by the Underhell Team in collaboration with We Create Stuff. Underhell Chapter 1 requires ONLY Source SDK Base 2007 installed. No Source game is required.

Report RSS Multiple Render Targets, Higher Resolution Monitors

This tutorial will explain how we implemented a system to workaround the Source Engine's limitation of having only 1 Ingame Camera active at a time, and how we managed to increase the resolution to improve quality of the rendered camera.

Posted by on - Basic Mapping/Technical

It is a known and grieved limitation, the Source Engine allows for only 1 ingame camera to be rendered in a map at all times.
Although you can change the point_camera to render for a func_monitor, you can only have 1 camera rendered at once, and the Resolution of said monitor is set at 256x256, no matter how much you resize your monitor in Hammer.

This is due to Source only having 1 RenderTarget texture, if multiple cameras would be active at once, and one would be pointing at the monitor, it would render the texture within itself, therefore generating an infinite render loop and crashing the game.

HAMMER


So this is why we have implemented a Hammer Keyvalue into the point_camera entity :

Point_Camera Keyvalues :

Rendertarget : 1
Rendertarget : 2
Rendertarget : 3
Rendertarget : 4

Which are, respectively :

256A
256B
512A
512B

This simple Hammer Keyvalue that needs to be added to the point_camera's properties by turning SmartEdit off, allows to set an index for new Render Target textures for the cameras, therefore working around the limitation.

.VMT


What we had to do, was to make the engine build a new set of render target textures, and in order for us to reference them in the level editor, we created a set of VMTs that calls the corresponding engine texture.

materials/dev/dev_monitor_256A.vmt
materials/dev/dev_monitor_256B.vmt
materials/dev/dev_monitor_512A.vmt
materials/dev/dev_monitor_512B.vmt

If you open up the VMTs, you will see the following code inside.

dev_monitor_256A.vmt

"UnlitGeneric"
{
	"$basetexture" "_rt_CustomCamera_1"
	"%tooltexture" "dev/dev_monitor"
	"$surfaceprop" "glass"
}


dev_monitor_256B.vmt

"UnlitGeneric"
{
	"$basetexture" "_rt_CustomCamera_2"
	"%tooltexture" "dev/dev_monitor"
	"$surfaceprop" "glass"
}

dev_monitor_512A.vmt

"UnlitGeneric"
{
	"$basetexture" "_rt_CustomCamera_3"
	"%tooltexture" "dev/dev_monitor_512"
	"$surfaceprop" "glass"
}

dev_monitor_512B.vmt

"UnlitGeneric"
{
	"$basetexture" "_rt_CustomCamera_4"
	"%tooltexture" "dev/dev_monitor_512"
	"$surfaceprop" "glass"
}  


IMPORTANT : If no "$surfaceprop" is set, when you buildcubemaps the Monitor will NOT render.
Weird glitch, took us a while to figure it out.

You will notice the index of each _rt_CustomCamera_* refers directly to the number you need to enter in the point_camera's "RenderTarget" keyvalue.

So, if you place a func_monitor with the texture "dev_monitor_512A" applied to it, which is the Index number 3, you then need to have a point_camera with the keyvalue:
RenderTarget : 3

That is how they are linked together, now thanks to those 4 extra monitors, plus the original one, you can have a maximum of 5 monitors in game working independently.
Just avoid putting a point_camera and a func_monitor in the Same Room, especially if they are linked

Monitor Effect Overlay

If you want to add a "ScanLines" overlay to make it look like an actual MonitorTexture, you need to add a $texture2 texture set, and a few proxies effects.

I suggest you take a look at Valve's Monitor VMTs using GCFScape, then open
"/../steamapps/source materials.gcf"

Then browse to "hl2/materials/dev/"
Take a look at all the "dev_combinemonitors" and "dev_tvmonitors"
They have quite a couple of Monitor Effects there.


Programming by Carlos "Charly" Sotelo

Post comment Comments
MisterMister
MisterMister - - 140 comments

Wow keep em coming!, Last question will the gore system be implemented into the prologue? P.S. sorry for asking so many questions.

Reply Good karma Bad karma+5 votes
Mxthe Author
Mxthe - - 738 comments

Yeah, Prologue will be re-released alongside Chapter1, with all the new features.

Reply Good karma+8 votes
BriJee
BriJee - - 380 comments

Nice job Mxthe, can't wait this sweet release :D

Reply Good karma Bad karma+1 vote
IGotzNoSkittles78
IGotzNoSkittles78 - - 101 comments

It's great to see something like this from a coder. Normally when the word "Coder" comes into mind for game design, is something like "Advanced AI", "Bad-*** Weapons", or anything along those lines. Pretty neat to hear something that benefits the development aspects of a mod rather then mindless fun(Not that there's a problem with that).

Reply Good karma Bad karma+3 votes
IGotzNoSkittles78
IGotzNoSkittles78 - - 101 comments

Oh woups, I meant to type this comment on another tutorial page for Underhell. Well I sure look stupid in front of anyone that's read this page before I typed this.

Reply Good karma Bad karma+1 vote
Mxthe Author
Mxthe - - 738 comments

Well I could always delete your comment if you'd like, but where would be the fun in that ?

Reply Good karma+3 votes
Darkamo
Darkamo - - 474 comments

great !!! i can't wait for the release of the Chapter 1 ! because i'm waiting it and waiting , waiting is hard ;)

Reply Good karma Bad karma+3 votes
Mkilbride
Mkilbride - - 2,784 comments

Yes, waiting is very hard.

Underhell was truly a breakthrough in the stale FPS genre and I've been waiting ever since for EP1. :P

Reply Good karma Bad karma+2 votes
crazymancody895
crazymancody895 - - 832 comments

But were almost there. ;)

Reply Good karma Bad karma+1 vote
Darkamo
Darkamo - - 474 comments

yes were almost ther you right and the expectation is closing right ?

Reply Good karma Bad karma+1 vote
killbotvii
killbotvii - - 415 comments

Whoops, I accidentally voted down your comment! I meant to vote up, my appologies!

Reply Good karma Bad karma+1 vote
Arkanium
Arkanium - - 312 comments

Thanks, this is pretty useful.

redalpha01 has an interesting point though, since Portal's portals can essentially have a camera pointing at its own monitor without crashing the game. Even if it's a different version of Source, I'd be interested as to how that works.

Reply Good karma Bad karma+1 vote
creater
creater - - 4 comments

when are you going to realese underhell weve been waiting for months now

Reply Good karma Bad karma-1 votes
creater
creater - - 4 comments

can you atleast giveout a little gameplay and some scares on your youtube channel

Reply Good karma Bad karma-1 votes
Guest
Guest - - 690,453 comments

This comment is currently awaiting admin approval, join now to view.

TheMadCarrot
TheMadCarrot - - 25 comments

So does this only work with your mod, not with vanilla HL2/Ep1/Ep2? Because I just tried it in unmodded HL2/Ep1/Ep2 and I couldn't get it to work, I kept getting the purple-black checkerboard textures ingame.

Reply Good karma Bad karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: