assignments
play

Assignments Please fill the dropboxes Lights Still catching up on - PDF document

Assignments Please fill the dropboxes Lights Still catching up on grading. Questions. Final exam effects Final exam effect Deliverables: Presentation: Research (Grads only) Final exam period Shader code


  1. Assignments  Please fill the dropboxes… Lights  Still catching up on grading.  Questions. Final exam effects Final exam effect  Deliverables:  Presentation:  Research (Grads only)  Final exam period  Shader code  Monday, May 19th  Documentation  12:30 - 2:30pm  Describe shader params  ICL5  Explain chosen implementation.  15 minutes per presentation  List constraints.  Give results. All the world’s a stage Plan for this week  Tonight: Light  Looking for stage crew  Critters  Lighting controls  Premiere of Virtual Theatre  Lights in RenderMan  May 3rd at noon-2pm  Lights in GLSL  Rehearsals this and next week  A bit about shadows  Thursday:  Interested? Please see me.  Lighting Lab 1

  2. Light – Parameters Lights in Computer Graphics  Types of light  Controllable parameters for light sources:  Ambient  Position / Direction  Background light  Where is the light coming from and in what direction  Directional Light  Intensity  Light arriving from a given direction regardless of the shading point  How intense is the light  Point Light source  Distribution  Light positioned at a given point. Light distributed equally in all  What is the area of effect the beam directions  Spotlight  How does intensity vary within that area.  Point light source with a limited beam of effect  And of course…color  Area light source  Same triplet used for color and intensity (0 - 1)  Light emitted from a finite geometric area Light - Directional Light Light - Simple Point Light Source  Light distributed equally in all directions  Light distributed equally from a given direction  Point light source at infinity is an estimation for sunlight Light - Spotlight Light -- Spotlight  Basic CG Spotlight  Spotlight controls  Point light source with a limited beam  Beam shape  Beam Falloff  How intensity is effected as one moves across the beam A  Intensity Falloff  How intensity is effected by the distance from light source to shading point. 2

  3. Light - Spotlight Light - Spotlight  Basic Shape -- cone  Shape  Barn doors (beam shape) [Advanced Renderman] Light - Spotlight Light - Spotlight  Beam Falloff  Shape – Gobos (use go between to shape beam) Light - Spotlight Light - Spotlight  Beam Falloff (at edge)  Intensity falloff  Intensity of light will decrease proportional to the inverse of the distance squared. 3

  4. Light -- Spotlight Light -- area light source  Intensity Falloff  Light emitted from a finite geometric source.  Note: RenderMan spec has support for area light sources however prman does not implement these features  Area light sources are often modeled as a set of point light sources. Light - Distribution RenderMan  Area Light Sources  A note about illuminance  sampled point sources within area  Recall the rendering equation: [ ] I ( x , x ) g ( x , x ) ( x , x ) ( x , x , x ) I ( x , x ) d x � = � � � + � � � � � � � � � � S Illuminance is meant to estimate this integration Questions? RenderMan RenderMan  Light shaders  Light source shader “global variables”  Used to define the color, intensity, and direction of  Input: the light.  Ps -- point on the surface that requested data from the  Works in concert with illuminance light  Illuminance will loop over all light sources in a given solid  (others for area light source -- not supported in prman) angle  Output:  It will query each light source to see if the light source has effect.  L -- vector giving the direction from the light to the point being shaded  Querying == running the light source shader for the light source.  Cl -- Color of the energy being emitted by the source in the direction of Ps. 4

  5. Renderman Renderman  Implementing ambient light  Reason d’etre of the light source shader is to set L and Cl.  Handy lighting constructs that’ll do that for light ambient (float intensity = 1; you. color lightcolor = 1;)  For directional light: { solar (vector axis, float spread) { Cl = intensity * lightcolor; } L = 0; L will always be set to axis } solar will compare illuminance angle to axis if not in range, solar block will not be executed, RenderMan RenderMan light  For point light sources distantlight (float intensity = 1; illuminate ( point from) { color lightcolor = 1; } point from = point “shader” (0,0,0); point to = point “shader” (0, 0, 1);) illuminate (point from; vector axis; { float angle) { solar (to-from, 0) { Cl = intensity * lightcolor; } } } Sets L to the vector from the from point to Ps. Also will check if illuminance spread is within range RenderMan RenderMan light light simplespot (float intensity = 1; pointlight (float intensity = 1; color lightcolor = 1; color lightcolor = 1; point to = point “shader” (0, 0, 1); point from = point “shader” (0,0,0);) point from = point “shader” (0,0,0); { float coneangle = radians (30);) illuminate (from) { { Cl = intensity * lightcolor / (L . L); uniform vector A = normalize (to-from); } illuminate (from, A, coneangle) { } Cl = intensity * lightcolor / (L . L); } 1/d 2 intensity } falloff 5

  6. RenderMan RenderMan  Then…in a surface shader:  Light categories: light simplespot (float intensity = 1; illuminance (“mylight”, P, Nf, PI/2) { color lightcolor = 1; point to = point “shader” (0, 0, 1); … point from = point “shader” (0,0,0); } float coneangle = radians (30); string __category =- “mylight”) RenderMan GLSL  Surface shaders can also access light shader  OpenGL lighting model: parameters from within an illuminance loop:  Emissive, ambient, diffuse, specular float lightsource (string param, output type  No solar or illuminate construct result)  If light source has a parameter named param with  Will need to code these construct as the given type, result is filled with the parameter GLSL functions. value and the function returns 1.0…Otherwise the function returns 0.0. GLSL - spotlight GLSL - spotlight  Simulating illuminate float illuminate (float3 P, float3 from, float3 axis, float angle) { float3 V = normalize (P - from); float cosCone = cos (angle); float cosDir = dot (V, axis); if (cosCone <= cosDir) return 1; else return 0; } 6

  7. GLSL - multiple lights GLSL - built in uniform variables  Array of light structures.  Use plain old for loop to simulate the illuminance loop  Questions?  Break? Projective Texture Maps Textures  Projective texture mapping is a method  Projective texture mapping of texture mapping that allows a textured image to be projected onto a scene as if by a slide projector.  What is it good for?  Shadow generation  Light masks -- gobos. Projective texture mapping Camera Coordinates  How it’s done.  Camera Orientation  Basic projection  The camera has it’s own 3D coordinate system based on it’s orientation  Create coordinate system about light  u,v,n  As you would set up your camera  u corresponds to x (as seen by the camera)  Convert point from world to light space  v corresponds to y (as seen by the camera)  Do perspective by dividing by z.  n corresponds to z (as seen by the camera)  Negative n is into the scene 7

  8. Camera coordinates Camera Coordinates  Defining camera orientation  View coordinate system may not coincide with world coordinate system.  Provide the camera location (eyepoint)  Must transform point in world (x,y,z) to a point in  Indicate what direction the camera is looking (lookat) coordinate system of view (u,v,n)  Give the “up” direction of the camera u x  Then � � � �  n = eyepoint – lookat � � � � v y  u = up x n � � � � M =  v = n x u n z � � � �  Note: right handed coordinate system � � � � 1 1 � � � � Camera Coordinates Perspective projection  (u x ,u y ,u z ) are  Replace camera with light! u u u  -eye• u  coordinates of unit u x y z   vector w.r.t. world space v v v -eye• v   x y z M =  Similar for v, n, -eye• n   n n n  ( eye ) is the origin of x y z   0 0 0 1 view space w.r.t world   space  If ups are aligned, simply use negative eye location values in the fourth column Perspective Projection Perspective Projection  In object space: M = Model matrix V p = View Matrix (of projector) P p = Projection Matrix (of projector) 8

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend