Author
Topic: Are Transparent "Fake" Shadows do-able with a ShadowHelper and a Shader? (Read 1958 times)

I've got cast shadows with a ShadowHelper and a Shader working, but the shadow is always a solid non-transparent color.

Here's a screen shot. The facial image is the caster and the grass below is the receiver.

Is it possible to make the cast shadow a partially transparent color?I would like to make the blue shadow coming behind the portrait appear to just "darken" the grass behind and leave the tiling intact.

The ShadowHelper itself renders the scene three times. One time from the light sources into the depth map (you seem to have that working), one time receivers only from the camera with a dark ambient light only, then with full lighting the depth map projected into the scene. When using a shader, it should be possible to combine the last two steps. I assume that your shader already makes a comparison of current depth to projected depth map? If you, all you need to do is to render the pixels where the current depth is larger (i.e. where your background shines through now) in a darker color instead of not at all.

The default ShadowHelper might not be the best choice to accomplish this. If you need it, i can post the sources of the ShadowHelper to ease the creation of a shader based variant.

In the current state, you can't make an object that uses a shader a shadow receiver, because the ShadowHelper relies on some fixed function stuff that you would have to mimic in the shader. This is on my todo-list, but it might take a while before it will happen.

As per your info in the previous post, I changed my code so that the groundPlane ( i.e. the grass ) no longer gets any shading.This appears to have worked. I now have a cast shadow that blends with the receiver's texture rather than replacing it.

This is using solely the ShadowHelper/caster/receiver semantics from jPCT.