{help} Turning cycles' node in to OSL problem

I’m tryng to turn blender cycles’s node combination into OSL code ( for easier presentation)

for this example,I want to turn a simple diffuse+glossy shader with normal in to a OSL coding, but how can i turn Fresnel,bump etc node into OSL language? I need help

*/ // Material input

shader diffuse_material(
    color Diffuse_Color = color(0.8,0.8,0.8),
    color microfacet_color = color (0.8,0.8,0.8),
    float Diffuse_Roughness = 0,
    float microfacet_Roughness = 0.05,
    float mix_factor = 0.05,
    normal normal_input = normal(0,0,0), 
// Material BSDF Output
    output closure color BSDF = 0
    BSDF =  (1-mix_factor) * Diffuse_Color * oren_nayar(normal_input, Diffuse_Roughness) +  mix_factor * microfacet_color * microfacet_ggx(normal_input, microfacet_Roughness);

Basically every cycles’ node in OSL:


normal normal_input = normal(0,0,0),


normal normal_input = N,

hey, i am making a shader but get confuse with

  • microfacet_beckmann_aniso(N, T, ax, ay)

what is the input of ax and ay? i try float, but the model comes black

it’s working for me :confused:
ax and ay should be any float between 0 and 1, and they represent the roughness width in the x and y axis of the tangent space.

and the ashikhmin_shirley(normal N, vector T,float ax, float ay) also works.

Do you have the tangent vector connected? without it the shader won’t work.

It works! is it really necessary to input the tangent? because you don’t need to input tangent when you use aniso bsdf in cycles