120 likes | 260 Views
Lecture 38 of 42. Introduction to Renderman. Monday, 24 April 2006 Shaun Budhram (Slides modified from Rich Pickler’s 2001 Tutorial) Department of Computing and Information Sciences, KSU Readings: Chapter 7, Advanced RenderMan. Lecture Outline. Readings: Advanced RenderMan, Chapter 7
E N D
Lecture 38 of 42 Introduction to Renderman Monday, 24 April 2006 Shaun Budhram (Slides modified from Rich Pickler’s 2001 Tutorial) Department of Computing and Information Sciences, KSU Readings: Chapter 7, Advanced RenderMan
Lecture 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
RenderMan – 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.
Using BMRT • A free implementation of the RenderMan standard • Available at http://www.oneblackpixel.com/bmrt/ • Rendrib – the command line renderer • Rendrib [flags] <filename> • -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] <filename> • -dso compile to machine code • -o name output to specified name
The RIB File • Structure • State Machine similar to OpenGL • C-linkage
Types, Variables, Spaces • Available types
Types, Variables, Spaces • Variables global to all shaders • Ultimate Goal: Ci, Oi
Types, Variables, Spaces • Spaces • Specified as a cast to variables • point blah = point “shader” (.5 .5 .5); • Or using the transform functions: transform, vtransform, ntransform • point transform( string toSpaceName; point p_current);
Writing a Shader (cont’d) • Simple Sample: Phong shader surface phong ( float Ka=1, Kd=1, Ks=0.5, roughness=0.1; color specularcolor=1; ) { /* Simple Phong Illumination Model */ normal Nf = faceforward(normalize(N),I); vector V = -normalize(I); Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + Ks*specularcolor*specular(Nf,V,roughness); Oi = Os; Ci *=Oi; }
Writing a Shader (cont’d) • 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 **************
Writing a Shader (cont’d) • 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
Lecture 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.renderman • www.renderman.org • The Renderman Interface Specification. Available at www.pixar.com