ShadingModel Template


  
slim 1 extensions cutter {
extensions fundza cutr {
    template shadingmodel Flame {
        description {Node information goes here...}
        previewinfo {
            shadingrate 1
            objectsize 1
            # Other shape names are Plane, Sphere, Torus,
            # Cylinder, Cube, Teapot, Volume and RiVolume
            objectshape Plane
            frame 1
            }
        collection manifold Manifold {
            description {the topological space to which the 'st' coordinates will be parented}
            detail mustvary "pixar,ST"
            state locked
            parameter point Q {
                detail mustvary
                default point(s,t,0)
                }
            parameter vector dQu {
                detail mustvary
                }
            parameter vector dQv {
                detail mustvary
                }
            }
        # Parameters are used to collect all information associated
        # with a single parameter of an appearance.
        parameter color PROXY_CS {
            description {Proxy value of Cs}
            label {Surface Color}
            detail varying
            default {1 1 1}
            }
        parameter color PROXY_OS {
            description {Proxy value of Os}
            label {Surface Opacity}
            detail varying
            default {1 1 1}
            }
        parameter float Kfb {
            description {Parameter information goes here...}
            label {Kfb}
            detail varying
            default 1
            subtype slider
            range {0 1 0.05}
            }
        parameter float freq {
            description {Parameter information goes here...}
            label {freq}
            detail varying
            default 6
            subtype slider
            range {0 12.0}
            }
        parameter float blur {
            description {Parameter information goes here...}
            label {blur}
            detail varying
            default 0.02
            subtype slider
            range {0 1 0.05}
            }
        parameter color top {
            description {Parameter information goes here...}
            label {top}
            detail varying
            default {1 0 0}
            }
        parameter color lower {
            description {Parameter information goes here...}
            label {lower}
            detail varying
            default {1 1 0}
            }
        parameter string spacename {
            description {Parameter information goes here...}
            label {spacename}
            default {shader}
            }
        # The collection context is valid within the appearance
        # and collection contexts. Collections are containers for
        # parameters and can have a custom UI. Collections are
        # also used to represent higher order datatypes like
        # shadingmodels and arrays.
        collection shadingmodel shadingmodel {
            access output
            display hidden
            # The parameters CI and OI are the outputs of the
            # shading function. They are equivalent to the global
            # variables Ci and Oi.
            parameter color CI {
                access output
                }
            parameter color OI {
                access output
                }
            }
        RSLFunction {
        void
        cutrFlame (
                point Q;
                vector dQu;
                vector dQv;
                color PROXY_CS;
                color PROXY_OS;
                float Kfb;
                float freq;
                float blur;
                color top;
                color lower;
                string spacename;
                output color CI;
                output color OI;
                )
        {
        color TEMP_OI = 1;
        color TEMP_CI = 1;
        float    _ss_ = mod(xcomp(Q),1);
        float    _tt_ = mod(ycomp(Q),1);
        point p = transform(spacename, P);
        color surfcolor = mix(top, lower, _tt_);
        TEMP_OI  = 1 - smoothstep(_tt_ - blur, _tt_ + blur, noise(p * freq));
        TEMP_CI  =  TEMP_OI  *  PROXY_CS  * surfcolor * Kfb;
        OI = TEMP_OI;
        CI = TEMP_CI;
        }
} } } }