With the impending collapse of the Citadel, two members of the Resistance are tasked with evacuating any citizens remaining. Little do they know that their mission sees them gaining critical information that puts the early fate of White Forest in their hands.

Report article RSS Feed C17 Episode One | Real Time Global Lighting in Source

It's light. It's real time, and it's in the Source Engine.

Posted by MrtwovideoCards on Dec 5th, 2011

City 17: Episode One

Real Time Global Lighting in the Source Engine.
Yes Really.

Mod of the Year AwardsAbbreviated CSM, Cascaded Shadow Mapping is a popular technique used in many mainstream games due to it's advantages, the most notable is that it is fully dynamic. It adjusts both shadow complexity and resolution of shadows casted by objects based on distance from the player. I.e: Shadows casted by objects further away from the player have lower resolution and detail. This system makes the general appraoch to real time lighting affordable on today's hardware. Because shadows casted by objects in the distance don't need to have as much detail and resolution, quality is sacrificed for performance, though still remains real-time.

Our team member, Sam Za Nemesis intially designed it for the Alien Swarm engine, however the system is entirely backwards compatiable up to Source 2007. For a couple of days now, our smart rats at Gear Labs have been porting it back to the old Orange Box engine (2007), so far we have almost everything set up to use in our game. While City17 doesn't feature any Day to Night cycles, where this system truly shines, we'll still be heavily using it as the primiary light source in the majority of our environments due to it's advantages over the standard baked lighting technique (that's not say we're tossing out radisoity based lighting altogether!). Instead, we'll be combining the two to create a perfect balance between what real time and baked lighting can offer. It really is a nice Ying Yang kind of situation.

Sam is also trying to play with other shadow techniques, his current main goal is to give support for the more advanced PSSM (Parallel Split Shadow Maps) technique in the Source Engine, and maybe even in developing a cheap AO technique.

Real Time Global Lighting

Real Time Global Lighting

Real Time Global Lighting

The Technical Bits

Using Real time Lighting globally presents a real performance issue. Especially on the Source Engine. This implementation of CSM heavily uses all of the past improvements we've made to the stock dynamic lighting system built by Valve. For one, the system is going to use a completely custom PCF method (which, currently it does). The system is pretty basic right now, having no support for adjusting casting angles based on a time scale for instance, though we do plan to implement features like that later on into the system. Right now our main priority is making sure it runs well, and specifically for what we need it for.

In the images above we use a custom GUI panel to drive angles and light intensity, eventually we plan to release this as a standalone demo with a much nicer and cleaner interface to control the system.

From what we've measured the system currently performs at:

  • Alien Swarm 1080p, 1.5-1.7ms
  • Alien Swarm 720p, 1.2-1.4ms
  • Source 2007 1080p, 2.2-2.4ms
  • Source 2007 720p, 2.0-2.1ms

We definitely have a ways to go on Source 2007. Right now we're going to work on some pretty basic map side optimization functions we can do from Hammer. Later we'll be going deeper into the system, to see what we can internally optimize.

Right now the system is being used by the Ivan's secrets team (if you haven't seen that mod yet you should go and check it out, because it's pretty rad. Oh and Vote for them, We voted for them.). Below is a demonstration of how the system works on both 2007 and Alien Swarm.

Unfortunately we didn't have the time to a record a video in 2007, but that's also primairly because we're having some problems with the GUI for reason we can't understand. We're basically just firing outputs to the ent, and that is not as smooth or nice to see as the Alien Swarm version is, but we're working on that.

Okay now that's really all we have for today! We're serious. Follow us on Twitter for updates on what's going on in development, as well as our blog for City 17 and other development news from us. If you'd like to get in contact with us or leave us suggestions, be sure to email us at: mrtwovideocards@gmail.com.

City 17: Episode One
Post comment Comments
QuarterLife Creator
QuarterLife Dec 5 2011 says:

We're powerful wizards IRL.

+3 votes   reply to comment
August_K Dec 6 2011 replied:

Yes. Yes, you are. *bows down*

+2 votes     reply to comment
PeacefulPatriot Dec 6 2011 says:

Yes. YES. YES! I love my shadows. You guys and Ivan's Secrets are setting a new standard for Source modding now.

+2 votes     reply to comment
Leon_Kilean Dec 6 2011 says:

Ooo, now that´s amazing.

+2 votes     reply to comment
Alex2the3gr8 Dec 6 2011 says:

Looks cool, but how come models aren't supplying shadows?

+1 vote     reply to comment
Kamikazi[Uk] Dec 6 2011 says:

Why havn't you guys been hired by valve :s.

+1 vote     reply to comment
xalener Dec 6 2011 replied:

More importantly, why doesn't valve use their own damn tools to their potential?
We see more and more mods like this every day, but CS go is still on par graphically with battlefield 2. :/

Methinks they should start digging into their own community's tools. No shame in it.

+3 votes     reply to comment
samuelgames Creator
samuelgames Dec 6 2011 replied:

Cloud.steampowered.com < Vanilla CSGO
Cloud.steampowered.com < With our stuff

+4 votes   reply to comment
Smiley_Riley Dec 6 2011 replied:

Because Valve is smart enough not to exclude a good deal of their lower pc end gamers just to appease those with dual sli video card configs

+2 votes     reply to comment
MrtwovideoCards Author
MrtwovideoCards Dec 6 2011 replied:

Lol, trust me. Real time lighting is pretty darn cheap these days. Dota2 currently uses global lighting and SSAO. So CS:GO really has no excuse.

+1 vote   reply to comment
AncientT Dec 6 2011 replied:

Battlefield 2 ? you crazy its own engine is diffrent they do not look alike. i found cs go looks more realistic a 10x % than battlefield 2 even lef 4 dead 2. But ya why doesn't valve use there full potential.

-1 votes     reply to comment
MarkC. Dec 6 2011 says:

Lol, nice one!

+1 vote     reply to comment
ModMage Dec 6 2011 says:

Looks great, lots of potential, yadda yadda.. But do viewmodels for weapons cast shadows apon themselves? I know by default ENV_projectedtextures, the only current source of shadow maps, would never cast properly on ornament props, which always bothered me. And in regards to phong shading, does the world light for phong move dynamically with the angle of the light projection, Or is phong still limited to only static world lights? I love phong.

+1 vote     reply to comment
MrtwovideoCards Author
MrtwovideoCards Dec 6 2011 replied:

Phong moves based on the light source, yes. Also shadows cast on the viewmodel, we've fixed that.

+1 vote   reply to comment
WS-GS8 Dec 6 2011 says:


+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

Half-Life 2 Icon
Send Message
Official Page
Release Date
Mod Watch
Track this mod
Report Abuse
Report article
Related Games
Half-Life 2
Half-Life 2 First Person Shooter
Related Groups
Gear Developer & Publisher with 9 members