I bumped into a roadblock with my surface shader recently. What I'm trying to do is generate a matte of the shadow being cast on the surface (in a scene with maya light shaders). Essentially, I'm trying to replicate maya usebackground shader functionality in producing shadow mattes.
Problem is, I don't know how I can get any shadowing information reliably. I tried working with luminance of light color returned by mi_sample_light, but, if a light was textured, dark areas of the texture would get falsely interpreted as a shadow. Trying a probe ray to determine occlusion isn't the way out either because maya lights can produce fake soft shadows, that a probe ray can detect.
So I'm really trying to know if there's any reliable way I can find out if a sample is being shadowed. And owing to the complications of my setup, I can't just use the usebackground shader directly .
Any hints/assistance is much appreciated!