Shaders

Shaders determine the surface properties of gprims when rendered with RenderMan. Much more information can be found in Shaders are gops and thus change the graphics state when invoked.


Shader Usage

Surface, atmosphere, and displacement shaders, are created using, (surprise!) the functions "surface", "atmosphere", and "displacement".

So the example below would generate a wooden sphere, and a stone box.

  ox --> (world
           (separator
  	     (surface "wood" 'Ka .1 'grain .2)
	     (sphere))
           (separator
  	     (surface "stone" 'roughness .03)
	     (box))
	  )
Each function requires the name of the shader desired, followed by a parameter list. As always, consult The RenderMan Companion, the manual for Dave, or Steve May for complete paramenter lists.

Of course, Users are welcome and encouraged to write their own shaders, as well.

Remember, a shader needs a light source to be seen, and ambient alone won't do!


Some Examples: the standard RenderMan surface shaders

Carpet:                Constant:       

Cmarble: Defaultsurface:

Glass: Glassbal:

Matte: Metal:

Paintedplastic: Plastic:

Rmarble: Rsmetal:

Shinymetal: Spatter:

Stippled: Stone:

Texmap: Wood:

(Note: still working on paintedplastic and texmap...)


Dynamic Shaders

Shader parameters can be animated like any other values in AL. The example animation below contains an animated marble shader.

Animation:

Source Code


Transforming Shaders

Shaders can be transformed using the current graphics state transformation just like gprims. Using a "xfm-separator" will allow transformation gops to affect the shader alone. Below is an example of a "spatter" surface shader being rotated.

Animation:

Source Code

Probe-Shader

Information can be found on individual shaders using the function "probe-shader". Probe shader take the string name of a shader and returns information about its fields and values:
  ox --> (probe-shader "plastic")
  surface plastic
    Ks 0.5
    Kd 0.5
    Ka 1
    roughness 0.1
    specularcolor (1 1 1)
Slightly more information can be gained by adding the optional argument "#t":
  ox --> (probe-shader "plastic" #t)
  surface plastic
  ("Ks" "uniform" "scalar" "" 0.5)
  ("Kd" "uniform" "scalar" "" 0.5)
  ("Ka" "uniform" "scalar" "" 1)
  ("roughness" "uniform" "scalar" "" 0.1)
  ("specularcolor" "uniform" "color" "rgb" (1 1 1))


Return to AL Introduction
mrl