Cutter
Arnold C++ Shader Writing



return to main index




Introduction

Cutter version 8.0.5 incorporated, for the first time, features specifically designed to help artists expore the writing of Arnold shaders using the C programming language. Cutter version 8.3.6 introdced many more features - see "Whats New - Version 8.3.6".

This updated tutorial provides step-by-step instructions on the downloading and installation of the Arnold SDK from SolidAngle, a C/C++ compiler and the configuration of Maya and Cutter.


Step 1: Which Version of the Arnold SDK?

Launch Maya and from the Arnold menu select the "About" item. Note the version number of the "Arnold Core". In figure 1 it shows, on my computer, "6.0.0.0".



Figure 1


Step 2: Download the Arnold SDK

Go to:
https://www.arnoldrenderer.com/login/
and choose "Create New Account".

Once you have access to their website go to:
https://www.arnoldrenderer.com/arnold/download/
The current versions of the SDK are near the bottom of the page.

Alternatively, go to:
https://www.arnoldrenderer.com/arnold/download/archive/
to access all versions of the SDK both present and past. Make sure you download the version of the SDK that matches the "Arnold Core" version.


Step 3: Installing the Arnold SDK

Once the .zip or .tgz file that is appropriate for your operating system has been unzipped move the folder to a location that suits you. It does not have to be located in a specific directory. For example I have my SDK in this path.
    /Applications/solidangle/Arnold-5.4.0.0-darwin
but it could have located it in my Documents folder.


Step 4: Setting Up Maya

On my computer I have created the following directories.

maya/projects/Arnold_shaders/ <-- compiled shaders and .mtd files will go here
      	                    |_ src_c++/ <-- c++ source code files
                            |_ src_osl/ <-- osl source code files

The users Maya.env must be edited so that the Arnold mtoa plugin will be able to find your custom shaders and their AETemplates.py files. On MacOSX the Maya.env file is located in the users:
      Library/Preferences/Autodesk/maya/20XX directory.
On Windows the Maya.env is normally located here:
      C:\Users\ACCOUNT_NAME\Documents\maya\20XX
Add the following environment variables to the Maya.env file.
    ARNOLD_PLUGIN_PATH=FULL_PATH_TO_MAYA/projects/Arnold_shaders
    MTOA_TEMPLATES_PATH=FULL_PATH_TO_MAYA/projects/Arnold_shaders


Step 5: Installing a C/C++ Compiler - Windows & OSX Users Only

Follow these instructions C/C++ Compiler Installation.


Step 6: Setting Up Cutter

Make sure you are using Cutter version 8.3.6 or higher. From the Edit menu open the Preferences Tool and go o the Languages->Arnold SDK tab.
6.1   The first path must point to the location of the unzipped Arnold SDK.
6.2   The second path must point to the full path of your src_c++ folder.
6.3   The third and fourth paths should specify the full path to your Arnold_shaders folder.

When the paths have been set make sure the Save Arnold SDK button is clicked.



Figure 2



Step 7: Using Cutter to Create and Compile a Shader

From the Templates menu choose Arnold Shader->mkSampleShader.cpp.



Figure 3


7.1   Save the file as mkU2Color.cpp in the,
        maya/projects/Arnold_shaders/src_c++ directory.
Note the use of two lower case letters "mk". These act as a signature and as such the reader is advised to change "mk" to their own unique two, lower case, character signature.
7.3   Use the keyboard shortcut Control + e or Command + e to compile the shader.
7.2   Cutter will automatically change line 33 from,
        node->name = "NAME_OF_YOUR_SHADER";
to
        node->name = "xxU2Color";
Where "xx" is the readers signature.
7.4   Check the Process Monitor window to ensure the shader has been compiled.



Figure 4


If compilation has been successful the maya/projects/Arnold_shaders directory will contain two files, mkU2Color.dll or mkU2Color.so (depending on the operating system) and mkU2Color.mtd (an Arnold metadata file).



Step 8: Using the Shader with Maya

Launch Maya and open Hypershade. The mkU2Color node should appear in the Arnold/Utility section of the create panel.



Figure 8


If the node does not appear it will because of one of the following reasons:
    - the ARNOLD_PLUGIN_PATH environment variable is incorrect,
    - the node->name = "mkU2Color"; (line 33) is incorrect.








© 2002- Malcolm Kesson. All rights reserved.