120 likes | 272 Views
Lecture 20. Introduction to Renderman. Monday, April 2, 2001 Rich Pickler Department of Computing and Information Sciences, KSU Readings: Chapter 7, Advanced RenderMan. Lecture Outline. Readings: Advance RenderMan, Chapter 7 Suggested Exercises: Stretching RenderMan – A Brief History
E N D
Lecture 20 Introduction to Renderman Monday, April 2, 2001 Rich Pickler Department of Computing and Information Sciences, KSU Readings: Chapter 7, Advanced RenderMan
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
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 www.exluna.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; float roughness = 0.1; color specularcolor = 1; ) { normal Nf = faceforward( normalize(N), I ); vector V = -normalize(I); color C = 0; illuminance( P ) { vector R = 2*normalize(N)* (normalize(N) . normalize( L )) - normalize( L ); C += Ka*Cs + Kd*Cs*( normalize(N) . normalize(L) ) + Ks*specularcolor* pow(( R . V ), 10); } Ci = C*Cs; }
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