A LOT of OSL Shaders !

Here is a very valuable compilation of OSL Shaders.

It is more than useful for anyone using OSL !

You could find very simple shaders up to very complex texture generators.

Have a look here : OSL Shaders

Have a nice shading day !


OSL Dispersion Refractive Shader

This Shader does a per wavelength Dispersion in a refractive material.

It is brut force dispersion shader and need a lot render samples to have a correct look. There is near no optimization, so it's not made for animation.

It was made for educational purpose and should be optimized and rethink for an effective production use. Indeed, results are really good for still pictures.

Small documentation :
Transp Color = Color of the transparent material.
Beware that if saturation is too high, you'll not see any dispersion.

IoR = Main Index of Refraction of material.

disp = Dispersion , in IoR Delta.
correct value are between 0.05 and 0.2.
A higher number give more rainbow in transparency, and slower rendering time.
A too high value ( > 0.3 ) can lead to rendering errors or inconsistency.

Roughness = surface roughness.
A good value is 0.0. Higher values blur refraction and could hide dispersion effect.

Full render = optimization.
1.0 = no optimization, slower render but accurate.
0.0 = no dispersion except for eye rays. You'll see no dispersion on a reflect of the object, and backface is ignored.
It is about 30% to 60% faster, and the difference between realistic and optimized material isn't noticeable for rendering that doen't need pure accuracy.

You can download the OSL Shader here : GDispersive.osl

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 material, please credit it and me. Thank you.

Enjoy !

OSL Dispersion Shader from François Gastaldo on Vimeo.


Enter Physically Correct Shading World, Step One

Following my conference 'Make your Own Physically Correct Shader' at Blender Conference, in Amsterdam, October 2012, here are the OSL version of Shaders.

The Conference was about how to make your own (according to your production needs) shaders and to make them Physically Correct to be sure to have a realistic lighting.

During the conference, I made Cycles nodes Shaders. Now, OSL is here and it's a very better way to make faster and cleaner Shaders.

I invit you to enter this Physically Correct World, and we will do it in few steps.

Step One : Have basic Physically Correct shaders.

Step Two : Multi-Layers Shaders.

Step Three : Getting Faster, Shader Optimization.

Step Four : Special pourpose, but still correct, Shading.

Step Five, six, seven... : ??? .... We will see !

For the first step, I've made an archive with all files.

It includes :
- The PDF file of the 'Make your Own Physically Correct Shader' Conference.
- A Blender scene with Node based Shaders.
- Three OSL Shaders, each one corresponding to each Normalization Case discribed in the Conference : Priority Normalization, Factor Normalization, Roughness Driven Shading.

All OSL shaders are documented (and commented) inside the source, the .osl file. Please, read it to understand how to use them.

All this material is for Educational Purpose. You can use it for teaching or self-teaching.

You can download the First Step to Physical World here : Blender Conference 2012 Physically Correct Shaders + OSL

Physically Correct Shading, Step One from François Gastaldo on Vimeo.


Simple OSL Ambient Occlusion

Just because I need one, and also because the AO node in Blender is a little too light, I've made today an Ambient Occlusion Shader with OSL.

It works exactely like a standard Ambient Occlusion, as you could find it in many software.

It works with with colors as well as with Closure.

if you connect use just the ' ColorIn ' or just the ' closureIn ' inputs and connect nothing to 'ColorHit' or 'closureHit'. Then Occlusion will be black.

AO Angle is in RADIANS, 1.0 = 180° AO search.

Maxdistance limit distance of occluding objects.

If you want to not have a distance limit, 0.0 is not infinity. You'll have to enter a very big distance.
This AO shaders needs polygons to be correctely oriented.

You can download it here : OSL Ambient Occlusion

Enjoy !

ADDEDUM : GAO and GAO2 are updated ! Click here to see the new versions GAO1.1 and GAO2.1 !