String Handling In OSL Shaders

 

Supported Operations On String Values

OctaneRender® considers strings to be opaque values, and supports only a limited set of operations:

OctaneRender®doesn't support any of the standard string functions defined by OSL.

 

Types Of String Variables

OctaneRender® distinguishes between three types of string variables:

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

 

Using Strings As Shader Inputs

OctaneRender® represents the three string types above with different widgets:

 

String Literals In Texture() Calls

If the argument of a texture call is a constant string, the compiler generates a file name input and uses the literal value as the default value. This loads OSL code, which contains file names, and ensures any referenced files are packed when you export a scene 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., see The Octane OSL Guide.