OSL

 

The OSL shaders used in the above examples can be found here.

 

It is possible to create your own shaders using Open Shading Language. OSL shaders can be used to implement anything from simple texture patterns to full materials using closures. They can be placed in the plugin search path, and will then be automatically loaded like other types of shaders. Once loaded, they can be inspected, instantiated and linked in the same way as C++ shaders. The osl node provides an alternate way to load OSL shaders, which can be used to write shader code for a specific material. When setting the shader name or code, the parameters from the OSL shader automatically appear on the node to be set or linked.

A limitation is that only one output parameter is supported at the moment.

More information about using OSL shaders can be found here. A video that shows how to use the OSL shader can be found here.

An example .osl shader and .mtd file can be found here.

Limitations

  • The shaders must have unique names. If the name conflicts with an existing shader, the OSL shader won't load. You should see a warning in the log in this case.
  • Multiple outputs are not supported at the moment.
  • The name of the output attribute is not the same as the shader code.
  • Unable to do #includes in OSL shader code.

 

The method to use OSL in Houdini is simply to put down an OSL VOP in an arnold_materialbuilder in the MAT context in Houdini. This vop allows you to pull in source code with a file browser.

Code

Write the shader code here.

Parameters

View the attributes of the OSL shader here once it has compiled.

 

  • No labels