PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Projected Textures for Directional Lights may not render correctly when Effects are active. #11

Closed PrismaticFlower closed 5 years ago

PrismaticFlower commented 6 years ago

In order to provide reasonable results from the stock per-pixel lighting shader (which also handles normal mapped objects) Shader Patch uses a hack to output only the diffuse colour and shadow from the normal shader when it is being ran for blending with perpixel lighting.

The game normally calculates additional lighting information for the object in this pass, however when working in a linear colour space this causes objects to appear darker than they should, as a result when the effects system is active the extra lighting information is thrown away. Unfortunately this is also where the game would calculate the lighting for a directional light with a projected texture, resulting in the light not showing up at all for the object.

Fortunately since the effects system requires explicit activation by a map this is not much of an issue and as such it is not worth while to find a workaround. Furthermore very few maps (at least I've encountered few) use directional lights with projected textures.