Source Lighting Created 12 years ago2012-05-24 20:40:49 UTC by Dimbeak Dimbeak

Created 12 years ago2012-05-24 20:40:49 UTC by Dimbeak Dimbeak

Posted 12 years ago2012-05-24 20:40:49 UTC Post #306461
I've been playing with source for a couple of months, and I've been having fun with my maps. But there's just one problem I've never overcome...

Lighting.

Usually, I just make a prop_dynamic light and under it I put a "light" and I say, "Alright. I'm finished." But this has left me with very poor lighting in what would prove a better map. So, I decided I'd ask the professionals.

How should I go about lighting for small rooms, hallways? Dynamic lighting with glows and... just something fancy.
Dimbeak DimbeakRotten Bastard
Posted 12 years ago2012-05-24 21:25:46 UTC Post #306462
It's a tough one because it's like the question "how long is a piece of string?"

There's no definitive answer. Different techniques can be used with extremely good results in some situations, and would look terrible in others.

Here's a couple of basic points to keep in mind:

For starters, use prop_static wherever possible for your light models. They cast baked (RAD) shadows as opposed to dynamic props which only cast in-engine real-time shadows which are not only more expensive to render but also look utterly terrible in just about every Source game pre-L4D2.

In Goldsource and Source, the most useful light entity in your arsenal is the light_spot entity. It gives you more control than any other light ent and can be used to replicate just about any light you can find in reality, as well as many you can't. Experiment with the "constant" value and falloff distances. Look up the inverse square law and use it to make your lighting more realistic in a realistic setting (although combine lights, for example, completely ignore it).

A combination of a light_spot and a very low-level light ent just under the base of the light source has been proven to provide a much more realistic spill from the light source in situations where the bulb is exposed, but people make the mistake of using this method for all their lights, even when it's entirely unrealistic, for example when using spotlight props.

In reality, light colours are measured in temperatures using Kelvin units. Mid-day daylight is ~5600 K and has a distinct blue tint to it. Lots of lights use daylight-balanced bulbs. You'll especially see this in office fluorescent lighting and it's a good temperature of light to incorporate in your interior scenes.
More commonly used for interiors are tungsten lights. Think desk lamps, bedroom lights, industrial bell lamps etc. They generally have a colour temp of ~3400K, although the brighter they are, the whiter they appear to our eyes.
Mixing these two light temperatures in a single room is basically my secret and immediately creates a very visually pleasing contrast. For example, in the recent Team Mapping project, I used industrial bell lamps with tungsten bulbs to fill this room, then used daylight balanced (blue) spotlights to provide contrasty highlights. Clicky for example image.

Use this chart if you really want to get realistic, awesome colour temperatures: Clicky. It's more for making movies, but everything I know about lighting game scenes I learned from lighting TV and film scenes.

Lightmap grids are hugely important in Source. A more defined (smaller) lightmap grid will provide very sharp shadows, while a larger lightmap grid will create fairly even lighting and shadow. The default is 16.
It's tempting to just make everything lightmap 2, but it's important to know where you should and should not.
Before even going into the filesize and compile time issues of lowering the lightmap scale, you should be aware of when sharp shadows exist in reality.
Its easiest to notice this in exterior scenes, so I'll ignore interiors for the moment. When the sun is your primary light source and there are no clouds in the sky, you will get incredibly sharp shadows. This is because the sky is relatively dark compared to the sun and isn't reflecting much light onto the surface. (fun fact: in the light_environment entity, the "ambient" property defines how much light is cast by the sky regardless of the sun, creating brighter or darker shadows)
On a cloudy day, you get very soft shadows. This is because the clouds act as diffusion to the sun and make the light far less direct. Basically the whole sky becomes one big, less bright sun.

For interiors it depends on the light hitting specific surfaces. I usually make my floors and some walls lightmap 4. Walls that aren't being hit by specific lights I will make 8 or 12, and the ceiling I keep at 16. Again, these are not rules - there are exceptions to this all the time. If you have a spotlight that hits the ceiling then you have to make sure the ceiling has a lower lightmap grid as well - assuming you want a sharp, defined light cone.

It's important to note that lowering the lightmap scale will drastically impact your compile times and filesize. Lower-end computers may also notice a performance hit, but I can never remember why. You get the same effect with high-res textures scaled to lower settings than normal (e.g. .125 instead of Source's usual .25)

Keep your glows subtle. HDR adds an awful lot, so your env_lightglows should be very minimal to avoid MASSIVE BLOOM - a common mistake.

Dustmotes should be kept subtle as well - they're often overused, and at far too high opacities.

A good effect that Valve like to use is the point_spotlight entity. This is what is used to create that lovely volumetric light effect in Source, often used on car headlights in L4D, or combine lights in HL2. However, like dustmotes and glows, it's easy to overuse these!

I'm just back from work so I'm pretty tired. I'll maybe post more later/tomorrow.
Best of luck.

edit:
As for your actual question regarding small rooms and hallways, I can only say again that it depends entirely on the situation. Is it in a house? Then look at how your house lights its small rooms and hallways.
Single light in the middle of the room? Use a light_spot with a tungsten colour temp and a wide cone (innter and outer angle at ~60, 85 respectively) and an appropriate prop to suit. Make the walls lightmap 4, the ceiling lightmap 16 and the floor lightmap 8.

Industrial office? Use a dim, open bulb (2500K temp) and spot it with a blue corner light to break up the monotony.

Get creative! Experiment!
Archie ArchieGoodbye Moonmen
Posted 12 years ago2012-05-24 21:45:22 UTC Post #306463
Thanks, Arch. I'll try it out.

Good tips!
Dimbeak DimbeakRotten Bastard
Posted 12 years ago2012-05-24 22:24:29 UTC Post #306465
Never thought anyone would bring up Planck's law of blackbody radiation in a mapping thread. I like surprises!

Good tips indeed Huntey, didn't know half the stuff you just mentioned. Then again I was never really a good mapper
Madcow MadcowSpy zappin my udder
Posted 12 years ago2012-05-24 23:39:29 UTC Post #306466
Another great article archie! Very helpful! =)
Captain Terror Captain Terrorwhen a man loves a woman
Posted 12 years ago2012-05-25 00:38:01 UTC Post #306467
So, I decided I'd ask the professionals.
You got it. Not wanting to sound like an Archie fan boy but if there's one thing he knows, it's lighting.* Really nice guide :D

*Of course that's not all he knows. He's also good at mapping, editing, camera work, texture work and a bunch of other stuff. He's a bastard like that.
monster_urby monster_urbyGoldsourcerer
Posted 12 years ago2012-05-25 03:18:19 UTC Post #306468
He's also good at [snip] camera work
And this is why whenever I have machinima problems I await one of his responses. Always nice to have somebody here with good cinema experience to understand what I'm talking about or why I want something to work instead of asking me stupid questions. (Why would you want to change FOV? That's stupid!)
Crollo CrolloTrollo
Posted 12 years ago2012-05-25 09:53:46 UTC Post #306472
Methinks Archie should write an advanced lighting tutorial.
Notewell NotewellGIASFELFEBREHBER
Posted 12 years ago2012-05-25 12:49:45 UTC Post #306485
All in favor, say "Aye!"

Aye!
Dimbeak DimbeakRotten Bastard
Posted 12 years ago2012-05-25 16:04:24 UTC Post #306490
Aye!
rufee rufeeSledge fanboy
Posted 12 years ago2012-05-25 16:59:18 UTC Post #306492
Lighting god lives in a fridge.
Posted 12 years ago2012-05-26 06:33:59 UTC Post #306497
You must be logged in to post a response.