I’m making a game where almost everything is self-lit by their baked textures, rather than lamps. The texture structure goes like this:
Layer 1: Base lighting, mostly AO and Ambient Lighting.
Layer 2: Main Lighting, lights from main lamps, shadows, etc.
Now, I have a spotlight that casts light onto my game character, and casts a shadow onto the level. Unfortunately, the lamp also brightens the already lit level when creating shadows. What I want is for the light to illuminate and cast a shadow on the character as usual, but instead of adding to the illumination of the level, I want the shadow to subtract from the second baked texture level, leaving only the first layer, or base lighting behind. This way, my character will only cast shadows in the directly lit areas of the level, and not in the dark parts as well.
I assume I need to use a python script to achieve this, maybe GLSL idk. Can somebody help me come up with a way to achieve this effect?