DOC PREVIEW
UVA CS 445 - Local Illumination

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Greg HumphreysCS445: Intro GraphicsUniversity of Virginia, Fall 2004Local 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;}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;}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;}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 sources Scattering at surfaces Reception at the camera• Desirable features … Concise Efficient to compute “Accurate”2Overview• Direct (Local) Illumination Emission at light sources Scattering at surfaces• Global illumination Shadows Refractions Inter-object reflectionsDirect IlluminationModeling Light Sources• IL(x,y,z,θ,φ,λ) ... describes the intensity of energy, leaving a light source L, … arriving at location(x,y,z), ... from direction (θ,φ), ... with wavelength λ(x,y,z)LightEmpirical Models• Ideally measure irradiant energy for “all” situations Too much storage Difficult in practiceλOpenGL Light Source Models• Simple mathematical models: Point light Directional light Spot lightPoint Light Source• Models omni-directional point source intensity (I0), position (px, py, pz), factors (kc, kl, kq) for attenuation with distance (d)2qlc0kkkIddIL++=dLight(px, py, pz) Directional Light Source• Models point light source at infinity intensity (I0), direction (dx,dy,dz)0IIL=(dx, dy, dz)No attenuationwith distance3Spot Light Source• Models point light source with direction intensity (I0), position (px, py, pz), direction (dx, dy, dz) attenuation2qlc0kkk)(IddLDIL++•=dLight(px, py, pz) DLγOverview• Direct Illumination Emission at light sources Scattering at surfaces• Global illumination Shadows Refractions Inter-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” combinationsof incident angles Too much storage Difficult in practiceSurface(θ,φ)(γ,ψ)λOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceBased on modelproposed by PhongOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceBased on Phong illumination modelBased on modelproposed by Phong4Diffuse Reflection• Assume surface reflects equally in all directions Examples: chalk, claySurfaceDiffuse Reflection• How much light is reflected? Depends on angle of incident lightSurfaceθDiffuse Reflection• How much light is reflected? Depends on angle of incident lightSurfacedL!= cosdAdLdAθDiffuse Reflection• Lambertian model cosine law (dot product)LDDILNKI )( •=SurfaceNLθOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceSpecular Reflection• Reflection is strongest near mirror angle Examples: mirrors, metalsNLRθθ5Geometry of ReflectionNIRN(I)θiθrθi=θ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 light angle to viewerNLRVViewerαθθSpecular Reflection• Phong Model cos(α)nLnSSIRVKI )( •=NLRVViewerαθθThis is a physically-motivated hack!OpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”Surface6EmissionEmission ≠ 0• Represents light emanating directly from polygonOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceAmbient TermThis is a total hack (avoids complexity of global illumination)!• Represents reflection of all indirect illuminationOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceOpenGL Reflectance Model• Simple analytic model: diffuse reflection + specular reflection + emission + “ambient”SurfaceOpenGL Reflectance Model• Sum diffuse, specular, emission, and ambientLeonard McMillan, MIT7Surface Illumination Calculation• Single light source:LnSLDALAEIRVKILNKIKII )()( •+•++=NLRVViewerαθθSurface Illumination Calculation• Multiple light sources:))()((!•+•++=iiniSiiDALAEIRVKILNKIKIINL2VViewerL1Overview• Direct Illumination Emission at light sources Scattering at surfaces• Global illumination Shadows Transmissions Inter-object reflectionsGlobal IlluminationHenrik Wann JensenGlobal IlluminationShadows• Shadow term tells if light sources are blocked Cast ray towards each light source Li Si = 0 if ray is blocked, Si = 1 otherwise 0 < Si < 1  soft shadows (hack)!•+•++=LLLnSDAAEISRVKLNKIKII ))()((ShadowTermRay Casting (last lecture)• Trace primary rays from camera Direct illumination from unblocked lights only!•+•++=LLLnSDAAEISRVKLNKIKII ))()((8 I = IE+ KAIA+ (KD(N • L) + KS(V • R)n)SLILL!+ KSIR+ KTITRecursive Ray Tracing• Also trace secondary rays from hit surfaces Global illumination from


View Full Document

UVA CS 445 - Local Illumination

Documents in this Course
Lighting

Lighting

49 pages

Color

Color

20 pages

Clipping

Clipping

10 pages

Shadows

Shadows

95 pages

Color

Color

37 pages

Radiosity

Radiosity

49 pages

Clipping

Clipping

59 pages

Assign 3

Assign 3

28 pages

Splines

Splines

17 pages

Color

Color

17 pages

Load more
Download Local Illumination
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Local Illumination and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Local Illumination 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?