Half-Life 2

Half-Life 2

59 ratings
Fixing Shadows (lights.rad)
By мяFunreal
HL2's lights.rad is incomplete, so many fences throw solid shadows.
This guide has the fix and shows you how to install it.
2
   
Award
Favorite
Favorited
Unfavorite
Foreword
Have you ever made a map with a fence and a light and then noticed that it looks like this?


Not every fence does it. But models/props_c17/fence01a.mdl does.
Some plants probably do it as well.

Now what causes this?
Every source engine game has a file called Lights.rad.
This file defines what models should have shadows based on its transparency.
But this file is missing various models, so it just does not compute proper shadows.

This means we need to add all the props that should have shadows to this file.
Unfortunately for us, the original lights.rad for EP1, EP2 and LostCoast are inside a vpk.
If we wanted to edit the original file, we'd need to repack the entire content of that vpk.
But that is painful, so we'll instead add a completely new one and always use it along the original.

So, let's get started.
Video version
I made a video version of this guide if you'd prefer watching it.
But if you prefer reading, just scroll right past.

The video mentions to get files from this Github Page[github.com]
Setup
First, we need to make HL2 load a new folder, in which we will place our rad file.

Step 1.0
Go to where Half-Life 2 is installed on your machine.
Same folder as "hl2.exe"
Create a folder called "vrad_fix"


Step 1.1
Inside this folder, use the search function of your pc to look for "gameinfo.txt"


Open all of these in your text editor.

Step 1.2
In every single gameinfo.txt, scroll down until you see the SearchPaths


Right below the opening bracket {, add the following line:
game vrad_fix


This will make the game load data from the "vrad_fix" folder.

EVERY SINGLE GAMEINFO NEEDS THIS!
Even the ones you may have previously added yourself, for map specific content.

Install
I've made two Lights.rad files, which can be found on my github here[github.com].


"Bigger_lights.rad" Contains only the models that had "Fence" and "foliage" in the name.
"HUGE_lights.rad" Contains every model except weapons and animation models. Lmao.

Generally, "Bigger_lights.rad" is good enough. But if you spot a model that for some reason still has solid shadows, you can use the "HUGE_lights.rad" to make sure that every model has correct shadows. But that could perhaps make compile times longer than you want.

But it would only compile shadows on static props anyways, so it won't be that bad.

Step 2.0
Download one, or both of those rad files to that "vrad_fix" folder.


Its in a zip file, so unpack it.



Usage
I think you know how the proper light compile settings are. But i'll show you anyways.

Step 3.0
In Hammer, press F9 to compile the map and pick expert compile settings.



Click the "Edit" button and pick any of the prefabs you want to edit, then copy it to alter it.
We're doing it like this so you have setups for both rad files, along with the original ones.


Step 3.1
In the $lights command, use the following text to get the correct light compile settings:

-lights Bigger_lights.rad -hdr -TextureShadows -staticproplighting -StaticPropPolys -game $gamedir $path\$file


Note:
The line you copied up there ONLY has -hdr.
That means "Low dynamic rage" is not compiled.
I am doing this on purpose just so i can compile tests way quicker, because i play in hdr.
No need to compile both ldr and hdr together just for tests.

If you do final compiles you need to use -both -final instead of -hdr.
Or if you play on low settings, you need os use -ldr for test compiles!

Authoring the graphic settings here is up to you!

Step 3.2
If you want to use both rad files to switch between, you can just add yet another lights line.
You can toggle which to use by clicking the check boxes. I prefer it that way.

Click the "New" button and populate the fields with the same data, except for the other .rad.


Yeah that's it. You're done now.
Compile with either of these rad files being active and you're good to go.
Not both at once, else it'll just run vrad twice, which does nothing but waste time.

Closing words
Now you can compile with these new rad files, whichever you picked, and the shadows are fixed.


Funny how Valve celebrated a 20 year anniversary of Half-Life 2 and never fixed this thing.
Good thing unpaid modders do it.


Should you need help with this modding, join the "Dead 4 Mods" Discord Server[discord.gg].
There's a few members, including me, who can help you out.
If you join and immediately DM me, i'll ignore you. Use the designated channels.

I have my own Discord Server[discord.gg] if you'd like to hop in and chat.
I sometimes post WIP images of what i'm doing, but it's mostly memes.

I also got Paypal[paypal.me] for don't-ations.