Source Filmmaker

Source Filmmaker

195 ratings
How to increase the shadowed light limit
By Kiwifruit and 1 collaborators
Hex editing, ahoy! Change your shadowed light limit from 8 to 64!
What is the shadowed light count limit anyway?

Well, I'm glad you (likely) asked. The shadowed light count limit is a feature in Source games that limits shadowed projected textures (lights) to a lousy 1 for games and in SFM's case, 8 for tools.

Now ever since SFM has released, this number has been static. Games like Garry's Mod allow you to change this value without resorting to literal mods, but SFM has kept its Source ways and it has never been updated... Until now!

(Image by anonymousgamer)

Why would I want to change this value anyway?

Changing this value would allow you to use upwards of 64 (and possibly more) shadowed lights in one scene, instead of being limited by the 8 SFM gives you by default.

What this means is that you can add more detailed lights to scenes that weren't previously possible, since in the past SFM would give you an error dialogue whenever you tried to bypass the limit.

But since this change could now be made, it could be possible to re-create that one scene from Coco everyone talks about, I guess.

Is this an April Fools prank?

Automatic Instructions
How do I change the value automatically?

Ever since this guide has released, the instructions have been manually operated through hexadecimal. Now, thanks to a generous contribution from neodos, it is possible to patch SFM with the press of a button.

Using the SFM Max Shadowed Lights Patcher, all that is needed beforehand is .NET 6.0 for Desktops.

Here's a short tutorial on getting the software running:

  1. Download the .NET 6.0 Desktop Runtime for Windows x64[].
  2. Open the executable installer and install the software to your computer.
  3. Download the latest release of SFM Max Shadowed Lights Patcher[] from GitHub.
  4. Extract the *.zip file somewhere accessible.
  5. Open the "SFM_MaxShadowedLights_Patcher.exe" executable.
  6. Ensure that Source Filmmaker is closed before making any changes.
  7. At this point, it would be wise to back up the following Source Filmmaker files:
  8. Click on the "Select the steam 'SourceFilmmaker' app folder" button
  9. Navigate to SFM's installation directory, this is usually "C:\Program Files (x86)\Steam\steamapps\common\SourceFilmmaker".
  10. Once the path is selected, click "Select Folder" to apply the patch.
  11. Close the patcher software and open Source Filmmaker.
  12. Try spawning more than 8 shadowed lights.
  13. If you can, congratulations! You have patched SFM!

If you come across any errors, the patch was unsuccessful.

Either try again while running the patcher as Administrator, or try the manual patch section below.

You can verify the patch status by navigating to SFM's "game/bin/tools/" directory and ensuring that "ifm.dll" was last modified today.
Manual Instructions
How do I change the value manually?

Well, it's really simple actually. You'll need an external application to do so, and some basic knowledge on hexadecimal vs decimal numbers — but don't worry because those aren't too important.

Here's the holy grail anyways:

Click on this link for memory address information!

Don't get too confused out of the gate though, I'll explain it in detail.

Fine, let's do this!

First, you'll need to install HxD[], a hex editing tool for Windows. This tool will be used to modify SFM binaries, so be sure to back up any files I mention here!

Afterwards, in HxD open the file within Source Filmmaker's installation directory named "client.dll". This file can be found inside of "game/tf/bin/" and it's what handles rendering of the shadowed lights.

Press Ctrl+G within HxD to open the "Go to" window, and paste in the first address from the document. The address can be found here:

B21E3: 07 -> 3F ^ Address, ignore the colon and beyond. B21E3: 07 -> 3F ^ Original value, ignore before and after the two characters. B21E3: 07 -> 3F ^ Replacement value, ignore before and after the two characters.

In this case, the address is "B21E3", so after pasting it in press "OK".

Now you'll see your text cursor move to a new location, select the entire column. In this case, the default value would be "07", so select that from left to right.

Afterwards, type in (or paste) the new value. In this case, the replacement value would be "3F", so type in "3F" or copy and paste it from the document.

See the "INFORMATION" section in the document for what these numbers mean. If you'd like to change the limit to something different, try a hexadecimal converter[] and remember to pay attention to what has 1 subtracted from it.

Repeat these steps for all of the addresses within "client.dll", as in go through the list of addresses within the document above and repeat changing values.

Done already? Alright, now do the same for "ifm.dll", this file can be found inside of "game/bin/tools/" and it's what handles the shadowed light objects.

Oh you're done doing that as well? Well congrats, save your work after making backups and launch SFM (with the -insecure launch parameter). If it doesn't crash, it works. If it does, please look at the "Known issues" section.

Can I get banned for this?

In the off chance that you're connecting to a VAC enabled remote server within SFM, short answer is no.

However, it is highly recommended to add "-insecure" to SFM's launch options just as a safety measure. But please be aware that I have been running SFM without this launch parameter ever since this guide has released and I have not had any issues, your mileage may vary though.

How much memory will it use?

anonymousgamer, a Source Filmmaker enthusiast and the owner of the unofficial SFM Discord, has ran some benchmarks on the impact this fix has on the available memory.

This chart represents the VRAM (video memory) impact over time, from booting SFM to loading a map, and finally spawning the shadowed lights.

Originally posted by anonymousgamer:
red is where i boot sfm
green is where i start loading a map
under yellow is when i start spawning and duplicating lights
each of those stair steps is 1 light
the first one for example is 2964 to 3222mb used
the 3 huge stairsteps at the end are clumps of 8 lights being copy pasted
so 16>24 lights and then 24>32
each copy paste took about the same amount of time except when i pasted 24>32 because i was reaching the VRAM limits of the card (the step isnt the same size as the other 2) which took about 1 second longer to paste
i just pasted 9 more lights and VRAM usage didnt go up
but it did take like 3 seconds for sfm to figure itself out lol
framerate also took a massive [hit]
32 is fairly usable but 41 is horrendously laggy
so yeah it's pretty much down to how much VRAM you have to play with
This is with 8192 res shadows btw
So i assume it scales linearly and i'd have no problem using 64 4096 res shadows

The video card in question is a 2080 TI, however I myself have been using a 1660 Super to some degree of success.

Woah woah woah, that's a lot of steps! Could I just download the DLL files?

I do not wish to distribute DLL files over Steam publicly unfortunately, but I hope you'll find success within this guide as the steps should be relatively clean and easy.
Known issues
I did all of the steps correctly and my game crashed immediately?

Please ensure that "-sfm_shadowmapres" is set to something low, like 4096 (or even lower) in your launch parameters. I've also heard of stories about crashes regarding "-monitortexturesize", so perhaps remove that as well. Try launching SFM again with these new settings to see if the issue resolves.

I need help, I'm not sure what went wrong?

Feel free to contact me on Steam or Discord at @Kiwifruit#2003.

(If those are unavailable, try Twitter)
Wow, it works great! I now have 64 available shadowed lights and my renders look awesome!

I'm really glad to hear that, stranger. If you'd like this guide, I would appreciate it if you could rate it so more SFM animators are aware of this new change. Share it with your friends too!

And if you really appreciated it, maybe consider buying me a ko-fi[]?

Thank you for taking the time to read, and possibly implement this. It means a lot to me! :)
< >
2CoxInTheFox Dec 18, 2022 @ 2:38am 
I couldn't get it to work, the lights were broken after patch :/

also the files that you have to back up are actually located in:

SimonCap Nov 6, 2022 @ 9:07am 
Oh alright
Kiwifruit  [author] Nov 6, 2022 @ 6:27am 
It's related to VRAM and other user-specific configurations, but you can *decrease* the shadow limit when making the patch manually in hex. Other values like 32 or 16 should help. I used 64 (mistakenly) as a showcase, but you probably shouldn't set it to 64. It goes up to 128 though.
SimonCap Nov 6, 2022 @ 6:24am 
Hey, so the issue relating to having shadowmapres on 8192, will you be able to release a fix for that?
MrBeast (real) Sep 1, 2022 @ 6:33am 
в итоге я поломал сфм. теперь вообще не запускается
the sky is green Aug 5, 2022 @ 8:31am 
oh yea seems to be the shadowmapres
didnt know that affected it! thanks for the help 👍
Kiwifruit  [author] Aug 4, 2022 @ 11:00am 
@Hot Dog Hobgoblin might be a VRAM issue, try decreasing "-sfm_shadowmapres" or contact me for an x16 patch
(SFM allocates VRAM based on the shadowed light count, lower values are better - I guess that's why SFM shipped with 8 in 2012)
the sky is green Jun 30, 2022 @ 7:01am 
Using this patch worked pretty well! However for reasons I dont understand (presumably source spaghetti) the max Lighting seems to have increased however it also seems to break? Im not quite sure why
Rev Jun 19, 2022 @ 4:07pm 
Hey there, I'm encountering a bit of an error loop when trying to run the .exe, it tells me to install missing frameworks for .NET when i already did so with the initial error prompt. Tried restarting my computer but no improvements. Anything I can do?
Howl Jun 16, 2022 @ 2:50am 
Insecure disables VAC.