<<

1 Why Are We Talking About This? 2 An Introduction to RenderMan for all you GLSLers! 1. You never know – a future you might be in a position to use RenderMan in the making of movies, TV commercials, etc.

2. You can get RenderMan for free. It is fun to experiment with.

3. You will be surprised how close what you know now matches what you need to know to run RenderMan shaders. (Congratulations!)

Mike Bailey [email protected] This work is licensed under a Creative Commons You can get the non-commercial version of RenderMan by starting here: Attribution-NonCommercial-NoDerivatives 4.0 International License https://renderman.pixar.com/intro

Computer Graphics Computer Graphics IntroToRenderManForGLSL.pptx mjb – February 28, 2021 mjb – February 28, 2021 12

History of RenderMan, II 3 History of RenderMan, III 4

Image/Volume Rendering Hardware Studios Pixar Image Rendering Computer Software 1986: Luxo Jr.– Nominated for an Academy Award Star Trek II (1982) Young Sherlock Holmes (1985) 1988: Tin Toy – won Academy Award for Best Animated Short REYES 1993: RenderMan wins a Technical Academy Award

1995: RenderMan 1984 (1984) Pixar Animation Studios

RIB Shade Trees

Computer Graphics prman Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 34

Early Uses of RenderMan in Movies 5 6 , , Up, 2009 1999 2010

Brave, 2012 A Bug’s Life, 1998

Finding Nemo, 2003 Inside Out, 2015 , 2016 Coco, 2017

The Good Dinosaur, 2015

Wall-E, 2008 Ratatouille, 2007

Monsters University, 2013 Monsters Inc, 2001 2, 2011 Cars, 2006 , 2004 Soul, 2021

Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 56

1 7 RenderMan Software Rendering Pipeline 8

RIB File

Bounding Box Analysis

Split

Tangled, 2010 Dice into Microfacets

Moana, 2016 Call the Shaders

Do Front-to-Back Compositing

Assemble the Pixels

Frozen II, 2019 , 2013 Final Image Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 78

RenderMan Composites Starting at the Eye 9 RenderMan Renders at Higher-than-Screen-Resolution 10

First, let’s think about it back-to-front:

color12 2 color 2(1 2 ) black ,

color01 1 color 1(1 1 ) color 12 ,

* color00 color(1 0 ) color 01 .

Substituting gives us the front-to-back equation:

* color00 color(1) 011 color (1)(1) 0 122 color (1)(1)(1) 0 1 2 black .

Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 910

All Six RenderMan Shader Types 11 Fundamental Differences Between 12 RenderMan Shaders and GLSL Shaders

Topic RenderMan GLSL 1. Displacement ≈ GLSL Vertex Shader

2. Distortion / transformation Goals 1. Image quality, 2. Speed 1. Speed, 2. Image quality Vertex, Fragment, Geometry, 3. Surface ≈ GLSL Fragment Shader Shader Types Surface, Displacement (+4 others) Tessellation, Compute Surface Preprocessing Microfacets None [ ± Tessellation shaders] 4. Lighting Recompute Normals CalculateNormal None Getting Rid of Pixels Oi = 0.; discard; 5. Atmospheric / volumetric Surface/Fragment shader sets R, G, B, αr, αg, αb R, G, B, A [,Z] Shader Variables Uniform, Varying Attribute, Uniform, Out, In 6. Imaging Coordinate Systems Shader (=Model), World Model (=OC), Eye (≈WC) Noise Built-in Somewhat built-in or use a Texture Compile Shaders Must do yourself Driver does it for you Compiler messages Cryptic Cryptic RenderMan Built-in Microfaceting ≈ Manual or GLSL Tessellation

Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 11 12

2 13 14 Cartesian (X) Stripes Cartesian (X) Stripes stripes.sl surface stripes.rib stripes( float Prob = 0.4, // probability of seeing orange ##RenderMan RIB Ks = 0.5, version 3.03 Kd = 0.5, Declare "Prob" "uniform float" Tells RenderMan to start Ka = .1, using a surface shader roughness = 0.1; Display "stripes.tiff" "file" "rgb" file called stripes.slo color specularColor = color( 1, 1, 1 ) Format 512 512 -1 ) { ShadingRate 1 color stripeColor;

LightSource "ambientlight" 1 "intensity" [0.25] float x = xcomp( P ); LightSource "distantlight" 2 "intensity“ [0.75] "from“ [0 0 -10] "to" [0 0 0] //x = x + 0.30 * sin( 1. * ycomp(P) ); // adding a wobble float xfrac = mod( x, 1. ); Projection "perspective" "fov“ [70] WorldBegin if( xfrac < Prob ) stripeColor = color( 1., .5, 0. ); // beaver orange? Translate 0 0 8 else Surface "stripes" "Prob" 0.8 stripeColor = Cs; Color [1 1 1] Opacity [1 1 1] Says that we want to set varying vector Nf = faceforward( normalize( N ), I ); Sphere 3 -3 3 360 the Prob argument to vector V = normalize( -I ); Translate 2. 0. 0. that shader to 0.8 WorldEnd Oi = 1.; Ci = Oi * ( stripeColor * ( Ka * ambient( ) + Kd * diffuse(Nf) ) + specularColor * Ks * specular( Nf, V, roughness ) ); } Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 13 14

15 16 Cartesian (X) Stripes Rings

rings.rib ##RenderMan RIB version 3.03 Declare "Prob" "uniform float"

Display "rings.tiff" "file“ "rgb" Format 500 500 -1 ShadingRate 1

LightSource "ambientlight" 1 “intensity“ [0.25] LightSource "distantlight" 2 "intensity“ [0.75] "from“ [5 0 -10] "to“ [0 0 0]

Projection "perspective" "fov“ [70] WorldBegin Translate 0 0 8 Surface "rings" "Prob“ 0.6 Color [1 1 1] Opacity [1 1 1] Sphere 3 -3 3 360 Translate 2. 0. 0. WorldEnd

Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 15 16

17 18 Rings rings.sl Rings (= Polar Stripes) surface rings( float Prob = 0.4, Ks = 0.5, Kd = 0.5, Ka = .1, roughness = 0.1; color specularcolor = color( 1, 1, 1 ) ) { varying vector Nf = faceforward( normalize( N ), I ); vector V = normalize( -I );

float x = xcomp( P ); float y = ycomp( P ); float r = sqrt( x*x + y*y ); float rfrac = mod( r, 1. );

if( rfrac < Prob ) Ci = color( 1., .5, 0. ); else Ci = Cs;

Oi = 1.; Ci = Oi * ( Ci * ( Ka * ambient( ) + Kd * diffuse(Nf) ) + specularcolor * Ks * specular( Nf, V, roughness ) ); Computer} Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 17 18

3 19 dots.sl 20 Dots Dots surface dots.rib dots( float Diam = 0.10, // dot diameter ##RenderMan RIB Ks = 0.5, version 3.03 Kd = 0.5, Ka = .1, Declare "Diam" "uniform float" roughness = 0.1; color specularColor = color( 1, 1, 1 ) ) Display "dots.tiff" "file" "rgb" { Format 512 512 -1 float up = 2. * u; ShadingRate 1 float vp = v; float numinu = floor( up / Diam ); float numinv = floor( vp / Diam ); LightSource "ambientlight" 1 "intensity“ [0.25] color dotColor = Cs; LightSource "distantlight" 2 "intensity" [0.75] "from“ [5 8 -10] "to“ [0 0 0] if( mod( numinu+numinv, 2 ) == 0 ) { float uc = numinu*Diam + Diam/2.; Projection "perspective" "fov“ [70] float vc = numinv*Diam + Diam/2.; WorldBegin up = up - uc; vp = vp - vc; Translate 0 0 6 point upvp = point( up, vp, 0. ); Surface "dots“ "Diam“ 0.10 point cntr = point( 0., 0., 0. ); if( distance( upvp, cntr ) < Diam/2. ) Color [1 1 1] { Opacity [1 1 1] dotColor = color( 1., .5, 0. ); // beaver orange? TransformBegin } } Rotate 90 1. 0. 0. Sphere 3 -3 3 360 varying vector Nf = faceforward( normalize( N ), I ); vector V = normalize( -I ); TransformEnd WorldEnd Oi = 1.; Ci = Oi * ( dotColor * ( Ka * ambient( ) + Kd * diffuse(Nf) ) + specularColor * Ks * specular( Nf, V, roughness ) ); Computer Graphics Computer} Graphics mjb – February 28, 2021 mjb – February 28, 2021 19 20

21 Guess Who Else Makes Good Use of a Simple Shape? 22 Dots

Computer Graphics Computer Graphics mjb – February 28, 2021 mjb – February 28, 2021 21 22

4