String Handling In OSL Shaders

 

Supported operations on string values

None of the standard string functions defined by OSL are supported.

 

Types of string variables

Octane roughly distinguishes between 3 types of string variables:

The Octane OSL compiler will use static code analysis to determine how each string variable is used. If a variable is used as both an enum value and file name a compiler error is raised.

 

Using strings as shader inputs

Octane will represent the three types above with different widgets:

 

String literals in texture() calls

If the argument of a texture call is a constant string, the compiler will generate a file name input and use the literal value as the default value. This allows loading OSL code which contains file names, and ensures any referenced files will be packed when a scene is exported to ORBXThe ORBX file format is the best way to transfer scene files from 3D Authoring software programs that use the Octane Plug-in such as Octane for Maya, Octane for Cinema 4D, or OctaneRender Standalone. This format is more efficient than FBX when working with Octane specific data as it provides a flexible, application independent format. ORBX is a container format that includes all animation data, models, textures etc. that is needed to transfer an Octane scene from one application to another..

 

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 Octane OSL Guide.