Shadow catcher setup

I wondered if there is a way to create a material or other workaround for a plane to catch shadows, but be invisible in game?

I am not sure I understand what is this for ? Could you be more specific?

ill try my best to explain. I want to make an object, which sits on a plane in editor and casts shadows on the plane. The thing is, i want the shadow to be visible in-game, but not the plane which the shadow is cast upon.

But how or why would the shadow be visible if the surface it’s on is invisible? I don’t get it :slight_smile:

Or do you want to have that plane invisible everywhere else where it’s not shadowed but visible only where it’s shadowed?

Basically you want a dynamic alpha mask which will be updated every frame so that you’ll see only the shadow…well, good luck with that!

You can try to take a look at the shadow of the car which is included in the Showdown demo, if I remember correctly they do some kind of dynamic shadowing or something similar.

It would have sort of an alpha channel aplied to it… it would work like you mentioned, visible only where the shadow is.
here’s a tutorial on it in corona Corona Renderer shadowcatcher tutorial - Evermotion

Ooohhhh, you’re trying to do compositing in realtime…well, that’s why is called compositing :smiley:

In realtime you need to find some tricks to make it work…one way would be to get rid of the plane and completely squash on the Z axis a copy of the mesh itself, then drive the X/Y scaling using the orientation values of the sun itself…it’s math, nothing too fancy, but I guess that you’ll have problems with the double faces of the mesh itself…a completely black material should do the trick, not sure if with different variations of black you’ll have compenetrating faces issues…but you can give it a try.

If you want to go with a masking option I suggest you to get a screen capture cube, get that into the material editor of the plane, and then try to mask out the results from the scene reflection, but I guess it’s quite hard to do that, but you can sure give it a try :wink:

I was thinking, if i can get to the lightmap of the given plane/surface and use that to control opacity. (i don’t need dynamic features for now). Could it be possible?

Just used a gradient black and white map for opacity on the plane - got sort-of the desired look.

But the discusion is still open in my opinion, if there is a way to get only shadows the way you can for compositing.

Could be, but as far as I know you can’t override the lightmaps…and even if you could every time you’ll build the lighting you need to swap them…and if I remember correctly UE4 will compact the lightmaps together so no, not possible…but I could be wrong about that