The Cycles render engine has two shader systems.
SVM (Shader Virtual Machine) is the default shader system but the engine also has support for OSL (Open Shading Language).
The OSL shader system was working on a basic level back in April 2011 when Cycles got released, but afterwards it was not updated as Cycles itself was very young and needed to mature still. There would have been no benefit in supporting both backends from the very beginning.
Lukas Tönne and myself updated the OSL backend in Cycles for the last couple of weeks and brought it up to speed again. We had to fix a bunch of compiler errors first, as the OSL API itself changed as well over the past year.
1) What is OSL?
OSL is an open source shader system, developed by Sony Pictures Imageworks (SPI). They developed it for their in-house renderer (which is a modified version of Arnold) and it was the exclusive shading system for big VFX films such as “Men in Black 3″ and “The Amazing Spider-Man”.
OSL is available unter the “New BSD” licence and can be integrated into commercial and free software applications.The source code is available on github.
Make sure to read the “Physical Production Shaders with OSL” presentation from the Siggraph 2012 Shading Course to get a detailed overview of OSL.
2) OSL in Cycles
You will be able to use either the SVM or the OSL backend. The reason for that: OSL is only available when you render with the CPU, a limitation of OSL itself which might change in the future, but for now it’s CPU only and therefore we keep both backends.
Every shader node in Blender is implemented in both backends, so you can switch back and forth here without worrying about your material setup.
3) Custom shaders
The real strength of OSL is the ability to write your own shaders. You can create materials, lights, displacement or patterns in the OSL language itself.
Lukas added a “OSL Script” node to Blender. You can load a .osl text file, press the compile button inside the node and it will automatically create the input and output sockets for the custom shader. Now you can use the new shader in combination with the other nodes in Blender as usual. Watch the following video to see the system in action:
These shaders can also be exchanged with other OSL Render engines. Each renderer can add custom features and closure types, but the basic shaders and functions should be available in every OSL renderer. Chaosgroup confirmed that V-Ray is going to support OSL in their next major release as well.
4) Where do I get Blender with OSL?
OSL is not included in official builds yet, if you want to give it a try you have to compile the OSL library yourself and enable “WITH_CYCLES_OSL” in cmake. The updated OSL code is in trunk, except the OSL script node. A patch for that will be released soon.
It probably won’t make it into the upcoming Blender 2.64 release, as we still have to fix a few bugs and polish it, but 2.65 will most likely include it.
If you want to test it or even better help developing it, you can find compile instructions and ToDos here.