I was reading up on how shadow mapping works. We create basically a depth map from the light’s perspective and if an object is in the way then we make the fragment darker on the object behind the first object. For that you need a) the light source, b) an object and b) some other object on which the shadow is cast.
But I wonder if I can do the same shadow mapping but with just one plane object and cast the shadow on itself.
I have a plane that is showing a terrain using tiles. Each quad of the plane have a different terrain tile. But there is also a z component that is simulating the depth of the terrain. Currently all I do is to add an alpha value so that the greater the z the darker the tile is drawn. For example, z=0 is alpha=0, z=1 is alpha=0.3, z=2 is alpha=0.6, and so on.
To show the depth better to the user I want to add a shadow.
For that I was thinking that I use the same shadow mapping technique. I create a depth map not from other objects but from the alpha value of the fragments on the terrain.
Then alpha=0 would be solid and would cast a shadow “down” to the tiles on the same object.
Is that even possible?
Was something like this done before and I could read somewhere how somebody else done it?
Google is not really a help because I only find descriptions the normal shadow mapping technique.
I did the example in Gimp how it should look like.