Are Transparent "Fake" Shadows do-able with a ShadowHelper and a Shader?

Started by kburden000, March 12, 2012, 05:28:54 PM

Previous topic - Next topic

kburden000

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.

If yes, a hint about how to do it would be appreciated.

Thanks

EgonOlsen

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.

Thomas.

Quote from: EgonOlsen on March 12, 2012, 08:27:59 PM
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.
How complicated is port it to jPCT-AE? :)

kburden000

I can see that Shadows work in AdvancedDemo. Sorry they looked opaque black until I looked closer on a better monitor.
I just hopefully figure it by dissecting the Demo.
Thanks for your time

EgonOlsen

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.

kburden000

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.

Here's a screenshot...


Thanks Egon.