2013/05/22

PYLA : The PhYsically correct LAyer shader

Working with layers in shading is simple and powerful.

You can design your shader exactly like the real ones : you apply a 'base', and then add layers, like colors, polish, coating, etc.

Maxwell Render is working like this for a long time. Now, Mental Ray introduces 'MILA', which also offers this way of working.

I've shown Layers in Cycles during last Blender Conference, in October 2012. So, here is PYLA, the first OSL version of my layering shader!

PYLA stands for 'PhYsically Correct LAyer Mixer'

This shader is a Physically Correct Shader Mixer for layered Materials. It simulates materials made of multiple coating, or layers, like car paint, polished nails ...

This is a very simple shader, but very powerful !

You could better manage your mixed Materials, in more realistic way, and with better results.

Download : PYLA Shader Layer with OSL


PYLA OSL Layer Shading from François Gastaldo on Vimeo.



documentation :
INPUT :
Base = the base shader, the layer will come on top of it.

Layer = the layer Material.
You can use any shader, except tranparent or glass shader.
Pyla is a mixer, and not a real layer simulation, so tranparent shader should give unwanted results !

Opacity = between 0.0 and 1.0, 0.0 = no visible layer, 1.0 = full effect.

Depth = the depth of the layer.
The thikker the layer is, the less you could see the base. value between 0.0 to 10.0, good value : 2.0.

Fresnel = Fresnel visibility for the layer. a full fresnel ( 1.0 ) is perfect for clear coat simulation.
0.0 = the depth only control the visibilty, and not the fresnel effect.

IoR = The Index of Refraction for the fresnel effect. The greater it is, the more visible is the layer.

OUTPUT :
Layered (Closure) = Mixed Base and Layer Inputs.

Layer Mix (float) = amount of mixing between the base and Layer.
You can use it to put in a classical Shader Mixer, or a color mixier, as you wish!


TODO :
* Optimization for faster render.
* Transparent Layer capability.

This shader was edited with Sublime text Editor, with OSL package.


This shader is made for educationnal purpose only. Use it in production at your own risk.
Closures are for Blender/Cycles. They could need adaptation for your renderer.
If you use this shader, please credit it and me. Thank you.