Fallout New Vegas

File information

Last updated

Original upload

Created by

emoose

Uploaded by

emoose

Virus scan

Safe to use

About this mod

xNVSE plugin that almost completely fixes the exterior lighting bug, and allows up to 4x the number of active lights!

Requirements
Permissions and credits
Donations
Improved Lighting Shaders (beta)
(formerly "Pip-Boy Light Priority Fix")

New Vegas has a lighting problem, for some reason Bethesda limited their engine to a max of 4 lights per exterior cell, which caused a ton of eyesores: lights suddenly disappearing, terrain not lighting properly, lighting flickering as camera moves, etc...
The engine itself actually has room to work with 10 lights per cell, but for whatever reason the code interacting with the shaders (and the shaders themselves) are all limited to 4 lights, who knows why.

But that's all in the past now - this plugin can fix the shading code to work with up to 13 light slots, and also includes 28 re-assembled shaders that make full use of them.

In other words this pretty much gets rid of the lighting bug, and your Pip-Light can shine brightly without interfering with other lights!
Lights besides the Pip-Light are also improved: no more lights disappearing/reappearing depending on your camera position, or lines appearing when a light crosses cells - lights will now almost always remain lit if they're active!

Installation
You should be able to install this fine using MO2 or something similar, otherwise:
  • Extract ImprovedLightingShaders.dll & ImprovedLightingShaders.ini into your Data\NVSE\Plugins\ folder.
  • Extract the Shaders folder into Data\Shaders\, after extracting you should now have an ILS folder inside Data\Shaders\.
  • (If you use Millenia's Environment Map Shader Fix you can grab the compatibility fix from the downloads section)
  • Now run the game, once you're loaded into an exterior cell a "hooked successfully" message will appear in the console to let you know the plugin is active. (interior cells don't need any fix, so this plugin won't affect them)
  • A good place to test this out is the grassy area in front of Gomorrah, but really the whole Strip seems affected.
If you use an ENB make sure UseOriginalObjectsProcessing is set to true inside enbseries.ini - the replacement object shaders used by ENB sadly aren't compatible atm - if you can't change that ENB setting for whatever reason (it might make some ENB settings look bad), maybe consider using the v1.3 "Pip-Boy Light Priority Fix" version of this mod instead. (thanks to Elunico for reporting & Matrimelee for finding the fix!)

Notes
Spoiler:  
Show

  • If your game fails to launch after installing this plugin, try installing the latest Visual C++ Redist (vc_redist.x86.exe) from here: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
  • This includes the functionality of "Pip-Boy Light Priority Fix", so the Pip-Light will now also have priority over other lights.
  • Remember that mods are almost always authored for the vanilla 4-light-limit, and may look different when used with ILS. Hopefully the difference is beneficial, otherwise you might need to ask the mod author about toning down the lights.
  • Only exterior cells are affected by this plugin, interior cells seem to handle lights differently and don't require a fix like this.
As of 1.5beta3 there are now two new scripting/console commands, GetMaxLights will print the current max light count & other INI settings, while SetMaxLights lets you change the light count at runtime - makes it a lot easier to compare between the base light limit (SetMaxLights 4) and the improved one (SetMaxLights 13 - make sure bIncreaseLightBuffers is set to 1 in the INI).
(Note that after using SetMaxLights you may need to move the camera or perform some action for the light data to be updated!)

If you want to test ILS out you might want to try the "slp 0000" command, this'll hide almost everything except for terrain, so you can more easily see how the lighting effects it (recommend disabling collision with "tlc" too). Changing the max lights with SetMaxLights while in that mode should make it obvious how lower light counts can cause those weird unlit artifacts, and how ILS's increased light count almost completely fixes them. To get out of this mode just use "slp 1111"

Technical Info
Source code can be found here: main.cpp / NiTypes.h / ShaderPatcher.cs
Code for the modified shaders can be found in the files section.

The 4 original lights the shaders used seem to be 1 ambient + 3 point/directional/etc, this mod extends the 3 to be 12, giving 13 total lights, hence the 4x claim in the header :)

The 'cells' mentioned on this page refer to the cells used by the lighting/terrain code, which seem to be 1024x1024 units.
Actual game cells are 4096x4096, so I guess these should be 'micro-cells' or something?
It'd be neat if there was a way to resize them, if these cells could be made smaller that'd probably allow more lights on screen at once (since that'd split up the lights among even more cells, and they wouldn't have to compete for the 3-light limit as much), I haven't really looked into that at all though.

The absolute light limit seems to be 13, at least when using SM2 shaders, since 13 lights will fill all 32 shader constant registers. SM3 shaders allow for 200+ constants though, so maybe eventually things could be ported over to there... but I'll leave that as an exercise for someone else :P

Changelog
Spoiler:  
Show

v1.5beta2/beta3/beta4:
  • beta4: now sets up an Opcode Base for our scripting functions (0x3900), should improve compatibility with other xNVSE plugins.
  • beta4: ILS-modded shaders are now stored seperately to vanilla shaders (at Data/Shaders/ILS/), so that vanilla/GECK can still access the original unmodified shaders.
  • beta3: fix off-by-one error when patching light limit, possibly allows an extra light to be displayed.
  • beta3: add GetMaxLights & SetMaxLights scripting/console commands (useful for testing what difference this can make!)
  • Fix artifacts when using less than 13 lights (shader is always set to use 13 regardless of INI setting, so it ended up using random data.. found a way to clear that now though)
  • Minor optimizations: skip some code our hook has to repeat, & slightly improve some looping code
  • bIncreaseLightBuffers: skip some patches that weren't actually needed

v1.5beta:
  • Updated shaderpackages to support up to 13 lights per terrain-cell.
  • Now includes an INI to tweak various settings. Defaults should be the safest to use, but lights can be expanded even further by taking a look at the INI file.
  • Added patches to make the game use an expanded light-data buffer, with this in place 13 lights should be reasonably stable (at least, I didn't have any issues using it).
Expanding the light-data buffer requires over 100 patches to the game to work though, in my own testing it seemed stable enough, but others might run into something unexpected.

Enabling these patches is optional however - but if you do try this option out and notice anything strange happening please let me know about it!

v1.4a:
  • Now includes updates for all the other ShaderPackage files, no longer needs to force 019!
  • Fixed a very tiny bug inside SLS2097, revealed by automated shader patcher, oops...

v1.4beta:
  • Initial release, would force using ShaderPackage019 since that was the only one I'd updated so far.


Support
I've setup a ko-fi page here, if this mod helped you out your support would be greatly appreciated!



Thanks
Thanks to korri123 & the xNVSE team for being so generous and continuing work with xNVSE, you rock!
Also thanks to TrueCourierSix for letting me know about JIP LN's source code, and jazzisparis for making JIP LN!
Many thanks to KiCHo666 for their Millenia's Environment Map Shader Fix mod, and allowing for a merged ShaderPackage to be made!

Other titles
I've also made graphics fixes for some other games too, feel free to check them out!
LodMod for Yakuza 0: https://steamcommunity.com/app/638970/discussions/0/1743343017611794579/
LodMod for Yakuza Kiwami: https://steamcommunity.com/app/834530/discussions/0/2800630252895668904/
Dragon Quest XI S: https://steamcommunity.com/app/1295510/discussions/0/3117025249764261520/
NieR Automata LodMod:
https://www.nexusmods.com/nierautomata/mods/165