Whats New - Version 4.4.8


return to main index



Error compiling RSL
Regrettably version 4.4.6 introduced a bug that in some circumstances prevented Cutter finding the name of a shader when an RSL document was compiled. The bug would become evident when the RSL document had one or more function declarations preceeding the implementation of the shader. For example, the code shown below would cause Cutter to erroneously name the compiled shader rotate2d instead of rotate_test!

    void rotate2d(float xpivot, ypivot, angle; 
                        output float x, y)
    {
    // Convert to radians
    float    a = radians(angle);
    // Translate xy relative to the pivot point
    x = x - xpivot;
    y = y - ypivot;
    // Perform the rotation
    x = x * cos(a) - y * sin(a);
    y = x * sin(a) + y * cos(a);
    // Translate xy relative to the pivot point 
    x += xpivot;
    y += ypivot;
    }
    
    surface
    rotate_test(float   Kd = 1,
                        angle = 0,
                        spivot = 0.5,
                        tpivot = 0.5)
    {
    color    surfcolor = 1;
    normal   n = normalize(N);
    normal   nf = faceforward(n, I);
    float    x = s, y = t;
    
    rotate2d(spivot, tpivot, angle, x, y);
    if(x > 0.5)
        surfcolor = color(1,0,0);   
    Oi = Os;
    color    diffusecolor = Kd * diffuse(nf);
    Ci = Oi * Cs * surfcolor * diffusecolor;
    }




fig 1



Slim appearances and templates
While removing the bug mentioned above I also improved Cutters ability to automatically generate Slim template files. As a test I took all the standard shaders that ship with Pixar's prman and converted each to a Slim template. All of Pixars shaders converted successfully except their null and diaknurl shaders. The diaknurl shader declares one of its parameters as,

    radius = 1/(2*PI)

For the moment at least, Cutter does not recognize "maths" in a declaration. For more information refer to,

Automatic Conversion of Shaders and RSL Functions to Slim Files

As mentioned in that document, its necessary to hilite individual functions that you may wish to convert to their template equivalent. However, Cutter is not able to convert the RSL code shown above into a template version of rotate_test because it cannot (yet) handle RSL documents that mixture function code with shader code.

To do the conversion successfully, the function must be removed from the shader document and placed in a header (.h) file. Then a reference to the header file would be given in the usual way ie.

    #include "PATH_TO_THE_HEADER_FILE"







© 2002- Malcolm Kesson. All rights reserved.