What's a Shader?

The Basics
Shaders: Masters and Instances
Functions
Special Appearance Types


The Basics 

In context of the RenderMan Artist Tools, there are "shaders" and then there are "appearances." The two are similar, but they have important distinctions. Knowing what the differences between a shader and appearance are will help ease the management of resources when working with the RenderMan Artist Tools.

So, an appearance is the general term we use to describe an individual instance of a procedural entity.  A shader is the principal procedural entity and an appearance is a description of how to invoke the procedure.  Basically, a shader is a program (written in the RenderMan shading language) that lives on disk as a resource, and an appearance is its interactive front, "appearing" in a palette and referring to one of these shader programs, its master. A shader can have an infinite variety of appearances. Gaving an effective strategy for creating, manipulating, and managing appearances and their shader masters is crucial, especially for large productions.

To fully describe an appearance to RenderMan, a number of RIB statements might be required.  Typically a shader instance might be described in a RIB file with a few statements that set up the Shader Space, followed by statements describing common material attributes, like color, followed by the RIB shader invocation, which is comprised of the shader type followed by a master reference and a list of parameters coupled with their values.

Using Slim you'll notice that there are many appearance types and that the type of an appearance has a large bearing on how you can use it.  Above are icons for the most common types of appearances you'll encounter when using Slim.  Only four of these types represent RenderMan entities directly and these are discussed in the section on Shaders and Instances below.  Most of the remaining appearance types are used as building blocks to develop custom RenderMan shaders.  We refer to these building blocks as functions and we describe the principal function types below.  Using the Appearance Editor, functions can be connected to other functions' parameters of the same type and this forms a sort of network of connected functions.  Before rendering, Slim converts such networks into one of the four RenderMan shader types and then constructs a RIB representation of the appearance with appropriate RenderMan Attributes, where applicable.

A few appearance types defy categorization and so we use that characteristic to categorize them. The Special Appearance Types described below do not have a one-to-one correspondence with a RenderMan shader or function.

Finally, appearances types that have a RIB representation are said to be attachable.  That is, they can be attached to objects in a scene via the Slim client.  All shader instances, a few function types, and the special appearance types are attachable.  The remaining function types are not attachable and can contribute to a rendering only through their effects on the networks of which they're members.
 


Shaders: Masters and Instances 

Slim supports all four common RenderMan shader types.  Any shader that has been compiled into Pixar's .slo file format can be imported into Slim. The .slo file is said to be the appearance master while the imported representation of the shader is called an instance.  Once a shader has been converted to .slo format its interface becomes frozen: the number, names, and types of the shader parameters become fixed.  However, because the parameter values can be changed, shaders are much more powerful and flexible than texture maps.   Shader developers frequently modify and recompile shaders during the development process and Slim provides a reload feature in which a shader instance is synchronized with its master.   Because parameters can be renamed, retyped or entirely removed, reloading can result in dramatic changes to your shader instances.

  Surface Shader

Surface shaders are attached to all geometric primitives and are used to model the optical properties of materials from which the primitive was constructed. A surface shader computes the light reflected in a particular direction by summing over the incoming light and considering the properties of the surface.

 
  Displacement Shader

Displacement shaders change the position and/or normals of points on the surface and can be used to place bumps on surfaces.

 
  Light Shader

 A light source shader calculates the color of the light emitted from a point on the light source towards a point on the surface being illuminated. A light will typically have a color or spectrum, an intensity, a directional dependency and a fall-off with distance. 

 
Volume Shader

Volume shaders modulate the color of a light ray as it travels through a volume. Volumes are defined as the insides of solid objects. The atmosphere is the initial volume defined before any objects are created. 


Functions: Slim Shading Networks

Functions are the building blocks that Slim assembles into "shading networks" which can then be flattened into RenderMan shaders. When any shader is built interactively, functions are assembled together to create a shading network. There are many types of functions serving many different purposes (or functions!).

A fine line exists between a Slim function and a RenderMan shader.  Any time you render a function, it must be converted to a RenderMan shader and compiled into a .slo file. This is done on the fly each time a fundamental change is made to your function network. An appearance is said to undergo a fundamental change when you perform one of:

  • create / delete / change a connection
  • change a parameter's value provider from Constant to Variable or Expression or vice versa

Slim supports functions whose types match the four common RenderMan shader types.  The distinction between a surface function and a surface shader is purely semantic.  The parameters of a shader are frozen in type and number and, most importantantly, can't be connected to other Slim functions.  Sometimes the very inflexibility of a shader is desireable and Slim provides the freeze command to convert a function network into an individual shader instance in your palette.

Functions are instances of templates. Templates are usually loaded when Slim is started and carry with them the RenderMan Shading Language (RSL) source code needed by Slim to generate fully functional RenderMan shaders.  When Template developers modify a template, Slim's handy reload feature can be used to synchronize template instances with their templates.

 

  Surface

A surface function's primary responsibility is to calculate the color and opacity for the surface and is usually little more than a connection point for one or more shadingmodel functions.  Shadingmodel functions can be layered and mixed using other functions. 

 

  Displacement

A displacement function's primary responsiblity is to perturb either the surface normals or the surface points.  The former is called bump mapping while the latter is known as displacement mapping.  Displacement functions usually provide the option to bump or to displace as well as one or more parameters where you'll connect pattern generators for your displacement.

 

  Light

A light function's role is to provide the outer hull of a lightsource shader.  This means that it controls the form of light - whether it's local or infinitely distant or  whether it emits environment light.  Usually light functions provide connection points for coloration, intensity, etc.   When connecting pattern generator functions you must make sure that they operate on the Surface Point Light manifold.  For example, you can create a slide projector by connecting the light color to an Image File node operating on a Surface Point Light manifold via a Perspective Z Projection.

 

Volume

A volume function's role is to provide the outer hull of a volume shader.  Pixar's PhotoRealistic RenderMan supports volume shaders for atmospheric effects and you can attach volumes to individual objects or to the entire scene.

 

  Shadingmodel

A shadingmodel function's role is to calculate the primary response of a surface to the prevailing light conditions. Once more, shadingmodel functions always form the core of a surface shader.  Since this amounts to a color and opacity at every point on the surface, shadingmodels can be combined and layered in interesting ways.

 

  Color

A color function calculates a color at every point.  Texture maps can be connected into your networks as functions that calculate colors.s

 

  Float

A float function calculates a single floating point value at every point.  Grayscale or binary texture maps can be accessed as float functions but float functions can also be arbitrarily valued.   Various rescaling functions can be used to bring a function's range into a desireable realm.

 

  Vector

A vector function calculates a 3D vector at every point.  Vector functions are used to perturb, or warp, fields of points.

 

  Normal

A normal function calculates a 3D normal at every point.

 

  Point

A point function calculates a 3D point at every point.

 

  Manifold

All functions operate on a domain.,  Some functions operate implicitly on a domain but most require its explicit specification.  For our purposes, this means that functions require a description of the surface that they're operating on and this requirement comes is the form of a manifold parameter. A manifold function either generates or transforms function domains.  Manifold functions encompass notions of 3D Surface Points, Reference Geometry, Projection, Tiling, Surface Parameterization and Warping.  Manifolds are a generalization of point functions and carry with them derivative information useful in antialiasing calculations.  A function network can operate on any number of manifolds but usually you'll choose a single manifold to drive all the calculations for a network.


Special Appearance 

Types Special appearance types are not representable as RenderMan shaders.

 Ensemble

Ensembles are used to collect many RenderMan behaviors into a single unit that can be attached to objects in your scene.  You can plug a single Surface, Displacement and Volume shader into an ensemble as well as a few LightSource shaders and a RIB Box..  You can also control common RenderMan attributes like Surface Color and Opacity, Displacement Bounds and Shading Rate here.

 
 RIB Box

RIB Boxes are a general means to enter arbitrary RIB into your scene.  The contents of your RIB box are first substituted, using the standard TCL substitution mechanisms and then directly inserted into the RIB stream.  You can even have a conditional RIB Box.   Here's an example that only puts out the RIB when calculating shadows.

[if {$ELEMENTTYPE == "shadow"} { 
  return "PixelSamples 1 1" 

}]s

 
 Map Generator

Map Generators are used to request additional rendering passes.  When using Slim standalone, these maps have no use.  When used with a client like MTOR you can request:

  • shadow - a depth map in Pixar's shadow file format.
  • softshadow - a collection of shadow maps that, when used together, enable prman to generate soft shadows.
  • reflection - an rgb image map used for the planar reflections.
  • reference - an rgb image map used for other special purposes.
  • depth - a depth map in TIFF format with depth values stored as 32 bit floats.

 

Here's a portion of the appearance editor with the attributes associated with a shadow map pass. 

These attributes control various details about how a map is generated:

Frequency - you can choose to generate a map: Never, Every Frame or Once Per Job.

Camera Name - the name of the camera to compute the map from. When you specify $OBJNAME, Slim requests a map for every object the Map Generator is attached to.

Near - the near clipping plane. When set to 0 we use global defaults.

Far - the far clipping plane. When set to 0 we use global defaults.

Map Resolution - the resolution of your map, measure in pixels.  Maps are always square, but might compensate for the contents via the screen window.

Objects in Map - the objects that participate in the map calculations.  When empty, all object participate.  You can also enter the name of a Maya set here.

Laziness - controls when to recalculate a map. Options are: Off, On and Use Global,   When Off a new map is calculated each time it's needed.   When set to On, MTOR only calculates the map if it's not already present. This setting is useful when you're in a tight interactive loop. When set to Use Global, we simply use the Global setting specified in the Render Globals dialog.

Depth Filter - chooses the depth filter for shadowmap generation.   Options are: min, max, average and midpt.

For more information about using computed maps see: Computed Maps- Generating Maps with Slim.

 

Pixar Animation Studios
(510) 752-3000 (voice)   (510) 752-3151 (fax)
Copyright © 1996- Pixar. All rights reserved.
RenderMan® is a registered trademark of Pixar.