Global Variable question

Nowadays OSL do not support orennayar() bsdf function.
I am i little bit familiar with RSL. For example trying to implement ON model I use this 2 things:


and this shader like a reference http://www.renderman.org/RMR/Shaders/LGShaders/LG_orennayar.sl

So as u understand the main problem is that there is no L(light source direction) vector in OSL Global Variables.
But how can we apply different shading models from scratch in OSL. Help me to BRAKE my old PARADIGM in shader writing.
I see that my question is too “blurry”, but I hope some one who familiar with shader writing will understand me.

You can’t implement new BSDFs in OSL. It’s designed that way. BSDF implementations are meant to be engine-specific.

Thx any way!

By the way, AFAIR in Cycles you get the ON shader by setting a non-zero roughness on the standard diffuse material. Not sure that’s accessible via OSL, but it’s already there, so you don’t need to re-implement it.

Yes, we have an Oren Nayar closure, see also our OSL documentation: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL

oren_nayar(N, roughness)