Secondary outputs

Rudy over at renderman academy has already given an excellent run through of this, but theres no harm in doing another run through, in particular what you need to put in the 3delight UI for it to work.

First thing I modify the shinymetal shader.

surface
shinymetal(
float Ka = 1;
float Ks = 1;
float Kr = 1;
float roughness = .1;
string texturename = “”;
float samples = 1;
float blur = 0.0;
float specularcolor = 1;
float Kd = 1;
output varying color Cdif = 0;
output varying color Cspec = 0;
output varying color Crefl = 0;
)
{
normal Nf;
vector D, V;
color Cr;
Nf = faceforward(normalize(N), I);
V = normalize(-I);
D = reflect(I, Nf) ;
D = vtransform( “world”, D);
/* Initialise outputs */
Cdif = Cs * Kd * diffuse(Nf);
Cspec = specularcolor * Ks * specular(Nf, V, roughness);
Crefl = Kr * color environment (texturename, D, “samples”, samples, “blur”, blur );
if( texturename != “”
)
{
Cr = Kr *
color environment(
texturename, D, “samples”, samples, “blur”, blur );
}
else
{
Cr = 0;
}
Oi = Os;
Ci = Cs * (Ka * ambient() + Ks * specular(Nf, V, roughness) + Cr);
Ci *= Oi;
}

The amendments are the information that 3delight needs to read from the shader for it to render out the additional information. By adjusting the layers in Photoshop or whatever, you can see how many more options there are.
The top is straight out, the bottom one with secondary.

Leave a Reply

Your email address will not be published. Required fields are marked *