renderman rendering - plaete.com · mental ray, vray • no rays are shot from the camera ... –...
TRANSCRIPT
Renderman Rendering
Jo Plaete Research – NCCA Symposium 2008
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
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
What is Renderman?
• Schematic
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
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
Rib Scene Description
• What?• Simple Rib File:Display "myRib.tiff" "file" "rgba"Projection "perspective"WorldBegin
Translate 0 0 2Sphere 1 -1 1 360
WorldEnd
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
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
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()
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
Renderman Procedural Primitives• Generated at rendertime via python script
100
1000
20000
20000
20000
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.
Renderman Shading Language
• Shader types– Surface Shader– Displacement Shader– Volume Shader– Light Shader
Renderman Shading Language
• Surface Orientation– Vectors N, I are available in shader for every point on
the surface together with other variables
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
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)
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;
}
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]
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;
}
Renderman Shading Language
• SPECULAR SHADING
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;
}
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;
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
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
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 " … "
Renderman Shading Language
- Cutter (RIB rendering/shader compilation)
128
512
Node Based Shading - SLIM
• Advantages– Fast– Reusable templates/appearances
• Demo
Node Based Shading - SLIM
• @ Pixar– RSL + SLIM combination
• Appearances + SLIM templates
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 !
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
Node Based Shading – Mental Mill
• Mental Mill demo– Shader network– Phenomenon– MetaSL debugging
Renderman Integration
• MAYA– Renderman For Maya– Renderman Studio– 3Delight maya– Animal Logic MAYAMAN
• XSI– 3Delight for XSI– XSIman
• Houdini
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
RFM – Renderman For Maya
• Lowpoly Mesh
0.06
RFM – Renderman For Maya
• Micropolygon – SubDiv Scheme at render time
0.06
RFM – Renderman For Maya
• Maya Shadow (DepthMap 1024)
0.15
RFM – Renderman For Maya
• RFM Deepshadow (DepthMap 1024, Samples 16)
0.33
RFM – Renderman For Maya
• RFM Deepshadow (DepthMap 1024, Samples 16)• ShadowFilterSize 15
0.46
RFM – Renderman For Maya
• RFM raytraced shadow (Shadow Rays 64, Light Radius 30)
1.11
RFM – Renderman For Maya
• Raytraced Reflections (Refl samples 4)
0.10
RFM – Renderman For Maya
• Raytraced Reflections (Refl samples 4, Reflection Blur 5.0)
+ Raytraced Shadow
1.35
RFM – Renderman For Maya
• Raytraced Refractions (R index 1.3, Refr Samples 32)
1.08
RFM – Renderman For Maya
• DOF (Pixel Samples 9-9, F Stop 1.000)
1.26
RFM – Renderman For Maya
• Motion Blur (Shutter Angle 360, Shutter Opening 0.9-1.0, MB type: SubFrame)
1.13
RFM – Renderman For Maya
• FUR + Maya Shadow (DepthMap 1024, PS 3-3)
2.10
RFM – Renderman For Maya
• FUR + DeepShadow (DepthMap 1024, DeepShadowSamples 32)
2.13
RFM – Renderman For Maya
• FUR + DeepShadow• + SIGMA HIDING
2.31
RFM – Renderman For Maya
• Sub Surface Scattering (Scat Strength 3, Scat Free Path 1.00)
0.42
RFM – Renderman For Maya
• GI + Renderradiosity (Max Variation 1.5)
1.26
RFM – Renderman For Maya
• GI - Colorbleeding
1.27
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/
Questions ?
• Presentation and project files can be downloaded via: http://blog.plaete.com