The OSL texture node is a scriptable node that lets you write scripts using the OSL (Open Shader Language) standard programming language to define arbitrary Texture types to create customized Materials and shaders. OSL is a standard created by Sony Imageworks. To learn about the generic OSL standard, please read the OSL Readme and PDF documentation.

Figure 1: OSL texture Node


There are two options to add scripts for the OSL texture. The Internal option is available by opening another area in Blender® for the Text Editor, creating a new text, and writing the OSL script. The External option lets you to select a pre-coded OSL file from the File Explorer window.


The OSL texture requires one output color. One OSL texture node is one OSL compilation unit, which contains only one shader. The OSL texture node has one Output attribute pin that connects to the Texture input pin of other Texture nodes (like Turbulence), or to the Texture input pin of Octane materials (like Diffuse).


NOTE

Multiple outputs for OSL textures are not supported.


 The example below shows an OSL shader that adds two RGB textures.

Shader Add (

color a = 0,

color b = 0,

output color c = 0)

{

c = a + b;

}

The script’s declaration component has three variables: two are input variables of Input Type color, and the third one is the required output represented by a variable of Output Type color. The OSL Input/Output Type color corresponds to an Octane Texture attribute node. The script’s function body adds the two input parameters and places the result into the output variable.


For a list of OSL variable declaration Input/Output types in the OSL dpecification that OctaneRender® supports, see the Appendix topic on OSL Implementation in OctaneRender® in this manual. To learn more about scripting within OctaneRender® using OSL, see the The Octane OSL Guide.


NOTE

When using OSL, make sure that shaders never lock up or run for a long time. This may cause the system to freeze, or the display driver resets. Some operations, like out-of-bounds array access, may cause kernel crashes.