Title: CIS736-Lecture-34-20040419
1Introduction to Renderman
CIS736, Spring 2003 Shaun Budhram (Slides
modified from Rich Picklers 2001
Tutorial) Department of Computing and Information
Sciences, KSU Readings Chapter 7, Advanced
RenderMan
2Lecture Outline
- Readings Advanced RenderMan, Chapter 7
- Suggested Exercises Stretching
- RenderMan A Brief History
- Using BMRT
- The RIB File
- The Shading Language
- Writing a Shader
- Invaluable Resources
3RenderMan A Brief History
- Began at ILM research department, later Pixar
- What is RenderMan?
- An open specification anybody can implement the
standard - Pixar RenderMan, BMRT, RenderDotC
- A scenefile description for 3D rendering like
PostScript is for 2D - Programmable shading language
- C Programming Interface
- Directly Linked
- DSO
- Can be a standalone program or called from RIB.
4Using BMRT
- A free implementation of the RenderMan standard
- Available at http//www.oneblackpixel.com/bmrt/
- Rendrib the command line renderer
- Rendrib flags ltfilenamegt
- -d
- Forces display to screen
- Put a number afterward and it will render in
multiple passes - -v verbose. Tells you more about what is
happening while you render. - -stats displays some statistics after rendering
about CPU usage, etc. - Slc the shading language compiler
- Slc flags ltfilenamegt
- -dso compile to machine code
- -o name output to specified name
5The RIB File
- Structure
- State Machine similar to OpenGL
- C-linkage
Options global to the entire animation Options global to the entire animation Options global to the entire animation
Frame Block Frame Block
Image options Camera options
World Block Attributes, lights, primitives
Changed Options
Another world block
Next frame block Next frame block
6Types, Variables, Spaces
Float The only single number type. Use for counters as well as normal applications of floats.
Point Float Triplet
Vector Float Triplet
Normal Float Triplet
Color Float Triplet
Matrix 4x4 Transformation Matrix
String Used for filenames, etc.
7Types, Variables, Spaces
- Variables global to all shaders
- Ultimate Goal Ci, Oi
point P Position of the point you are shading. Changing this variable displaces the surface.
normal N The surface shading normal at P. Changing N causes bump mapping.
normal Ng The true surface normal at P. This can differ from N N can be overridden in various ways including bump mapping and user provide vertex normals, but Ng is always the true surface normal of the facet you are shading.
vector I The incident vector, pointing from the viewing position to the shading position P.
color Cs, Os The default surface color and opacity, respectively.
float u,v The 2D parametric coordinates of P (on the particular geometric primitive you are shading).
float s, t The 2D texturing coordinates of P. These values can default to u,v but a number of mechanisms override the original values.
vector dPdu, dPdv The partial derivatives (ie, tangents) of the surface at P.
Time The time of the current shading sample.
float du, dv An estimate of the amount that the surface parameters u and v change from sample to sample.
vector L, color Cl These variables contain the information coming from the lights and may be accessed from inside illuminate loops only.
color Ci, Oi The final surface color and opacity of the surface at P. Setting these two variables is the primary goal of a surface shader.
8Types, Variables, Spaces
- Spaces
- Specified as a cast to variables
- point blah point shader (.5 .5 .5)
- Or using the transform functions transform,
vtransform, ntransform
Current The coordinate system that all points start in and the one in which all lighting calculations are carried out. Note that the choice of current space may be different on each renderer
Object The local coordinate system of the graphics primitive (sphere, patch, etc.) that we are shading.
Shader The coordinate system active at the time that the shader was declared (by the Surface, Displacement, or LightSource statement).
World The coordinate system active at WorldBegin.
Camera The coordinate system with its origin at the center of the camera lens, x-axis pointing right, y-axis pointing up, z-axis pointing into the screen.
Screen The perspective-corrected coordinate system of the cameras image plane. Coordinate (0,0) in screen space is looking along the z-axis of camera space.
Raster The 2D projected space of the final output image, with units of pixels. Coordinate (0,0) in raster space is the upper left corner of the image, with x and y increasing to the right and down, respectively.
9Writing a Shader (contd)
- Simple Sample Phong shader
surface phong ( float Ka1, Kd1, Ks0.5,
roughness0.1 color specularcolor1
) / Simple Phong Illumination Model /
normal Nf faceforward(normalize(N),I) vector
V -normalize(I) Ci Cs (Kaambient()
Kddiffuse(Nf)) Ksspecularcolorspecular
(Nf,V,roughness) Oi Os Ci Oi
10Writing a Shader (contd)
- Attaching to the RIB file
AttributeBegin Translate 0 -1.5
0 Rotate 20 0 0 1 Color 0.8 0.0 0.0 Surface
"phong" "Ka" .1 "Kd" .8 "Ks" 1
"roughness" 0.1 "specularcolor" 1 1 1 Basis
"bezier" 3 "bezier" 3 PatchMesh "bicubic" 13
"nonperiodic" 10 "nonperiodic" "P" 1.5 0 0 1.5
0.828427 0 0.828427 1.5 0 0 1.5 0 -0.828427 1.5 0
-1.5 0.828427 0 -1.5 0 0 -1.5 -0.828427 0
-0.828427 -1.5 0 0 -1.5 0 0.828427 -1.5 0 1.5
-0.828427 0 1.5 0 0 1.5 0 0.075 1.5 0.828427
0.075 0.828427 1.5 0.075 0 1.5 0.075 -0.828427
1.5 0.075 -1.5 0.828427 0.075 -1.5 0 0.075 -1.5
-0.828427 0.075 -0.828427 -1.5 0.075 0 -1.5 0.075
0.828427 -1.5 0.075 1.5 -0.828427 0.075 1.5 0
0.075 2 0 0.3 2 1.10457 0.3 1.10457 2 0.3 0 2 0.3
-1.10457
11Writing a Shader (contd)
- Other Shader types
- Displacement Shaders describe how surfaces
wrinkle or bump. - Light Shaders describe the directions, amounts
and colors of illumination and distributed by a
light source in the scene. - Volume Shaders describe how light is affected
as it passes through a participating medium such
as smoke or haze. - Advanced Topics
- Anti-Aliasing calculus!
- Lens flares
- Smoke, Clouds
- Cartoon Shaders
- Lighting models
12Lecture Outline
- Readings Advance RenderMan, Chapter 7
- Suggested Exercises Stretching
- RenderMan A Brief History
- Using BMRT
- The RIB File
- The Shading Language
- Writing a Shader
- Invaluable Resources
- BMRT homepage www.exluna.com/bmrt
- Renderman Newsgroup comp.graphics.rendering.rend
erman - www.renderman.org
- The Renderman Interface Specification. Available
at www.pixar.com