Hello,
I want to achieve a lighting/shadowing effect for a 2D game I’m doing, a kind of lightmap.
I have the following texture:
My idea is that blitting the left part of the texture over a patch of grass, it’d render the tree shadow making the currently rendered background darker. But the right part, the “window light” could be rendered in the interior of a building to simulate light lighting up the floor.
When the RGB components of the texture is 128 there should be no shadow nor light, so the current background should be kept intact.
My question is: Is there a BlendState configuration capable of performing those operations? (darkening when close to 0, lighting when close to 255, leaving background intact in 128). I’ve been trying several configurations but I’m unable to get one working.
note: I know I can do this in two steps, but I’m curious to know if this can be done with a single BlendState, as I could render all shadows and lights with one batch instead of two.
thanks!