RenderMan For Artists #02 .rib file structure

Wanho Choi (wanochoi.com) (Review) REYES Algorithm

RenderMan renders micropolygons!

split dice

micropolygon grid patch primitive sub-patches a sub-patch four corners of a micropolygon

bust

individual micropolygon grid micropolygons sampling micropolygons at sub-pixel locations

collapsing visible-point list of each sub-pixel sample blending values into single color and opacity

RenderMan for Artists wanochoi.com (Review) RenderMan Pipeline

Modeling Rendering Programs Programs

Maya PRMan

Application 3DS Max AIR Specific Code RenderMan SoftImage|XSI Interface image

Houdini RenderMan .sl file C API Text Editor RenderDotC

.rib file compiler PRMan prman rndr

.rib 3Delight renderdl image Aqsis aqsis

RenderDotC renderdc RenderMan BMRT rendrib compliant compiled renderer shader

PRMan shader PRMan .slo

Pixie sdrc Pixie .sdr

.sl 3Delight shaderdl 3Delight .sdl Aqsis aqsl Aqsis .slx

image file RenderDotC shaderdc RenderDotC .dll, .so

BMRT slc BMRT .slc

RenderMan for Artists wanochoi.com RIB File Structure • The RIB format is formally defined in the RiSpec (RenderMan Interface Specification). – Scene descriptions (objects, lights, camera, …) are encoded as RIB files according to RiSpec. – In most RIB files, the RIB format version is specified at the top of the RIB file. (ex) version 3.04 • RIB file is a metafile. – RIB can be regarded as a set of commands for RenderMan to execute. – If some essential information are absence, RenderMan uses the default settings. • RIB file can be generated – with 3D animation packages (Maya, 3DS Max, Houdini, …). – with programming interface (C/C++, Python, Java, …) – by hand using text editors (Notepad, Wordpad, vi, …) • A new RIB can be generated from existing once by cutting and pasting sections of them. • Whitespace (tabs, newline characters, blank) are ignored.

Translate 0 0 5 Translate Translate Translate 0 0 5 Sphere 1 -1 1 360 Sphere 1 -1 1 360 0 0 5 0 Sphere 0 1 -1 1 360 5 Sphere 1 -1 1 360 • The character “#” is used to precede comments. – RenderMan ignores everything starting with a # till the end of the line containing it. • In RIB files, no forward referencing is allowed. – You cannot mention something first and then provide a definition for it later in the file. – The camera parameters and image options must come before scene definition. – Lights, materials and transforms must come before objects.

RenderMan for Artists wanochoi.com Coordinate System • Left handed camera coordinate system – The origin at the imaging plane – X-axis to the right – Y-axis up – Z-axis “into” the screen

• When the thumb of the left hand is pointed along the axis from the origin, the fingers curl to point in the direction of positive rotation.

Y

Z

X

RenderMan for Artists wanochoi.com Disk Examples • A Minimal RIB file

Display “result.tiff” “file” “rgb” WorldBegin WorldEnd

– Image resolution: 640 x 480 – Orthographic projection – A matte white surface shader which does not require light sources – A light located where the camera is and facing where the camera faces

• Draw a disk

Display “result.tiff” “file” “rgb” WorldBegin Disk 1 0.5 360 WorldEnd

– A quadric is always declared with its center at the origin. – If you want the object to be moved to someplace else, you have to give the appropriate transformation first, then declare the geometry.

• Move the disk

Display “result.tiff” “file” “rgb” WorldBegin Translate 0 0 3 Disk 1 0.5 360 WorldEnd

RenderMan for Artists wanochoi.com Quadrics • Primitives = Pre-defined surfaces = Build-in library of shapes – Each quadric has its own set of parameters describing its shape.

RenderMan for Artists wanochoi.com Quadrics Example - Sphere • Sphere

.rib .rib

Display "result.tiff" "file" "rgb" Display "result.tiff" "file" "rgb" WorldBegin WorldBegin Translate 0 0 10 Translate 0 0 10 Rotate 90 1 0 0 Rotate 90 1 0 0 Sphere 0.5 -0.5 0.5 360 Sphere 0.5 -0.2 0.5 360 WorldEnd WorldEnd

.rib .rib

Display "result.tiff" "file" "rgb" Display "result.tiff" "file" "rgb" WorldBegin WorldBegin Translate 0 0 10 Translate 0 0 10 Rotate 90 1 0 0 Rotate 90 1 0 0 Sphere 0.5 -0.2 0.2 360 Sphere 0.5 -0.2 0.2 120 WorldEnd WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Disk • Disk

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.0 Disk 0 0.7 270 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.0 Disk 0 0.7 120 WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Cylinder • Cylinder

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 7 Rotate 90 1 0 0 Cylinder 2 -3 3 270 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 7 Rotate 90 1 0 0 Cylinder 2 -1 1 200 WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Cone • Cone

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -2.5 7 Rotate -90 1 0 0 Cone 5 2 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -2.5 7 Rotate -90 1 0 0 Cone 5 2 180 WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Paraboloid • Paraboloid

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -0.5 1.5 Rotate 90 0 1 0 Rotate -90 1 0 0 Paraboloid 0.6 0.0 1.0 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -0.5 1.5 Rotate 90 0 1 0 Rotate -90 1 0 0 Paraboloid 0.6 0.3 1.0 330 WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Hyperboloid • Hyperboloid

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 2.0 Rotate 90 0 1 0 Rotate -90 1 0 0 Hyperboloid 0.15 -0.8 -0.5 0.25 0.25 0.6 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 2.0 Rotate 90 0 1 0 Rotate -90 1 0 0 Hyperboloid 0.4 1.0 -0.5 0.5 0.5 1.0 300 WorldEnd

RenderMan for Artists wanochoi.com Quadrics Example - Torus • Torus

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.5 Torus 0.5 0.25 0 360 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.5 Torus 0.6 0.1 0 360 120 WorldEnd

RenderMan for Artists wanochoi.com RIB File Structure • FrameBegin / FrameEnd – Description of a single frame to be rendered. – A frame can contain any number of world blocks that can generate texture maps, shadow maps, background elements, or any other renderings required to make the “real image”

• WorldBegin / WorldEnd – Scene description of a single image. – The current transformation matrix is stored as the camera-to-world matrix, and the new object-to-world matrix is initialized with the identity matrix

• AttributeBegin / AttributeEnd – AttributeBegin pushes the entire graphics attribute state, including the transformation stack. – Although attribute blocks are typically used inside the world block, it is perfectly legal to use tem outside as well.

• TransformBegin / TransformEnd – TransformBegin pushes the transformation stack but leaves all other attributes alone. AttributeBegin TransformBegin – Tranform blocks can be nested within attribute blocks, and vice versa, … … TransformBegin AttributeBegin … … but the stacking must always be balanced. TransformEnd TransformEnd … … AttributeEnd AttributeEnd ※ A block inherits the state of the parent block. ※ Blocks can be nest within other blocks, but they cannot intersect each other.

RenderMan for Artists wanochoi.com FrameBegin / FrameEnd

.rib

Format 640 640 1 Projection "perspective" "fov" 20

Translate 0 0 5

FrameBegin 1 Display "result.0001.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 1 Sphere 1 -1 1 360 WorldEnd FrameEnd

FrameBegin 2 Display "result.0002.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 4 Sphere 1 -1 1 360 WorldEnd FrameEnd

FrameBegin 3 Display "result.0003.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 8 Sphere 1 -1 1 360 WorldEnd FrameEnd

RenderMan for Artists wanochoi.com More on Transformations

.rib

Display "result.tiff" "file" "rgb"

Projection "perspective" "fov" 40

WorldBegin Translate 0 0 5 Rotate -120 1 0 0 Color 1 0 0 Cylinder 1 -1 1 360 WorldEnd

RenderMan for Artists wanochoi.com References

• Cook, Robert L., Loren Carpenter, Edwin Catmull, The Reyes Image Rendering Architecture, SIGGRAPH 87. • Saty Raghavachary, Rendering for Beginners: Image synthesis using RenderMan, Focal Press, 2004 • Rudy Cortes, Saty Raghavachary, The RenderMan Shading Language Guide, Thomson Course Technology, 2007 • Ian Stephenson, Essential RenderMan Fast, Springer, 2003 • Anthony A. Apodaca, Larry Gritz, Advanced RenderMan: Creating CGI for Motion Pictures, Morgan Kaufmann, 1999

• http://old.siggraph.org/education/materials/renderman/pdf_tutorial/rman_booklet.pdf • http://old.siggraph.org/education/materials/renderman/pdf_tutorial/poets.pdf

RenderMan for Artists wanochoi.com