Cutter
Writing OSL Shaders for Arnold



return to main index


Links:

    Cutter & OSL Shader Writing
    Sony OSL
    SolidAngle OSL
    OSL Specification [pdf]
    OSL Overview


Summary of Cutter's Features Related to Arnold

    Compiling a Shader
    Automatic Generation of MTD Files



Introduction

This tutorials outlines the features of Cutter that support the writing of OSL shaders for use with Arnold. An overview of Cutter and OSL can be found in the tutorial Cutter & OSL Shader Writing.


Arnold Osl Compiler

For shaders to be compiled for use with Arnold the "bin path" must be set in the Languages->Osl->Arnold panel - figure 1.

Also, the "shaders" path must be set. This will ensure that irrespective of where the OSL source code files are located, Arnold's oslc compiler will always output the .oso files to a shared directory - figure 2.

After editing the paths be sure to click the "Save Osl" button in the Preferences Tool.




Figure 1 - Path to
"/Appliations/solidangle/mtoa/2018/bin" OSX
"C:/solidangle/mtoadeploy/2018/bin" Windows


Figure 2 - Path to the users compiled shaders



When editing an OSL file use the popup menu to compile the shader.



Figure 3



Automatic Generation of MTD Files

Each time a shader is compiled Cutter automatically generates a MTD file for the shader. For use with Maya each compiled shader must have a .mtd file. For shaders to be automatically loaded by Maya's HyperShader the ARNOLD_PLUGIN_PATH environment variable must be set in the Maya.env file.

For example, if the shaders path, figure 2, is set to
    D:\Users\malcolm\Document\maya\projects\Arnold_osl

then the environment variable in the Maya.env file would be,

ARNOLD_PLUGIN_PATH=D:\Users\malcolm\Document\maya\projects\Arnold_osl

A typical .mtd file is shown below.

[node pnt2color]
    maya.name                STRING    "pnt2color"
    maya.id                  INT        1
    maya.classification      STRING    "Utility"
    maya.output_name         STRING    "resultRGB"
    maya.output_shortname    STRING    "resultRGB"

Cutter automatically keeps track of the maya.ids in use so that duplicate ids can be avoided. Use the popup menu to see a report of the node ids currently in use.



Figure 4









© 2002- Malcolm Kesson. All rights reserved.