Open Shading Language in Cycles

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 under 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.


  1. Please get the option of Turkish language

  2. whereas why many people do not have a blender Turkish Turkish language Turkish language support but do not want to use your blender producers are forced to appeal to many of us, please use the Turkish language option teşekürler

  3. Cheers tons intended for discussing this effortlessly people you know very well what you will be chatting close to! Bookmarked. I implore you to furthermore go to my website Implies). We will have a very website link exchange set up between you

  4. I just downloaded 2.67, are there any tutorials about how to upload and utilize shading programs with Blender?

  5. In the OSL language there is a function called get attribute(). In Blender 2.67 the use of this function simply crash blender. Does anyone have any more documenteatioin on how to use this? I have just been reading here:
    and the OSL document.
    The real use of such function would be to access the light/camera vectors to implement special shaders. Does anyone know any good resource for this?

  6. Hi, I created a new OSL shader and posted the results on my blog (

  7. this is so excellent

  8. Is it possible to code Volume-Fractals for Cycles with OSL ?

  9. Now the for the question: Where the heck is there any detailed documentation for osl? If anyone knows of anywhere that goes into detail, share it! :D

  10. This is great step to a better and more powerful workflow in Blender. Givin us more options to custumize our own shaders.
    Thank you very much guys. I’ve been waiting for this for a long time.

  11. Really exciting stuff!

  12. should do the same for the compositor! :D, good stuff!

  13. Is there support for Collada export of such data?

  14. awesome

  15. Kudos for the hard work!

  16. Making some great progress here. Excellent work!

In order to prevent spam, comments are closed 7 days after the post is published.
Feel free to continue the conversation on the forums.