Whats New - Version 8.3.0

Feb 24 2021


return to main index



Properly Structured Arnold MTD Files

Immediately after a source code file has been successully compiled, Cutter uses the oslinfo utility and parses its output looking for metadata hints that may accompany each input paremeter. For example, this shader,

shader
mkDonut(
    float radius = 0.3,
    float width = 0.1,
    float u_center = 0.5 
        [[
        string label = "U Center",
        ]],
    float v_center = 0.5 
        [[
        string label = "V Center",
        ]],
    color bak_color = 1,
    color pat_color = color(1,0,0),
    float u_repeats = 4 
        [[
        string label = "U Repetitions",
        ]],
    float v_repeats = 4 
        [[
        string label = "V Repetitions",
        ]],
    float even_row_offset = 0,    
    output color resultRGB = 0)
{
float uu = mod(u * u_repeats, 1);
float vv = mod(v * v_repeats, 1);
float row = floor(v * v_repeats);
if(mod(row, 2) == 0)
    uu = mod(u * v_repeats - even_row_offset, 1);
    
// Calculate the inner and outer circles
float inner_radius = radius - width/2;
float outer_radius = radius + width/2;
float a = uu - u_center;
float b = vv - v_center;
float dist = sqrt(a * a + b * b);
  
if(dist >= inner_radius && dist <= outer_radius)
    resultRGB = pat_color;
else
    resultRGB = bak_color;
}


when compiled and processed by oslinfo would generate the following data.

shader "mkDonut"
    "radius" "float"
        Default value: 0.3
    "width" "float"
        Default value: 0.1
    "u_center" "float"
        Default value: 0.5
        metadata: string label = "U Center"
    "v_center" "float"
        Default value: 0.5
        metadata: string label = "V Center"
    "bak_color" "color"
        Default value: [ 1 1 1 ]
    "pat_color" "color"
        Default value: [ 1 0 0 ]
    "u_repeats" "float"
        Default value: 4
        metadata: string label = "U Repetitions"
    "v_repeats" "float"
        Default value: 4
        metadata: string label = "V Repetitions"
    "even_row_offset" "float"
        Default value: 0
    "resultRGB" "output color"
        Default value: [ 0 0 0 ]


After processing by Cutter the data is converted into a mtd file named mkDonut.mtd.

[node mkDonut]
    maya.name        STRING    "mkDonut"
    maya.id          INT        28
    maya.classification     STRING    "Utility"
    maya.output_name        STRING    "resultRGB"
    maya.output_shortname   STRING    "resultRGB"
[attr radius]
    default        FLOAT        0.3
[attr width]
    default        FLOAT        0.1
[attr u_center]
    default        FLOAT        0.5
    label          STRING    "U Center"
[attr v_center]
    default        FLOAT        0.5
    label          STRING    "V Center"
[attr bak_color]
    default        COLOR        1 1 1
[attr pat_color]
    default        COLOR        1 0 0
[attr u_repeats]
    default        FLOAT        4
    label          STRING    "U Repetitions"
[attr v_repeats]
    default        FLOAT        4
    label          STRING    "V Repetitions"
[attr even_row_offset]
    default        FLOAT        0

Metadata Conversion

Cutter does not perform a direct conversion of the output of oslinfo but instead "corrects" any metadata tags that may be using RenderMan style notation. For example, this metadata specifies a dropdown menu using a RenderMan "mapper" widget and labels with explicit values,

[[
string widget = "mapper",
string options = "Label_A:0|Label_B:1|Label_C:2",
]
]

would written to the .mtd file as,

widget STRING "popup"
options STRING "Label_A|Label_B|Label_C"











© 2002- Malcolm Kesson. All rights reserved.