Pretty much as the title suggests. I’m working on AR apps, and I would like to be able to create the illusion of virtual objects casting shadows on the real world. However, none of the transparent shaders (nor the Depth Mask shader from the QCAR package) receive shadows. How can I add the ability to receive shadows to an object that is otherwise invisible?
(I did try turning “Lighting On”, but it appears it was not to be so easy)
Shader "DepthMask" {
SubShader {
// Render the mask after regular geometry, but before masked geometry and
// transparent things.
Tags {"Queue" = "Geometry-10" }
// Turn off lighting, because it's expensive and the thing is supposed to be
// invisible anyway.
Lighting Off
// Draw into the depth buffer in the usual way. This is probably the default,
// but it doesn't hurt to be explicit.
ZTest LEqual
ZWrite On
// Don't draw anything into the RGBA channels. This is an undocumented
// argument to ColorMask which lets us avoid writing to anything except
// the depth buffer.
ColorMask 0
// Do nothing specific in the pass:
Pass {}
}
}