Local IlluminationRay CastingSlide 3Slide 4IlluminationGoalOverviewModeling Light SourcesEmpirical ModelsOpenGL Light Source ModelsPoint Light SourceDirectional Light SourceSpot Light SourceSlide 14Modeling Surface ReflectanceSlide 16OpenGL Reflectance ModelSlide 18Diffuse ReflectionSlide 20Slide 21Slide 22Slide 23Specular ReflectionGeometry of ReflectionSlide 26Slide 27Slide 28Slide 29Slide 30EmissionSlide 32Ambient TermSlide 34Slide 35Slide 36Surface Illumination CalculationSlide 38Slide 39Global IlluminationShadowsRay Casting (last lecture)Recursive Ray TracingMirror reflectionsTransparencySlide 46Refractive TransparencyRefractive TranparencySlide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55PrecisionSummaryIllumination TerminologyGreg HumphreysCS445: Intro GraphicsUniversity of Virginia, Fall 2003Local IlluminationGreg HumphreysUniversity of VirginiaCS 445, Fall 2003Ray CastingImage RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}Image RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}WireframeRay CastingImage RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}Image RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}Without IlluminationRay CastingImage RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}Image RayCast(Camera camera, Scene scene, int width, int height){Image image = new Image(width, height);for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Ray ray = ConstructRayThroughPixel(camera, i, j);Intersection hit = FindIntersection(ray, scene);image[i][j] = GetColor(scene, ray, hit);}}return image;}With IlluminationIllumination•How do we compute radiance for a sample ray?Angel Figure 6.2image[i][j] = GetColor(scene, ray, hit);Goal•Must derive computer models for ...Emission at light sourcesScattering at surfacesReception at the camera•Desirable features …ConciseEfficient to compute“Accurate”Overview•Direct (Local) IlluminationEmission at light sourcesScattering at surfaces•Global illuminationShadowsRefractionsInter-object reflectionsDirect IlluminationModeling Light Sources•IL(x,y,z,) ... describes the intensity of energy, leaving a light source, …arriving at location(x,y,z), ...from direction (), ...with wavelength (x,y,z)LightEmpirical Models•Ideally measure irradiant energy for “all” situationsToo much storageDifficult in practiceOpenGL Light Source Models•Simple mathematical models:Point lightDirectional lightSpot lightPoint Light Source•Models omni-directional point sourceintensity (I0), position (px, py, pz), factors (kc, kl, kq) for attenuation with distance (d)2qlc0kkkIddIL2qlc0kkkIddILdLight(px, py, pz)Directional Light Source•Models point light source at infinityintensity (I0), direction (dx,dy,dz) 0IIL0IIL(dx, dy, dz)No attenuationwith distanceSpot Light Source•Models point light source with directionintensity (I0), position (px, py, pz), direction (dx, dy, dz)attenuation2qlc0kkk)(IddLDIL-2qlc0kkk)(IddLDIL-dLight(px, py, pz) DLOverview•Direct IlluminationEmission at light sourcesScattering at surfaces•Global illuminationShadowsRefractionsInter-object reflectionsDirect IlluminationModeling Surface Reflectance•Rs(,) ... describes the amount of incident energy, arriving from direction (), ...leaving in direction (,), …with wavelength Surface())Empirical Models•Ideally measure radiant energy for “all” combinations of incident angles Too much storageDifficult in practiceSurface())OpenGL Reflectance Model•Simple analytic model: diffuse reflection +specular reflection +emission +“ambient”SurfaceBased on modelproposed by PhongBased on modelproposed by PhongOpenGL Reflectance Model•Simple analytic model: diffuse reflection +specular reflection +emission +“ambient”SurfaceBased on Phong illumination modelBased on Phong illumination modelBased on modelproposed by PhongBased on modelproposed by PhongDiffuse Reflection•Assume surface reflects equally in all directionsExamples: chalk, claySurfaceDiffuse Reflection•How much light is reflected?Depends on angle of incident lightSurfaceDiffuse Reflection•How much light is reflected?Depends on angle of incident lightSurfacedL cosdAdLdADiffuse Reflection•Lambertian modelcosine law (dot product)LDDILNKI )( -LDDILNKI )( -SurfaceNLOpenGL Reflectance Model•Simple analytic model: diffuse reflection +specular reflection +emission +“ambient”SurfaceSpecular Reflection•Reflection is strongest near mirror angleExamples: mirrors, metalsNLRGeometry of ReflectionNIRN(I)iri=rGeometry of ReflectionNIRN(I) i=rcos(i)NGeometry of ReflectionNIRN(I) i=r-(I.N)N-I-2(I.N)N( ) ( ) ( )( ) ( )22NNR I I I N NR I I I N N+ - =- �= - �Specular ReflectionHow much light is seen?Depends on: angle of incident lightangle to
View Full Document