Hello,
We want to do some custom, unconventional shadowing methods for stylized hair, wherin only every Nth hair casts shadows depending on its ray depth. For example, if n==4, when a ray of light enters the hair, the first 3 hairs would not cast shadows, the 4th would, then the 8th, then the 12th etc.
Is this possible? One approach would be to write an OSL shader that casts a ray towards the light, counts how many surfaces are in between, and only casts shadows if (nsurfaces + 1 ) % n == 0, but:
a) I'm not actually certain how OSL would count surfaces in this manner, other than using a series of `trace()` calls, each starting from the previous hit;
b) it's not clear how this would actually control shadow visibility, given that aiStandardSurface doesn't have a "shadow opacity" parm for this to plug into;
c) the shader would have to know the position of the specific light to cast a ray towards;
d) it would only work for direct illumination.
So, I'm not terribly hopeful that this is possible, but thought I'd ask.
We're using Gaffer and custom OSL shaders, as well as the OSLCode node.