Cutter
|
Introduction
The purpose of this tutorial is to demonstrate how Cutter is used to
compile a shader and render a simple scene. Following the steps outlined in
the tutorial will also enable the reader to check if they have set up Cutter
so that it can use mental ray properly. The recently published reference book on the subject of
shader writing is,
|
Creating a Custom ShaderSetp 1 - Using a Shader (MiC) TemplateFrom Cutter's Templates menu choose "tinted_occlusion.c" - figure 1. Popups will appear as the user runs the mouse over the names of the templates.
An untitled copy of the template file will open. The source code for the shader is shown below. Listing 1 - tinted_occlusion.c
Setp 2 - Save the Shader Code
Save the file as "tinted_occlusion.c" in your "shader_src" directory ie.
Setp 3 - Compiling & LinkingCompile and link the shader using the (execute) keyboard shortcut Alt + e, or Control + e, or Apple + e. Cutter's Process Monitor window will show any information, warning or error messages issued by the compiler - figure 2.
To see the command used by Cutter, as a result of using the keyboard shortcut, select the "Options" tab - figure 3. Cutter generates and runs a makefile (or VS8 bat file) for each shader the user compiles. Under most circumstances it will not be necessary for a user to write their own makefiles or VS8 bat files. The compiled shader will be saved in the directory specified in Cutter's preferences - refer to the tutorial "mental ray: Cutter Preferences".
In the "background" Cutter writes and saves a shader .mi (listing 2) file. A copy of the file is also saved in the users "shaders" directory. Listing 2 - tinted_occlusion.mi (generated by Cutter)
In particular, note the values within the square brackets of the comments of tinted_occlusion.c. miUint samples; /* default [16] */ miColor tint; /* default [1 1 1] */ They have been used by Cutter as default values within tinted_occlusion.mi. integer "samples", #: min 0 max 1 default 16 # default color "tint" #: default 1 1 1 # default Specifying values, within square brackets, in the shader source code file is a very convenient way of controlling the defaults in the .mi file. |
|
With the text cursor placed in the
|
Some Common ErrorsIf the renderer reports these errors, LINK 0.0 error 191014: tinted_occlusion.so: load failed MI 0.0 error 121417: tinted_occlusion_scene.mi, line 8: cannot find $include file "tinted_occlusion.mi"
it most likely because one or more paths in the readers custom rayrc file is incorrect - refer to
the tutorial "mental ray: Setup for CD vol III".
|
__________ [1] 2.59:4PM __________ WARNING (/usr/local/mi/mrdemo/bin/ray): Can't connect to 127.0.0.1 ("mi-spm"[tcp/7050]) (61: Connection refused) WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost0() ("mi-spm"[tcp/7050]) does not respond WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost1 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost2 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost3 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost4 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost5 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost6 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost7 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost8 is an unknown host WARNING (/usr/local/mi/mrdemo/bin/ray): spmhost9 is an unknown host FATAL ERROR (/usr/local/mi/mrdemo/bin/ray) at 10/14/2008 14:59:33 : Can't connect to any SPM license server. RENDERING COMPLETED: UNSUCCESSFULL Errors: 5 Warnings: 15 |
To restart the spm license server, open a terminal and enter these commands. % sudo -s (enter the admin password, then enter) % /var/spm/spmd_ib The status of the server can be querried using this command. % /var/spm/spmstat |
© 2002- Malcolm Kesson. All rights reserved.