Cycles and OSL Render - Weird Seam I'm trying to make a rock stick out of the sea, and want to blend from a wet rock to dry rock using cycles nodes.

I use a mix shader to blend between two shaders based on the Z position. The mix factor is obtained by calling smoothstep in an OSL script.

My node setup is like so:



However, for some reason I'm getting a sharp seam along Z positions where the blending ends:



Anyone know what might cause this, or how to fix it?

Thanks!
OSL Shading issue with Diffuse Roughness > 0



By dupilcate the Diffuse shader as in the node setup belowe an lowering the amount of the second Diffuse Roughness to something like .95 you should get the expected result.

There seems to be an issue in the usage of that parameter. It leads to strange behaviours. Note that if you don't double the node but just try to lower the Roughness of the Diffuse shader node, you'll need to set it lower than 0.5 to achieve the given result.





Notice that is not related with the use of the OSL script because it still happens even with default nodes...



..when the same scene, rendered with OSL Shading disabled, gives expected results.