Drake's Weblog

3 minute read

Wonderful to hear from you. I spent a most enjoyable 12 days in Taipei last summer. I taught a 5 day class of RenderMan at DCI. Thank you for telling me about the kind words of one of my (best) students. Very encouraging.

The “RenderMan Companion” by Upstall has 3 chapters (maybe 4) devoted to shader writing. Although it is an old book, it is still very good. “Advanced RenderMan” by Apodaca and Gritz is very good although sadly it was written before the raytracing extensions were added to prman. You may like to follow some of the links on one of my class pages,http://sfdm.ca.scad.edu/vsfx/faculty/mkesson/Ca301/index.html

Fundza.com has some good examples. Many of the pages that I wrote for my site need to be revised but, nonetheless, despite their over-simplifications they are OK. “rendermanacademy.com” is good but I find it a bit difficult getting around it. Stev Mays “http://accad.osu.edu/~smay/RManNotes/” is very good.

For studio use you may like to convert any shader you have written into a slim template for use with mtor/slim with Maya. Cutter has a pretty good built in translator that reads the source code for a shader and converts it to a slim template. This effectively produces a custom node for slim. Unlike a regular shader that is pre-compiled and hence “unlinkable” as an item in a shading network, a template produces a first class node for slim. It can become part of a shading network.

http://www.fundza.com/cutter/slim/overview2.html

For my own teaching I sometimes introduce students to the shading language by showing them how to write a displacement or a surface shader. I do not get into raytracing until they chose to do our advanced renderman class. Just about all the surface shaders we write do not even take ambient or specularity into account. Just this,

/* Shader description goes here */
surface
diffuse_test(float Kd = 1 /* basic brightness */)
{
color surfcolor = 1;

/* STEP 1 - make a copy of the surface normal one unit in length */
normal n = normalize(N);
normal nf = faceforward(n, I);

/* STEP 2 - set the apparent surface opacity */
Oi = Os;

/* STEP 3 - calculate the diffuse lighting component */
color diffusecolor = Kd * diffuse(nf);

/* STEP 4 - calculate the apparent surface color */
Ci = Oi * Cs * surfcolor * diffusecolor;
}

If this is compiled in Cutter (alt + e) a test rib file can be easily generated. Cutter has a floating palette called Rman Tools. It has a Docs menu, the first item of which is “Single Frame Rib”. Once chosen, Cutter will open a rib document suitable for testing the new shader. After that it a matter of change something in the shader code, alt+e to compile a new version of the shader, then click on the rib window and again alt + e to render the image.

Once you have a shader that does something mildly interesting you can use it in Maya via pixars plugin called mtor. Back at Cutter the shader can be converted to a slim template by choosing “Rman Tools->Shaders->Preview Slim Template”. Another doc will open that contains the slim code based on your shader. If you have Maya Unlimited you can open a command port in mel,

commandPort -n “:2222”

In Cutter with the slim doc as the front window again alt +e and Cutter will send the slim code to Maya. A palette will open, loaded with the new node ready for editing and subsequent use. All the parameters of the slim node will be able to be connected to other nodes - just like HyperShade.

Good to hear from you. Stay in touch.
Malcolm

comments powered by Disqus

Recent posts

Categories

About

You're looking at Drake's words or statements. All opinions are my own.