LOD Fixes and Improvements - NVSE

Summary
Mod focused on improving various parts of game's LOD system, removing node, texture and material limits, adding animation and specular support, and fixing tree LOD.
Tags
Languages
Any
 

What?
Vanilla LOD system is pretty jank like all Bethesda code, with lots of elements being hardcoded. Goal of the mod is to change that.

First issue - NiGeometry can handle only 65536 vertices due to using a 16 bit value to count them. Normally it's pretty rare to hit this limit, but in case of LOD blocks, which are created from lots of other meshes, it's very easy to go way past that number.
LODGen is meant to handle such cases - it splits the "overflowing" geometry into a new block. Unfortunately, only Skyrim and upwards can load all blocks - FO3/NV only load the first one, meaning you will get broken LOD in these cases.
Not anymore!
Now there can be as many blocks as you want, meaning texture and geometry limits are a thing of the past!

This also means you can treat LOD files (the final ones) as any other nif - it can contain multiple shader properties, geometries and even animations. 
(Sounds exciting but in reality this means that you'd have to edit LODGen output files by hand, since LODGen does not support any of these things and will destroy them if used in _lod.nif files).
Blocks with "Ignore Fade" flag will keep rendering even if cell is loaded.


Another issue is - Object LOD does not support specularity - it's force disabled. This mod adds an option to enable it if you happen to have LOD that has specular textures.


Now the Tree LOD, which is supposed to "be broken by Obsidian when updating SpeedTree".
Bah, it's far stupider than that - Bethesda added a pretty dumb way to handle Tree LOD for Point Lookout in Fallout 3, where they change the plugin index of every tree coming from a plugin with masters. 
(It's a turbo hacky solution to handle cases where Point Lookout is installed without other DLCs)
This caused issues with Tree LOD in TTW (oh the irony), and probably FNV's DLCs.

This mod restores the original release Fallout 3 behavior of using proper FormIDs, which fixes Tree LOD unloading. Due to how system works however, this means that your generated Tree LOD is very tightly attached to your plugin load order, meaning every time you move plugins with trees around, you need to regenerate Tree LOD. (great system)
Since 1.1 mod supports both behaviors, meaning that everything works out of the box.

Other fixes
- Water LOD using incorrect height for its multibounds, leading to water planes getting culled at incorrect angles.
- Object LOD in the loaded area being missing in low detail water reflections.


Questions that I'm sure will be asked
- Add emissive support to LOD?
- Game already supports that - LODGen is the one removing it.

- Add vertex color support to LOD?
- Use latest LODGen beta.

- Add env mapping support to LOD?
- Game already supports that - LODGen is the one removing it.

- Add parallax support to LOD?
- No idea why would you want that, but anyway, game already supports it - LODGen is the one removing it.

Source Code
GitHub
Credits
NoBarkNoBiteNoonan for pestering me about Tree LOD
Bethesda for making the jankiest code I have ever seen
Everyone who told me it's impossible
Everyone who told me LOD doesn't support X thing