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 article RSS Feed Player Model and Mirror Reflections

A short explanation followed by a tutorial about the Player Model and the Mirror Reflections systems in Underhell.

Posted by Mxthe on Aug 17th, 2012
Basic Mapping/Technical.

The Orange Box engine has an brush entity called "func_reflective_glass", it is a mirror entity.
Technically, it is a Camera and a Monitor within itself, which is why if you have more than one of these in a same room, you will get issues.
These mirrors look great and add a lot of realism to environments, unfortunately there is one thing that does not reflect : The player himself.

This is due to the player NOT having a model set in Orange Box, and even when set, it remains invisible when in first person mode.

Player Model


Due to a small Third Person part in Underhell : Chapter 1, we had to create a functional and animated player model, that would closely follow the player's movement speed, animation and head direction, to try and make him as "alive" looking as possible.

This is why we manually animated and linked every single player behavior, down to lowering weapons,  shooting, jumping and crouching, to a preset playermodel.

The default player model is : "models/player/jake_casual.mdl"
In order to change the player model, an input must be sent to the !player entity:

code:
!player SetPlayerModel models/player/jake_guard.mdl

This input to the !player will set the playermodel to whatever is specified.
If the model path/name is not correct, the game will simply display an error message in the console, and the model will remain unchanged.

In order for any additional player model to be animated properly, the following lines must be added to the .qc of the model :

code:
$includemodel "player/male_anims.mdl"
$includemodel "humans/male_shared.mdl"
$includemodel "humans/male_ss.mdl"
$includemodel "humans/male_gestures.mdl"
$includemodel "humans/male_postures.mdl"
$includemodel "humans/female_shared.mdl"
$includemodel "humans/female_ss.mdl"
$includemodel "alyx_animations.mdl"
$includemodel "alyx_gestures.mdl"

 

Yes, those are a lot of compiled animation models, but this gives many possibilities for the player model to be well animated or even be an actor during scenes, that can have many gestures/poses.
A feature commonly used in Underhell.

Mirrors


So we had our player model, fully functional in Third Person, but it would still not render in mirrors nor monitors.The main problem was, that in order for it to be rendered there, it also needed to be rendered in the "world" so that it could reflect properly, which means that if the player would look down while in first person, he would see INSIDE the player model, and cause very nasty visual bugs.

So, we thought of a system that would allow us to render entities ONLY in the "RenderTarget" textures, giving us not only the opportunity to render player in Mirrors and Monitors while in first person, but ANY dynamic entity in the game, can be added a keyvalue to be rendered only in Mirrors or Monitors.

This system gives us endless possibilities for scares, where "something" would only be visible while looking at it through a mirror/monitor.

The playermodel has this value set by default, in order for any entity to be rendered only in mirrors, the following keyvalue must be added in hammer, by turning smartedit off:

code:
uh_rendermirrorsonly 1

Setting this keyvalue to any entity in the game, will tell the engine to render them only in "RenderTarget" textures, therefore only in func_reflective_glass or func_monitors.

Multiple Mirrors


As previously stated in the Multiple Render Texture, placing multiple RenderTargets that use the same RenderTarget texture in one room, messes it up badly, and can even cause crashes.

The Multiple Mirrors feature is something that we have planned, however at the time we are uncertain if it is possible using the same technique used previously.
Whenever this feature is implemented and works correctly, I will edit this section and describe it's functionality.

Programming by Carlos "Charly" Sotelo
Post comment Comments
Serathis
Serathis Aug 18 2012, 5:07am says:

Player reflections? In a Half Life mod? Hell must have frozen over! Nice.

+24 votes     reply to comment
Domo01
Domo01 Aug 18 2012, 8:56pm replied:

It's not like this is the first mod to have reflections in mirrors. Still mighty impressive though.

+4 votes     reply to comment
TheJP3372
TheJP3372 Aug 18 2012, 9:43pm replied:

I sense really creepy mirror scares coming o.0

+11 votes     reply to comment
Dønny
Dønny Aug 19 2012, 10:58am replied:

in this case we need feet and legs too! i can't identify myself with a mute, astral entity anyways..

+3 votes     reply to comment
Phenixtri
Phenixtri Aug 19 2012, 7:12pm replied:

indeed a properly animated player view model capable of visibly interacting with physics props would really bring the games atmosphere to life. IE being able to see your own arm picking things up for example. Not even valve has had the balls to pull something like that off.

+2 votes     reply to comment
Mxthe
Mxthe Aug 19 2012, 9:58pm replied:

Yeah well don't expect that to happen any time soon.

Crysis kinda does that in first person for some objects, but you can't really pick up a lot of objects in the game.

The problem with this system comes in the fact that every object has different mass and shape, and the arms and hands would need to be animated correctly so the "carrying" would look right.

Doing this arm and hands animation for every possible object in the game is a nightmare.

It could be done procedurally, which is most likely what will happen, but game developers have more important things to do that work on such things.

Very few games allow you to pick up physic objects at all...

+3 votes     reply to comment
Mkilbride
Mkilbride Aug 20 2012, 11:11am replied:

Uh, what?

Valve has done that before in a game.

Also, there is a mod that allows you to pick up weapons. You see your hands go down, like Crysis and pick them up.

Can't find the mod right now though. It was basically CS:S with really advanced bots, more weapons,a nd changes, like SMOD, but wasn't called so.

-2 votes     reply to comment
Chad51
Chad51 Aug 18 2012, 5:55am says:

Awesome

+1 vote     reply to comment
Dr.Goupyl
Dr.Goupyl Aug 18 2012, 6:12am says: Online

That's really neat, i like how you put small but cool extra details.

+9 votes     reply to comment
Sn4rk
Sn4rk Aug 18 2012, 7:17am says:

You can finally see yourself in mirrors? I suggest to make some scares like this :D example: You look at the mirror, everything looks normal. You look away, then you look back and "she" is standing behind you.

+1 vote     reply to comment
Azatoth027
Azatoth027 Aug 18 2012, 9:01am replied:

This.

+1 vote     reply to comment
Kisaraji
Kisaraji Aug 18 2012, 7:32am says:

It's one step to make the player fell that he isn't just a floating weapon!

+3 votes     reply to comment
itsthepopei
itsthepopei Aug 18 2012, 8:56am replied:

Floating weapons have feelings too!!!!

+5 votes     reply to comment
IGotzNoSkittles78
IGotzNoSkittles78 Aug 20 2012, 5:03am replied:

The Player is not a weapon!! It's a pair of floating hands holding a weapon!

+1 vote     reply to comment
Rus[T]
Rus[T] Aug 18 2012, 7:33am says:

Wow, so weird this isn't supported by default, great work!

+3 votes     reply to comment
thedevon
thedevon Aug 18 2012, 1:54pm says:

you should make a crazy mirror maze for one of the dreams

+4 votes     reply to comment
MisterMister
MisterMister Aug 18 2012, 3:26pm says:

Thank You so much!

+3 votes     reply to comment
Dune_Jumper
Dune_Jumper Aug 18 2012, 7:00pm says:

Too bad I won't enjoy looking at my reflection...I'll be too worried about what else is about to appear in the reflection.

+3 votes     reply to comment
CaptainCat
CaptainCat Aug 18 2012, 7:03pm says:

Aright, now give us the lower half of our bodys. Please

+4 votes     reply to comment
Bor2571
Bor2571 Aug 21 2012, 9:27am says:

I think this would be a good horror scene idea "You walk into the room and look at the mirror, the door shuts and you investigate, when you turn back and look at the mirror you see her then some creepy stuff happens like screaming then the lights go out and so on" don't you people agree with me.

+1 vote     reply to comment
Dr_Tomorrow
Dr_Tomorrow Jan 15 2013, 9:06pm says:

Why Valve couldn't implement this stuff by now? I mean I feel that the whole Valve gaming company programmers are no better than Charly all alone...

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Half-Life 2 Icon
Platform
Windows
Developed By
Mxthe
Contact
Send Message
Release Date
Released Mar 5, 2011
Mod Watch
Track this mod
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Mods
Underhell (Half-Life 2)
Underhell Half-Life 2 - Single Player Adventure
Related Games
Half-Life 2
Half-Life 2 Single & Multiplayer First Person Shooter