RenderMan For Artists #01 RenderMan Architecture

Wanho Choi (wanochoi.com) The Road Ahead • Learning RenderMan is not easy or quick. However, it is not rocket science either. - Rudy Cortes -

RenderMan for Artists wanochoi.com We will explore … • The RenderMan Shading Language Guide – Rudy Cortes and Saty Raghavachary • Rendering for Beginners: Image synthesis using RenderMan – Saty Raghavachary • Advanced RenderMan: Creating CGI for Motion Pictures – Anthony A. Apodaca and Larry Gritz • Essential RenderMan – Ian Stephenson • The RenderMan Companion: A Programmer's Guide to Realistic – Steve Upstill

• SIGGRAPH course notes – 1992, 1995, 2000, 2001, 2002, 2003, 2006 • pdf files from web • Etc.

RenderMan for Artists wanochoi.com Rendering • What is rendering? – A series of works for determining the color and opacity value of a pixel – Scene (objects, lights, camera in 3D)  Image (2D)

• Rendering algorithms – Scanline – – Radiosity – etc.

• Commercial renderers – RenderMan – Mental Ray – V-Ray – POV-Ray – FurryBall – etc.

RenderMan for Artists wanochoi.com Ray Tracing Algorithm • A technique for generating an image by tracing the path of light through pixels in an image plane.

RenderMan for Artists wanochoi.com RenderMan • A standard technical specification created by for 3D scene description – RiSpec: RenderMan Interface Specification

• There are some RenderMan compliant renderers. – PRMan, AIR, , , , RenderDotC, BMRT, Mantra, etc. – It must meet all of the standard requirements laid out in the RiSpec.

• PRMan: Pixar's PhotoRealistic RenderMan® renderer – Usually, RenderMan = PRMan – It is just an API(Application Programming Interface) to communicate with renderers.

Modeling Rendering Programs Programs

Maya PRMan

3DS Max AIR RenderMan SoftImage|XSI Interface 3Delight image

Houdini Aqsis

Text Editor RenderDotC

RenderMan for Artists wanochoi.com Very Simple Example

.rib

Display "result.jpg" "file" "rgb" Projection "perspective" "fov" 30

WorldBegin Translate 0 0 5 Sphere 1 -1 1 360 WorldEnd

1-1_minimal_rib

• RIB: RenderMan Interface Bytestream

RenderMan for Artists wanochoi.com Two Main Parts of RenderMan • 3D scene description language

.rib

Display “sphere.tiff” “file” “rgb” Projection “perspective” WorldBegin Translate 0 0 2 Surface “myShader” “color surfaceColor” [1 0 0] Sphere 1 -1 1 360 WorldEnd

• Programmable shading language

.sl

surface myShader( color surfaceColor = color(1,1,1); color surfaceOpacity = color(1,1,1); ) { Oi = surfaceOpacity; 1-2_minimal_sl Ci = Oi * surfaceColor; }

RenderMan for Artists wanochoi.com How to Render Scene & Compile • Renderer

PRMan prman Pixie rndr .rib 3Delight renderdl image Aqsis aqsis RenderDotC renderdc

BMRT rendrib

• Shader compiler

PRMan shader PRMan .slo Pixie sdrc Pixie .sdr .sl 3Delight shaderdl 3Delight .sdl Aqsis aqsl Aqsis .slx RenderDotC shaderdc RenderDotC .dll, .so BMRT slc BMRT .slc

RenderMan for Artists wanochoi.com RenderMan Packages • RAT (RenderMan Artist Tools) – MTOR (Maya To RenderMan): Maya plug-in for translating Maya scene into RenderMan – Slim: the complete solution for shader management and creation using GUI – Alfred: the script processing system tool for network rendering – It (Image Tools): viewer, multiple images management

• RFM (RenderMan For Maya) – The latest (and greatest) bridges between Maya and RenderMan – A plug-in to Maya and renders to the RenderMan embedded renderer (entry-level product)

• RFM Pro (RenderMan For Maya Pro) – .rib is exposed to the user – allows renders to be dispatched to ProServer render nodes.

• RMS (RenderMan Studio) – RFM Pro – Slim – Alfred – It

• RPS (RenderMan Pro Server) – Standalone renderer + Alfred, It, …. – RPS will turn any server or artist desktop into a rendering machine. – Alfserver

RenderMan for Artists wanochoi.com REYES • “Render Everything You Ever Saw”

’s favorite spots on the California coastline, Point Reyes.

• Invented at (later Pixar) by Cook et al.

The Road to Point Reyes Directed by R. Cook, LucasFilm 1983

RenderMan for Artists wanochoi.com The Founders of REYES Algorithm • The Reyes Image Rendering Architecture – Robert L. Cook, Loren Carpenter, and – Computer Graphics, Vol. 21, No. 4, July 1987

RenderMan for Artists wanochoi.com REYES Goal (1986)

Item Spec.

Micropolygons (area=¼ pixel) 80,000,000

Pixels 3000 x 1667 (5 MP)

Depth complexity 4

Samples per pixel 16

Geometric primitives 150,000

Micropolygons per grid 100

Shading flops per micropolygon 300

Textures per primitive 6

Total number of textures 100 (1 MB/textures)

Render time ≤ 2 minutes / 1 frame

RenderMan for Artists wanochoi.com REYES Algorithm • A geometric pipeline, similar to those modern-day hardware

• A series of converting process from a primitive into a finer and more detailed version. – Splitting, dicing, busting, sampling

• Every geometry is diced up into grids of micropolygons. 주사위[체크] 무늬로 만들다

• Micropolygon – A quadrilateral facet – Approximately pixel-sized, but controllable by user – Input data structure into the shading stage – Four vertices get shaded and eventually contribute to final pixel colors & opacities

• Grid – A collection of micropolygons specified by grid size – Once micropolygon grids are shaded, the grids get busted into individual micropolygons containing colors, opacities at the corners. 깨다, 분할하다, 나누다

• Pros. – Uniformity in the shading pipeline – Future-proof when new geometry types come to

RenderMan for Artists wanochoi.com Algorithm Overview

RenderMan for Artists wanochoi.com REYES Rendering Algorithm

split dice

patch primitive sub-patches a sub-patch micropolygon grid 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 REYES Rendering Pipeline

RIB textures

Parsing

Clipping primitives

Outside? Discard Yes No

Too Splitting large? Yes No

Dicing into micropolygon grids

Shading grid vertices

Busting grid

Clipping micropolygons

Outside? Discard Yes No

Sampling at subpixel locations

Collapsing visible point lists

Blending sample colors, opacities

Result image

RenderMan for Artists wanochoi.com Grids and Micropolygons

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" "fov" [30]

ShadingRate 15.0

Translate -0.4 0.15 3 Rotate -20 1 0 0 Rotate -40 0 1 0

WorldBegin Surface “gmRandColor" ReadArchive “Gumbo.dat" WorldEnd

.sl

surface gmRandColor() { color Cgrid = randomgrid(); float mpc = 0.5 + 0.5*random();

Oi = Os; Ci = Cs * Os * mpc * Cgrid; }

1-3_grid_mcpg

RenderMan for Artists wanochoi.com Controls • Trade-off between … – Render time, quality, and memory

• Memory and performance related controls – Bucket size – Grid size

• Image quality related controls – Shading rate – Pixel samples – Pixel filter

RenderMan for Artists wanochoi.com Controls: Bucket Size • Bucket – A rectangular pixel block(=tile) which get processed(=rendered) by one by one – Default: 16x16 pixels

• Why needed? – To ensure that the memory requirements stay as low as possible – Imagine that when the REYES algorithm was designed, machines had less than 1MB of RAM but people wanted to render 2k frames with complex geometry diced into millions of µ- polygons and motion blur without going into swap.

• Guidance – Make the bucket size as large as possible: Usually, 16x16 or 32x32 or 64x64

• How to control – Ex) Option “limits” “bucketsize” [32 32]

[32 32] [64 64] RenderMan for Artists wanochoi.com Controls: Bucket Size (in Maya)

RenderMan for Artists wanochoi.com More on Bucketing • Bucket – A small rectangular pixel region divided from the image (default: 16x16 pixels) – A unit processed one by one in the rendering procedure – One bucket processed one at a time

Primitive A will be diced, shaded, and sampled in the current bucket. Primitive B needs to be split, and half will return to the current bucket while half will be handled in a future bucket. Primitive C is in the current bucket because its bounding box touches it, but once split, both child primitives will fall into future buckets. Primitive D will be diced and shaded in the current bucket, but some of the micropolygons generated will be held for sampling until the next bucket is processed.

Eventually, there are no more primitives in the current bucket’s list. They all have either been sampled or transferred to future buckets.

Smaller bucket size, more memory efficiency, but more overhead.

RenderMan for Artists wanochoi.com Controls: Shading Rate • Maximum area of micropolygons in pixels – Shading rate = 1: the size of the largest micropolygon ≒ 1 pixel

– With larger shading rate • Fast & low memory, but low image quality – With small shading rate • Slow & large memory, but high image quality

• Guidance – 1.0 : Mid-high level of detail rendering – 0.25 ~ 0.5: Production-quality rendering – 5.0 : Fast preview rendering

• How to control – Ex) ShadingRate 1.0

RenderMan for Artists wanochoi.com Controls: Shading Rate (in Maya)

RenderMan for Artists wanochoi.com Shading Rate Examples: 0.1

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 1.0

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 10.0

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 100.0

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 1000.0

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 10000.0

1-4_mcpg

RenderMan for Artists wanochoi.com Shading Rate Examples: 100000.0

1-4_mcpg

RenderMan for Artists wanochoi.com Controls: Grid Size • The maximum number of micropolygons in a grid – Optimal GridSize = ( BucketWidth × BucketHeight ) ÷ ShadingRate

• All micropolygons in a grid are shaded at once – One grid at a time, not one micropolygon at a time

• It is affected by “Bucket Size” and “Shading Rate”. – “Grid Size” is strongly related to “Bucket Size”.

• How to control – Ex) Option “limits” “gridsize” [1024]

1-5_grid

RenderMan for Artists wanochoi.com Controls: Grid Size (in Maya)

RenderMan for Artists wanochoi.com Today’s Key Words

• REYES • RiSpec • PRMan • RIB • Shader • Bucket • Grid • Micropolygon • Shading rate

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

• PRMan: http://www.pixar.com • 3Delight: http://www.3delight.com • Air: http://www.sitexgraphics.com • Aqsis: http://aqsis.org • Pixie: http://www.renderpixie.com • RenderDotC: http://www.dotcsw.com

• http://www.ugrad.cs.ubc.ca/~cs426/426-fall-2005/sept26-cs426-slides.pdf • http://graphics.stanford.edu/courses/cs448a-01-fall/lectures/lecture16/renderman.2up.pdf • http://www.graphicslive.co.kr/data/2008/03/0803_tech.pdf • http://www.dctsystems.co.uk/RenderMan/rmanBasics.html • http://en.wikipedia.org/wiki/Ray_tracing_(graphics) • http://www.k-3d.org/wiki/RenderMan_Controls

RenderMan for Artists wanochoi.com