renderman rendering - plaete.com · mental ray, vray • no rays are shot from the camera ... –...

60
Renderman Rendering Jo Plaete Research – NCCA Symposium 2008

Upload: voquynh

Post on 02-Apr-2018

244 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Rendering

Jo Plaete Research – NCCA Symposium 2008

Page 2: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Overview

• What is Renderman?• RIB files• Renderman Procedural Primitives• Renderman Shading Language (RSL)• Node based Shading – SLIM, Mental Mill• Renderman integration

– RFM, 3Delight for XSI

Page 3: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

What is Renderman?• 1: Renderman Interface by Pixar

– Set of protocols describing how modeling application transfers data into renderer.

• Compatibility between modeling program and renderer

• 2: Renderman shading language• 3: Renderman renderers

– PRman (Pixar)– Aqsis– Air– 3Delight– Angel

Page 4: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

What is Renderman?

• Schematic

Page 5: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Why Renderman?

• INDUSTRY STANDARD– Lots of studios using it

• STANDARD– any RISpec compatible renderer can render out the

scene from any Rispec compatible exporter • PROGRAMABILITY

– great amount of control• IMAGE QUALITY• Designed for animation

Page 6: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman <> Mental Ray

• Renderman is a scanline renderer, no Raytracer in contrast to renderers like Mental Ray, Vray

• No rays are shot from the camera• Instead every surface point communicates

with the camera

Page 7: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Rib Scene Description

• What?• Simple Rib File:Display "myRib.tiff" "file" "rgba"Projection "perspective"WorldBegin

Translate 0 0 2Sphere 1 -1 1 360

WorldEnd

Page 8: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Rib Scene DescriptionDisplay "myRib.tiff" "file" "rgba"Projection "perspective"# move cameraTranslate 0 0 1Rotate 20 0 1 0# Add lightLightSource "distantlight" 1 "intensity" 1.0 "from" [5 5 -5] "to" [0 0 0]

WorldBeginSurface "Plastic“ # Add shaderColor 1 0 0 # Add ColorTranslate 0 0 2Sphere 1 -1 1 360

WorldEnd

Page 9: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Rib Scene Description

• XSI simple rib exporter – 1: Text based

• Print “Translate 2 2 2”– 2: CGkit python Ri binding

• RiTranslate(2,2,2)– Support for

• Camera (+-)• Lights• Primitives

Page 10: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Rib Scene Description• How?

– Find Camera and position (using matrix or manual translation/rotation)

• RiConcatTransform ( xsi_camera_matrix )• RiWorldBegin();

– Loop over scene and perform Ri per object• if(str(object.Type)==" pointlight "):• kineDict = gatherKine(object) # kinematics object• RiTransformBegin()• RiTranslate(kineDict['posx'], kineDict['posy'],

kineDict['posz']);• RiLightSource( "pointlight", RI_NULL)• RiTransformEnd()

Page 11: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Procedural Primitives

• Code executed at render time– Via Procedural "RunProgram" statement

• How?– When the renderer invokes a helper app it redirects its own

stdin and stdout streams to those of the helper app so that, for example, input and output from functions/procs such as printf(), print and puts no longer use the console but instead "feed" datato the renderer.

• Example: Massive

Page 12: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Procedural Primitives• Generated at rendertime via python script

Page 13: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

100

Page 14: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

1000

Page 15: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

20000

Page 16: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

20000

Page 17: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

20000

Page 18: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• Shader ?– Shader is a snippet of code that is attached to the surface or an item. This code

tells the renderer how the surface will behave when rendered. In fact, a shader is a function. It has input values and a slightly modified output value. That is, it behaves like a normal function, but it returns a value in a slightly different manner than a regular C style function.There are several types of shaders, but we will concentrate on surface shaders for now.

• Surface Shader ?– Surface shader is the one that describes optical properties of a surface. It can be

attached to geometry, and it describes how that surface "looks like" when exposed to light. With surface shader you describe what color will the surface expose, what kind of opacity will the surface have, etc. In a brief, surface shaders goal is to calculate the color of the surface (the color of the light leaving the object), and to calculate the opacity of the surface. The surface shader will be evaluated for each point of the attached surface.

Page 19: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• Shader types– Surface Shader– Displacement Shader– Volume Shader– Light Shader

Page 20: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• Surface Orientation– Vectors N, I are available in shader for every point on

the surface together with other variables

Page 21: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language• Writing simple surface shader• RIB test file:

Option "searchpath" "shader" "@:.“ # search for shaders in same folder

Display "test.tiff" "file" "rgba"Projection "perspective" "fov" 40Translate 0 0 9Rotate -120 1 0 0Rotate 25 0 0 1

WorldBegin

LightSource "distantlight" 1 "intensity" 1.0 "from" [2 0 4] "to" [0 0 0]

Surface "matte"Polygon "P" [-3 3 0 -3 -3 0 3 -3 0 3 3 0] "Cs" [0 1 0 0 0 1 1 1 1 1 0 0] # G-B-W-R

Translate 0 0 1Color 1 0.2 0.2Surface “constant"Sphere 1 -1 1 360

WorldEnd

Page 22: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• CONSTANT – FLAT LIT• SL:

surface j_simple_shader(){

Ci = Cs; #set output color (Ci) to input color out of RIB file (Cs)Oi = Os; #set output opacity (Oi) to input color out of RIB file (Os)Ci *= Oi; #multiply the opacity with the color

}

• Compile shader.sl > .slo (prman)

Page 23: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• DIFFUSE SHADING• SL:

surface j_simple_shader(float Kd=1){ # diffuse contribution argument

normal Nf = faceforward(normalize(N), I); # normalize N and make it face forward using ICi = Cs * ( Kd * diffuse(Nf) ); # collect light from sceneOi = Os; Ci *= Oi;

}

Page 24: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• DIFFUSE SHADING + Ambient• SL:

surface j_simple_shader(float Ka=1.0; float Kd=1){ # ambient contribution argument

normal Nf = faceforward(normalize(N), I);Ci = Cs * ( (Ka * ambient()) + (Kd * diffuse(Nf)) ); Oi = Os; Ci *= Oi;

}

! Ambient light needed in scene:LightSource "ambientlight" 1 "intensity" 0.3 "lightcolor" [1 1 0]

Page 25: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• SPECULAR SHADING• SL:

surface j_simple_shader(float Ka=0, Kd=1, Ks=0.5, roughness=0.1; color specularcolor=1;){

normal Nf = faceforward(normalize(N), I); vector V = -normalize(I); # V is the direction back to the camera (inverse I)

Ci = Cs * ( (Ka * ambient()) + (Kd * diffuse(Nf)) + ( Ks * specularcolor * specular(Nf, V, roughness) ) );

Oi = Os; Ci *= Oi;

}

Page 26: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• SPECULAR SHADING

Page 27: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language• Standard shader

surface j_standard_shader( float Ka = 1.0, Kd = 1.0, Ks = 0.5, roughness = 0.1; color specularcolor = 1;)

{/* INIT */normal Nf = faceforward(normalize(N), I);vector V = -normalize(I);color Ct;

/* Texturing */Ct = Cs; # e.g. use texturemap: Ct = color texture(mapname);

/* Shading */Ci = Oi * ( Ct * (Ka*ambient() + (Kd*diffuse(Nf)) + (Ks*specularcolor*specular(Nf, V, roughness))) );Oi = Os;

}

Page 28: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• Tiling Texture Map/*texturing*/float sRepeatCount=2;float tRepeatCount=2;float ss=mod(s*sRepeatCount,1);float tt=mod(t*tRepeatCount,1);if(mapname != "")

Ct = color texture(“texture.tex",ss,tt);else

Ct=Cs;

Page 29: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language• Ambient Occlusion shader

surfacej_ambientOcclusion(float samples = 16){

normal Ns = faceforward(normalize(N),I); // normalize N and flip it if backfacing

/* Compute occlusion */float hits = 0;gather("illuminance", P, Ns, PI/2, samples, "distribution", "cosine") {

hits += 1;}float occlusion = hits / samples;

/* Set Ci and Oi */Ci = (1.0 - occlusion) * Cs;Oi = 1;

}Surface "j_ambientOcclusion" "samples" 128

Page 30: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

• Ambient Occlusion shader

128

512

!! Enable Raytracing in RIB:Attribute "visibility" "int diffuse" 1 # make objects visible to raysAttribute "visibility" "int specular" 1 # make objects visible to raysAttribute "trace" "bias" 0.05

Page 31: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

Displacement shaderdisplacementj_noiseDisplacement(float Km = 0.2, freq_s = 4, freq_t = 4){float hump = 0;normal n = normalize(N);

hump = noise(s * s_freq, t * t_freq);# s and t are like u and v positions,# they got multiplied by desired frequencyP = P – ( Km * hump * n );# P = the surface positionN = calculatenormal(P);}

128

512

Displacement "j_noiseDisplacement“Surface " … "

Page 32: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Shading Language

- Cutter (RIB rendering/shader compilation)

128

512

Page 33: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Node Based Shading - SLIM

• Advantages– Fast– Reusable templates/appearances

• Demo

Page 34: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN
Page 35: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Node Based Shading - SLIM

• @ Pixar– RSL + SLIM combination

• Appearances + SLIM templates

Page 36: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Node Based Shading – Mental Mill

• New technology by mental images (nvidia)• Idea: Create shader and use it everywhere• How? MetaSL general shading platform

= platform/shading language independent• Interface:

– Access to MetaSL code– Low level nodes > graphical programming– Higher Level nodes > more artist friendly– Good debugging !

Page 37: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Node Based Shading – Mental Mill

• MetaSL levels of use: (same shader)– 1: Hardware

• Realtime engine– 2: Software

• Extra functionality such as raytacing, etc.• Achieved by substitution for level 1 and 2

– 3: Complex visual FX• All c++ facilities• Limits for hardware

Export: CgFx, HLSL, GLSL, C++, (maya,3dsmax,xsi)Renderman: soon

Page 38: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Node Based Shading – Mental Mill

• Mental Mill demo– Shader network– Phenomenon– MetaSL debugging

Page 39: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Renderman Integration

• MAYA– Renderman For Maya– Renderman Studio– 3Delight maya– Animal Logic MAYAMAN

• XSI– 3Delight for XSI– XSIman

• Houdini

Page 40: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya• RFM

– Micropolygon Subdivisions– Deepshadow– Rib Archives

• Render tests– Micropolygon Subdivision– Deepshadow– Raytrace shadows– Reflections– Refractions– Depth Of Field– Motion Blur– FUR + Deepshadows + Sigma Hiding– Sub Surface Scattering– GI + RenderRadiosity + Color Bleeding

Page 41: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Lowpoly Mesh

0.06

Page 42: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Micropolygon – SubDiv Scheme at render time

0.06

Page 43: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Maya Shadow (DepthMap 1024)

0.15

Page 44: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• RFM Deepshadow (DepthMap 1024, Samples 16)

0.33

Page 45: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• RFM Deepshadow (DepthMap 1024, Samples 16)• ShadowFilterSize 15

0.46

Page 46: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• RFM raytraced shadow (Shadow Rays 64, Light Radius 30)

1.11

Page 47: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Raytraced Reflections (Refl samples 4)

0.10

Page 48: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Raytraced Reflections (Refl samples 4, Reflection Blur 5.0)

+ Raytraced Shadow

1.35

Page 49: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Raytraced Refractions (R index 1.3, Refr Samples 32)

1.08

Page 50: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• DOF (Pixel Samples 9-9, F Stop 1.000)

1.26

Page 51: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Motion Blur (Shutter Angle 360, Shutter Opening 0.9-1.0, MB type: SubFrame)

1.13

Page 52: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• FUR + Maya Shadow (DepthMap 1024, PS 3-3)

2.10

Page 53: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• FUR + DeepShadow (DepthMap 1024, DeepShadowSamples 32)

2.13

Page 54: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• FUR + DeepShadow• + SIGMA HIDING

2.31

Page 55: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN
Page 56: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• Sub Surface Scattering (Scat Strength 3, Scat Free Path 1.00)

0.42

Page 57: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• GI + Renderradiosity (Max Variation 1.5)

1.26

Page 58: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

RFM – Renderman For Maya

• GI - Colorbleeding

1.27

Page 59: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

More/References

• Essential Renderman – Ian Stephenson• http://nccastaff.bournemouth.ac.uk/jmacey/Renderman/index.html

• The RenderMan Companion – Steve Upstill• http://www.pixar.com• http://cgkit.sourceforge.net/

Page 60: Renderman Rendering - plaete.com · Mental Ray, Vray • No rays are shot from the camera ... – Renderman For Maya – Renderman Studio – 3Delight maya – Animal Logic MAYAMAN

Questions ?

• Presentation and project files can be downloaded via: http://blog.plaete.com