So I'm trying to find the pixel of a big bg image related to the pixel of another image on top of it.
In the example image. The dotted grey line around the shadow is "how big that image is"
What I'm trying to accomplish is choosing whether to use the shadow pixel or the pixel of the image below it (doesn't have to be a bg just using it as an example)
the shader should be giving me the texCoord of the shadow pixel (as I will run the shader on the shadow itself) but then yeah, I need to find the same pixel UNDER the shadow to compare the two on whether or not the shadow should show up.
I tried solving the lerp equation to give me the percentage as this:
output = a + (b - a) * %;
1/% = a + ( b - a) / output
but I'm not sure if that's correct and where I would plug the texCoord in either...
Anyone got any idea?
Say I have a 1000w x 200h bg image. starts at 0,0
my shadow is at 300, 250 and is 20w,10h
how would I find out the percentage across the bg that the shadow is so i can try to find the same pixel under each shadow pixel?