Welcome,
< test subject name >

Name:
Pass:
Remember me

Apply to become a test subject.
I forgot my password

Donate!

Source SDK — Shadows/Lighting

How this can help you

I’ve seen plenty of maps where the shadows/lighting is very unprofessional, so I want to help you out. Some shadows in some maps shadows look a lot like from Half Life 1. There’s a way to make it look like it is a game from the new era of video games, and its called lightmaps.

Lightmaps

These are supposed to be a sort of measurement of how good a shadow looks. There’s a whole article on it on the Valve Developer Community Wikipedia, but I’m here for those who don’t want to go there to figure it out because they may not know what to look specifically.

Anyways, lightmaps are seen on the sides of the blocks you create in SDK. You can see them specifically by going to the upper left of the 3D viewport and selecting the 3D Lightmap grid to see the actual Lightmap grid.

The areas in white/blue have the Lightmap scale of 16, which is default. The areas in yellow/blue have a Lightmap scale of less than 16. Areas in light blue/blue (not shown) have a scale of higher than 16.

In short, Lightmap scales of less than 16 will have better shadow detail than higher values, but require more info from the computer to render it, thus making the file size larger and compile times longer. I suggest that you change the value of lightmaps on a wall/area with no detailed shadows or completely covered in a shadow to a higher scale, like 32, 64, or even 128, but any higher than that is pointless. Areas with detailed shadows would have a lower value, like the shadows that cast from an observation room would have 3, 5, or 8, so the shadows would be detailed, but realistic. Sometimes higher scales are more realistic, since lighting isn’t always direct, and would cause soft shadows, and then higher scales, under the value of 16, would show this example well.

To change the value of a Lightmap scale on a side of a block, for example, just select the Toggle Texture Application tool (shift + A, or the block to the left of the screen with multiple textures on it).

Then, select the area where you want to change the Lightmap scale; it will show up in red.

Next, change the value of the Lightmap scale as shown.

And there you go! You determine how well shadows cast onto specific areas just by following these steps. So, now that you can do this, lighting shouldn’t be too hard to understand, it’s actually pretty easy. Unfortunately, the Lightmap scale cannot go lower than one... Besides, it’s not like shadows with that much detail isn’t good enough; actually they look a lot like dynamic shadows.

Dynamic Shadows

These are shadows cast by players (in multiplayer games), NPCs, dynamic props, and physics based props. Usually, in Portal, they face directly downward, but they can be changed with the use of Shadow Control.

It’s an entity that allows you to change the angle that shadows cast, how far they can cast, and what color they are. You can change these around however you like, and change them while ingame with the use of triggers, that ways, when you enter an area, something happens, like changing the angles shadows make, so that ways, you’d be inside, so the shadow would be directly downward, but once you’re outside, the sun casts light at an angle, and the shadow will be realistic and align with it.

Discuss this article in the forums!