Viewmodel Shading Fix - FOSE

Summary
Mod fixes totally wrong specular lighting, and lack of muzzle flash lights on viewmodel.
Tags
Languages
Any


What?
I'm on a roll with viewmodel fixes.

When Bethesda tried to mitigate floating point precision loss on viewmodel by shifting local playet position, they added a mechanism to shift lights to accommodate that position change.

As we know, that thing didn't go according to the plan. So you shouldn't be surprised if I tell you, that this light offset is also broken.

While lights get correctly shifted, the eye position is not (oddly enough it is calculated correctly in Lighting30Shaders, which are used only for decals). This means that you get correct diffuse lighting, but totally incorrect specular highlights, rendering (literally) weapon super dull and often dim. If you often wondered why weapons look flat - that's why.

The other issue is exact opposite - while eye pos was missing the offset, lights attached to the player are missing due to having the offset. This means that muzzle flashes, or any other light attached to viewmodel nodes, would not cast light at the player.

Both issues, fixed.

Requires sunlight fix for it to make sense outdoors.

Pizza


Source Code
GitHub
Credits
Hitman47101