Hi,
im trying to write a simple OSL shader to work with vray 3ds max.
The shader im after is simple, diffuse with reflection using cooktorrance BDRF model.
And another shader using orennayar model.
These models are normally locked in vray in 3ds max, but are available in osl. Anyone know how to code these two shaders up?
Thanks instinct,
im not really good at coding, how would i apparch this? from a diffuse material template example? then add in each aspect?
The only example i can see is the “plastic.osl” with closure, would it be a case of replacing the phong with cooktorrance?
how would i add in cooktorrance closure?
As you suggested lets use “plastic.osl” as a code donor.
The phong(normal N, float exponent) and vray_cooktorrance(normal N, float glossiness) closures have the same signature, and both support the “trace_reflections” keyword parameter so you can in fact just replace “phong” with “vray_cooktorrance” and the shader should compile. It is just that the second argument for the Phong closure expects an exponent value (for example 1, 80, 400, …) while the Cook-Torrance one expects a glossiness value in the [0, 1) range. And I suppose that’s about it. See if it works for you.