Fallout New Vegas

File information

Last updated

Original upload

Created by

stoker25

Uploaded by

stoker25

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
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, random polygons going unlit, 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, god 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:

  • If you have the older "Pip-Boy Light Priority Fix" installed, remove it & PipBoyLightFix.dll from Data\NVSE\Plugins\ 
  • 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)
  • (If you use any ENB please read the Notes section below)
  • 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.
  • (a good place to test this out is the grassy area in front of Gomorrah, but really the whole Strip seems affected)

If you like you can edit the ImprovedLightingShaders.ini file, the defaults (8 lights) are reasonably safe/stable, but could still cause some lighting cut-offs. The INI describes how you can tweak it further, up to 13 lights. The included shaders will work fine with all settings.

If you notice any strange artifacts, try setting bIncreaseLightBuffers to 1, if artifacts still appear try increasing iMaxLightCount to 13.
After that if you still have any strange issues with both of these settings in place, please let me know about it!

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"

Notes:
  • 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. (thanks to Elunico for reporting & Matrimelee for finding the fix!)
  • If you can't change that ENB setting for whatever reason (it might make some ENB settings look awful), maybe consider using the v1.3 "Pip-Boy Light Priority Fix" version of this mod instead.
  • it won't have the full effect of improving all the lights, but should help improve the Pip-Boy light at least (which is probably the worst offender when it comes to lighting bugs).
  • This includes the functionality of "Pip-Boy Light Priority Fix", so the Pip-Light will now also have priority over other lights.
  • Like mentioned above, make sure to remove PipBoyLightFix.dll & any other shader-replacement mods (if you do use any other shader replacement mods let me know about them and I'll try getting them merged)
  • 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 a lot better and don't require a fix like this.

Changelog:

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.
  • (If you're upgrading to beta4 I recommend replacing your Data/Shaders/ folder with the original shaders, they can be found in the files section, or use shaders from Millenia's Environment Map Shader Fix)
  • 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:

Alternatively if you want to help support me, a comment or your endorsement would be 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!
Big thanks to KiCHo666 for their Millenia's Environment Map Shader Fix mod, and allowing for a merged ShaderPackage to be made!

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