I have create some shaders for my Decal System (Pro) which support realtime shadows. I have tested them in many different scenarios and haven’t found issues so far. As I don’t consider myself a shader expert, I am making this pre-release before the shaders will be shipped with my Decal System (Pro).
Another addition is a parallax shader and certainly a variant with realtime shadows.
Feedback is highly welcome! I am curious to hear your opinion and certainly if you know ways to improve them!
Known Limitation
Those shaders only work if the decal projector is placed on top of a mesh/skinned mesh/terrain which uses an opaque shader.
As with any other shader, dynamic shadows in combination with baked lightmaps only work if Dual Lightmaps are used.
Check it out! It is not too funky…
I just used the default shaders, added some tags, such that the decals receive Unity’s shadows. As such you don’t have additional settings.
Ooh wait a minute. I think I got you wrong. I thought this is a replacement for Unity’s shadows, but it seems that you just added shadow support for your decals.
Yes, that’s it. As I said, it is not too funky. But it is also not that easy to get shadows on transparent shaders. I am not 100% sure if they work reliable under all circumstances. That’s why I have posted them here to get feedback.
Looks like there may be some issues with it. I changed the material of my atlas to use one of the shadowed colored transparent experimental shaders.
The weirdness is the fact that the shaders never seem to light up when hit by a light source. They always appear the same as they are no matter the light condition. Those are realtime shadows you see in the scene by the way.
@Rico21745, are the gray rectangles the decals? I hope you don’t mind if I ask a few questions. This will help me a lot to identify and hopefully to resolve the issue.
Do you have any lightmaps in the scene? Did you try if it works in a clean scene? E.g. by just have a directional light and two cubes where one is in the shadow and then placing a decal half in the shadow and half lit.
Yeah the dark rectangles are paper decals that are being blackened by the shader (they should appear white like paper). I’ll try to run a test when I get home on a clean scene. There’s no lightmapping in that scene, all real time and ambient lights.
Ok I had a chance to test it in a clean scene and it still appears to be happening. It’s almost like the decals are always in the shadowed state, no matter how much light hits them.
If it helps, I’m using deferred rendering on my camera.
Looks like it’s DX11 mode in Unity. If you switch platforms to PC Mac and then enable DX11, then restart the Unity editor, you should be able to reproduce the issue. Let me know if you still need me to send in a reproduction, but that should do it, I just got it to happen in a brand new project.