Input Parameter Types


Conceptually an OSL shader corresponds to a node in our node system. Input parameters will show up as input pins on the OSL texture node. There is a single output parameter corresponding to the output value of the node.


The I/O types in OSL code correspond to the following Octane attribute pin types:

color → Octane Texture attribute

point → Octane Projection attribute (UV, spherical, cylindrical…)

vector, normal → Octane Float attribute (X, Y, Z)

matrix → Octane Transform attribute

float → Octane Float attribute (1D-value)

int → Octane Int attribute (1D-value)

string → Octane Filename or Enum ⁽¹⁾ attribute


Default values in the function signature are used as the default values for the input pins.


OSL allows meta data for shaders, that provide more control of how the node parameters are displayed. Octane supports the following:


Metadata for all inputs:

string label

Override the name shown in the node inspector (normally the variable name is shown)

string help

Provides a tool tip for the pin when you hover your mouse over the pin

string page

Can be used to group pins into categories

Metadata for int and float inputs:

float/int min, max

Specify the minimum and maximum values for a float or int input (note that there's no guarantee that the actual value for the variable in the shader is inside these bounds)

float/int slidermin, slidermax

Allows you to specify a more narrow value range for the sliders. Users may still enter values outside this range (but within min / max) using right mouse button drag, and by typing a value.

float/int sensitivity

Allows you to specify the steps for a float/int type variable

float/int sliderexponent

Sets up the skew factor for the slider. In Octane, only linear (sliderexponent == 1) and logarithmic (sliderexponent > 1) are supported

Metadata for int inputs:

string widget = "checkBox"

show a checkbox instead of a slider. The input value will be 0 or 1.

string widget = "boolean"

synonym for checkBox

string widget = "mapper"

string options

Use a combo box. Options are separated by pipe characters, the keys and value by a colon. Eg. "option one:1|option two:2|option three:3"

Metadata for matrix inputs:

int dim

set to either 2 or 3, specifies if the matrix should be shown as a 2D or 3D transform

Metadata for string inputs:

string widget = "popup"/string options

use a combo box, using the options in the given string. Options are separated by pipe characters, e.g. "option one|option two|option three".

int editable

If 1, this allows entering string values in a combo box which are not in the list of options.


File name inputs are always displayed as a file input, regardless of any given metadata.


To learn more about programming with the Open Shader LanguageA shading language developed by Sony Pictures Imageworks. There are multiple render engines that utilize OSL as it is particularly suited for physically-based renderers. refer to the [link to OSL wiki being drafted by Roeland]