logistics
play

Logistics The Renderman Shading Language Checkpoint 3 Grading - PDF document

Logistics The Renderman Shading Language Checkpoint 3 Grading underway Checkpoint 4 Due Monday RenderMan Assigned today (but not due for several weeks) Project Proposals All should have received e-mail feedback.


  1. Logistics The Renderman Shading Language  Checkpoint 3  Grading underway  Checkpoint 4  Due Monday  RenderMan  Assigned today (but not due for several weeks)  Project Proposals  All should have received e-mail feedback. Logistics Projects  Grad students  Approx 26-28 projects  Listing of projects now on Web  Please send topic of grad report.  Presentation schedule  Presentations (15 min max)  Last 4 classes (week 9 + week 10 + finals week)  Sign up  Email me with 1 st , 2 nd , 3 rd choices  First come first served. Motivational Films Computer Graphics as Virtual Photography  Since we are talking about real camera photo Photographic Photography: scene (captures processing print Renderman… light)  Pixar Films processing  Luxo, Jr.  Tin Toy camera Computer 3D tone synthetic  Geri’s Game model Graphics: models reproduction image (focuses Pat Hanrahan simulated lighting) 1

  2. Renderman Shading Language Computer Graphics as Virtual Photography  Renderman consists of three parts: real camera photo Photographic Photography: scene (captures processing print  Functional scene description mechanism (API for light) C) Renderman is an Interface!  State Model Description – Maintains a current graphics processing state that can be placed onto a stack.  Geometry is drawn by utilizing the current graphics state.  File format - Renderman Interface Bytestream camera Computer 3D synthetic tone (RIB) model Graphics: models reproduction image (focuses  Shading Language and Compiler. simulated lighting) Renderman Shading Language Renderman Shading Language  Renderman Shading Language  Unlike other shading languages, Rendeman allows for procedural definition of all types of  Inspired by Cook’s shade trees light transport, not just reflection  Goals  Light emission  Abstract shading language based on ray optics,  Atmospheric effects independent of any specific algorithm or  Reflection implementation  Transmission  Interface between rendering program and  Transformations shading model  High level language that is easy to use.  Bump Mapping Renderman Shading Language Renderman Shading Language  Types of shaders  Types of Shaders  Light source shaders - calculates the color of  Displacement Shaders - perturb the surface of a light being emitted in given direction. an object  Surface reflectance shaders - computes the  Transformation Shaders - apply geometric light reflected from a surface in a given transformations to coordinates direction  Imager Shader - post processing on image  Volume shaders - implements the effect of pixels. light passing through a volume of space, i.e., exterior, interior and atmospheric scattering  Note: Not all shaders need be available in effects. an implementation! 2

  3. Renderman Shading Language Solids Runtime architecture Shader 1 Shader Shader / render link RenderMan “object” file Shader 2 slc Shader Shader 3 “object” Graphics file state Shader “object” file Rendering Use CSG and hierarchical modeling to build models application [ Renderman Companion , 60] Renderman Shading Language 3D Coordinate Systems RenderMan scene description WorldBegin LightSource "ambientlight" 1 "intensity" 0.5 LightSource "distantlight" 1 "from" [0 1 4] "to" [0 0 0] "intensity" 0.8 AttributeBegin Color [ 1.0 1.0 1.0 ] Surface "brick" "brickwidth" 1.0 "brickheight" 0.25 "mortarthickness" 0.05 Polygon "P" [ -5 -5 0 5 -5 0 5 5 0 -5 5 0 ] AttributeEnd AttributeBegin Translate 0 0 2 Color [1 1 .06] Surface "plastic" Sphere 1 -1 1 360 AttributeEnd WorldEnd [ Renderman Companion , 52] Renderman Shading Language Renderman Shading Language  Dataflow Model  Built in data types  float  string  color - 3 element vector. Several color spaces are supported.  point - 3D vector representing a point or vector in space.  Cannot add types [ Renderman Companion , 277] 3

  4. Renderman Shading Language Renderman Shading Language  Features  Built in operations  C-like  Arithmetic, trigonometric, derivative  Declaration – not a function but a shader  Control (if-then-else, for, while, etc)  Instance variables (shader arguments)  Vector (dot product, cross product)  Local variables  Geometric (length, distance, etc.)  Global variables (e.g., for color and opacity for  Lighting (secular, diffuse, ambient, surfaces) illuminance)  No return type  Texture mapping functions  Shader modifies global graphic state variables Renderman Shading Language Light Shaders Attaching shaders to object  RiLightHandle RiLightSource (“name”, parameterlist); or LightHandle LightSource “name” parameterlist - sets shader “name” to be the current light source shader  RiSurface (“name”, parameterlist); or Surface “name” parameterlist - sets shader “name” to be the current surface shader. RiAtmosphere (“name”, parameterlist); or  Atmosphere “name” parameterlist - sets shader “name” to be the current atmosphere shader. [ Renderman Companion , 277] Light Shaders  Describes the directions, amounts, and colors of illumination distributed by a light source in a scene.  Will get called by surface shaders that “query” the scene Light Source for light sources.  May contain solar and illuminate calls. Shader  Global variables State  Ps – position of point on the surface being shaded  L – vector giving direction from the light source to the point being shaded (this vector will be used by surface shaders)  Cl – color of the energy emitted. Setting this variable is the purpose of a light shader. [Hanrahan, 1990] 4

  5. Light Shaders Light Shaders light  L is not usually set explicitly, instead, L ambientlight (float intensity = 1; is usually set by auxiliary lighting color lightcolor = 1) functions: {  solar – directional distribution Cl = intensity * lightcolor; globals solar (vector axis, float spreadangle) { } L = 0; -- will set L to axis }  Illuminate – point light distribution L is vector from light source to point being shaded  illuminate (point from) { }  Sets L to Ps - from Note: Up to programmer to accumulate results of reflectance computation Light Shaders Light Shaders light distantlight light pointlight ( float intensity = 1; ( float intensity = 1; color lightcolor = 1; color lightcolor = 1; point from = point "camera" (0,0,0) ) point from = point "camera" (0,0,0); { Position of light source point to = point "camera" (0,0,1)) illuminate (from) { Cl = intensity * lightcolor / (L . L); solar (to - from, 0.0) Coordinate system } Cl = intensity * lightcolor; Distance 2 to convert to } (dot product) Note: illuminate does expect a position for the light source. With no axis, Note: solar restricts illumination to a range of directions without specifying a angle, means it illuminates in all directions. position for the source. Light Shaders Light Shaders Spotlight geometry  Another form of illuminate  illuminate (point from, vector axis, float angle)  Will set L to Ps – from  Light only em itted within a cone (of a given angle) around a given axis  Spotlights [ Renderman Companion , 223] 5

  6. Light Shaders Light Shaders light spotlight ( float intensity = 1; color lightcolor = 1; point from = point "camera" (0,0,0); Instance point to = point "camera" (0,0,1); Variables float coneangle = radians(30); float conedeltaangle = radians(5); float beamdistribution = 2 ) { uniform point A = (to - from) / length (to - from); Local uniform float cosoutside = cos (coneangle); uniform float cosinside = cos (coneangle - conedeltaangle); Variables float atten, cosangle; illuminate (from, A, coneangle) { cosangle = (L . A) / length(L); atten = pow (cosangle, beamdistribution) / (L . L); atten *= smoothstep (cosoutside, cosinside, cosangle); Cl = atten * intensity * lightcolor ; } } Barn door to control shape of beam NOTE: smoothstep( min, max, val) – 0, if val < min; otherwise a smooth Hermite interpolation between 0 and 1 Light Shaders Light Shaders Intensity Intensity distribution across distribution based Gobos to control shape of beam beam on distance Surface Shaders Surface Shaders  Describes the color and opacity of the point being shaded.  Global variables (read-only)  Cs – surface color  Os – surface opacity  P – shading point  dPdu, dPdv – change in position wrt u,v  N – normal used in shader  Ng – actual surface normal [Renderman Companion , 277] 6

Recommend


More recommend