OSL and weird glossiness values for vray_cooktorrance()

Hi,

I’m getting some weird results with high values of reflection glossiness with vray_cooktorrance().

If you set the reflection glossiness to 0.996 you get sharp reflections which is great. But then if you use a glossiness value of 0.0997 or 0.998 a dark edge/ring starts to appear around the mesh (I’m looking at a shader ball). And finally, if you set the glossiness value to 0.999 or 1.0 the whole reflection disappears. Is this expected behavior?

Right now, I feel I must clamp the value of the glossiness at around 0.996 to not create confusion.

Here’s my shader: https://raw.githubusercontent.com/fredrikaverpil/osl-shaders/master/vray/ir\_generic\_material.osl
Please note you need to set the texture sliders manually because they all default to color(1.0) right now…

Well, when highlight/reflection glossiness values creep towards 1.0 some limit conditions occur, so in a way … yes it is expected behavior.
There are some options here:
1. As you suggested clamp the input values to meaningful ranges.
2. Replace the closure with pure specular reflection when some border value for glossiness is reached.

Hope I helped here.

Best regards,
Ivan Mavrov

Okay, great. That helps. Thank you for clarifying!
I think your second option is the best one.