Hi
1. Recreate diffuse shading with VSL, adding only curve control. I guess everyone has done this.2. Create an analytical sphere, which is cut in half by a cube, making ita hemisphere. 3. Set the analytical sphere to hollow and put a lightsource inside it, just to make sure lighting is done correctly, to illustrate this point.When rendered without the material, only the inside is lit as expected. Applying the material will render it all black?I could not duplicate the problem. Here's my minimally simple test material:COLOR mydiffuse=r,g,b surface properties color=0,0,0 /* Default diffuse off */ surface illumination FLOAT k k=multiply(light:ray*normal, surface:ray*normal) if(k>0) /* if light and camera see the same side of surface */ COLOR tmp k=fabs(light:ray*normal) /* Eliminate sign issue*/ k=curve(k) /* weight by angle */ tmp=multiply(mydiffuse, light:illumination) surface:illumination += multiply(tmp, k)The structure is pretty much the same as in the simple example materials such as the silk. Instead of using fabs of the ray*normal, one can naturally use a curve that defines a zero centered symmetric weight for the parameter range from -1 to +1 . This simplifies the shader but keeping the curve symmetric is a little bit extra work for the user.I suspect that this is nothing new for you, so please send me a test file if the problem remains a mystery.Best regards, Vesa
Yes, thank you very much. That does indeed explain a couple of things for me :-) I did check the silk material but found that it was view dependant, so it wasn't a true diffuse material. All the materials I checked that uses the first k=multiply(dot dot) stuff are recreating specular effects rather than diffuse. So I always figured this check wasn't needed for diffuse shading. Silly me.
My attempt (somewhere based on Andy's tutorial) went something like IF<0 dot product(light:ray, surface:normal), then do the needed shading. Apparently, and now obviously, that wasn't enough :-) It does work for "normal" cases, but not on hollow cutted objects.
The silk material differs from the one you have above in that it uses the same k from the multiply operation instead of taking a new light:ray*normal (* means dot in this case I assume) after the direction check; thus it became a specular effect.
But it all works very well now, thanks. And I thought I was finally beginning to come to grips with the dots and angles ;-)
The attached image shows the results of a whacky curve controlling the diffuse (just to clearly show shading center offsets), plus a curve specularity, and a modified silk, on top of eachother. This is how I came to the comclusion that silk material was a specular material rather than a diffuse one (since it's circle shows as a "reflection" for position).
Regards Karl
<<attachment: Diffuse_Curvespec_Silk.jpg>>
