Paper Summaries Any takers? The Renderman Shading Language Announcement Logistics SIGGRAPH animation screenings Checkpoint 3 Every Monday Due last Monday (still working on it) 12:30pm -- 2pm Checkpoint 4 Due Monday 07-1315 RenderMan To be given today Project Proposals Sponsored by RIT digital studio program All should have received e-mail feedback. (College Imaging Arts and Sciences) and Please address issues (if any) Rochester Chapter of SIGGRAPH. Projects Paper Summaries Approx 22 projects Any takers? Listing of projects now on Web Presentation schedule Presentations (15 min max) Last 3 classes (week 10 + finals week) Sign up Email me with 1 st , 2 nd , 3 rd choices First come first served. 1
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 synthetic tone Geri’s Game model Graphics: models reproduction image (focuses Pat Hanrahan simulated lighting) 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 image reproduction (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 shading model Transformations Bump Mapping High level language that is easy to use. 2
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! Renderman Shading Language Solids Runtime architecture Shader 1 Shader Shader / render link “object” RenderMan 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] 3
Renderman Shading Language Dataflow Model Renderman Shading Language 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] 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] 4
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] 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. 5
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] 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 6
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] Surface Shader State Surface Shaders More global variables (read-only) u,v – surface parameters s,t – texture coordinates du, dv – derivative of u,v L – direction to light source Cl – light color I – incident ray (eye to point) E – camera position [Hanrahan 1990] Surface Shaders Surface Shaders Even More global variables (read-write) Approaches to writing surface shaders Ci – shaded color Illumination model Oi – shaded opacity Texture Mapping Procedural Texture The purpose of a surface shader is to set Bump Mapping the values of these two variables. 7
Recommend
More recommend