DOC PREVIEW
GT ECE 4893 - Lecture 11: Projective Textures and Shadow Maps
School name Georgia Tech
Pages 26

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 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 26 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 26 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 26 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 26 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 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 11: Projective Textures and Shadow MapsProf. Aaron LantermanSchool of Electrical and Computer EngineeringGeorgia Institute of Technology2What is projective texturing?• An intuition for projective texturing– The slide projector analogySource: Wolfgang Heidrich [99]Source: Wolfgang Heidrich [99]From Stanford CS448A: Real-Time Graphics Architectureslecture 11; see graphics.stanford.edu/courses/cs448a-01-fall3“Slide projector” in different locationsImages from C. Everitt, “Projective Texture Mapping,”developer.nvidia.com/object/Projective_Texture_Mapping.html4Texture matrix strq⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ =120 0120120120 012120 0 0 1⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ LightFrustrum( projection)Matrix⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ LightView(lookat)Matrix⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ModelingMatrix⎡ ⎣ ⎢ ⎤ ⎦ ⎥ x0y0z0w0⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ From “The Cg Tutorial,” p. 252.5Projective texturing vertex shadervoid C9E4v_projTexturing(float4 position : POSITION, float3 normal : NORMAL, out float4 oPosition : POSITION, out float4 texCoordProj : TEXCOORD0, out float4 diffuseLighting : TEXCOORD1, uniform float Kd, uniform float4x4 modelViewProj, uniform float3 lightPosition, uniform float4x4 textureMatrix) { oPosition = mul(modelViewProj, position); // Compute texture coordinates for // querying the projective texture texCoordProj = mul(textureMatrix, position); // Compute diffuse lighting float3 N = normalize(normal); float3 L = normalize(lightPosition - position.xyz); diffuseLighting = Kd * max(dot(L, N), 0);}From “The Cg Tutorial”6Projective texturing pixel shadervoid C9E5f_projTexturing (float4 texCoordProj : TEXCOORD0, float4 diffuseLighting : TEXCOORD1, out float4 color : COLOR, uniform sampler2D projectiveMap){ // Fetch color from the projective texture float4 projColor = tex2Dproj(projectiveMap, texCoordProj); color = projColor * diffuseLighting;}From “The Cg Tutorial”7Watch out for reverse projection!Images from C. Everitt, “Projective Texture Mapping,”developer.nvidia.com/object/Projective_Texture_Mapping.html8A dramatic shadow in 2K Games’ BioShockFrom www.wired.com/gaming/gamingreviews/multimedia/2007/08/pl_bioshock?slide=16&slideView=69The shadow mapping concept (1)• Depth testing from the light’s point-of-view– Two pass algorithm• First, render depth buffer from the light’spoint-of-view– the result is a “depth map” or “shadowmap”– essentially a 2D function indicating thedepth of the closest pixels to the light– This depth map is used in the second passSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639210The shadow mapping concept (2)• Shadow determination with the depth map– Second, render scene from the eye’s point-of-view– For each rasterized fragment• determine fragment’s XYZ position relative to thelight• this light position should be setup to match thefrustum used to create the depth map• compare the depth value at light position XY inthe depth map to fragment’s light position ZSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639211The shadow mapping concept (3)• The Shadow Map Comparison– Two values• A = Z value from depth map at fragment’s lightXY position• B = Z value of fragment’s XYZ light position– If B is greater than A, then there must besomething closer to the light than thefragment• then the fragment is shadowed– If A and B are approximately equal, thefragment is litSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639212Shadow mapping with a picture in 2D (1)lightsource eyeposition depth map Z = Afragment’slight Z = Bdepth map image planeeye view image plane,a.k.a. the frame bufferThe A < B shadowed fragment caseSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639213Shadow mapping with a picture in 2D (2)lightsource eyeposition depth map Z = Afragment’slight Z = Bdepth map image planeeye view image plane,a.k.a. the frame bufferThe A ≅ B unshadowed fragment caseThe A ≅ B unshadowed fragment caseSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639214Shadow mapping with a picture in 2D (3)Note image precision mismatch!Note image precision mismatch!The depth mapThe depth mapcould be at acould be at adifferent resolutiondifferent resolutionfrom the framebufferfrom the framebufferThis mismatch canThis mismatch canlead to artifactslead to artifactsSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639215Visualizing the shadow mapping technique (1)• A fairly complex scene with shadowsthe pointthe pointlight sourcelight sourceSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/639216• Compare with and without shadowswith shadowswith shadowswithout shadowswithout shadowsSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Slide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Visualizing the shadow mapping technique (2)17• The scene from the light’s point-of-viewFYI: from theFYI: from theeyeeye’’s point-of-views point-of-viewagainagainSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Visualizing the shadow mapping technique (3)18• The depth buffer from the light’s point-of-viewFYI: from theFYI: from thelightlight’’s point-of-views point-of-viewagainagainSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Visualizing the shadow mapping technique (4)19• Projecting the depth map onto the eye’s viewFYI: depth map forFYI: depth map forlightlight’’s point-of-views point-of-viewagainagainSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Visualizing the shadow mapping technique (5)20• Projecting light’s planar distance onto eye’sviewSlide from C. Everitt, “Shadow Mapping,” Powerpointpresentation, developer.nvidia.com/attach/6392Visualizing the shadow mapping technique (6)21• Comparing light distance to light


View Full Document

GT ECE 4893 - Lecture 11: Projective Textures and Shadow Maps

Documents in this Course
Load more
Download Lecture 11: Projective Textures and Shadow Maps
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 Lecture 11: Projective Textures and Shadow Maps 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 Lecture 11: Projective Textures and Shadow Maps 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?