DOC PREVIEW
GT ECE 4893 - 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:

Projective Textures and Shadow Maps Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology2 What is projective texturing? • An intuition for projective texturing – The slide projector analogy From Stanford CS448A: Real-Time Graphics Architectures lecture 11; see graphics.stanford.edu/courses/cs448a-01-fall3 “Slide projector” in different locations Images from C. Everitt, “Projective Texture Mapping,” developer.nvidia.com/object/Projective_Texture_Mapping.html4 Texture matrix € strq⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ =120 0120120120 012120 0 0 1⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ LightFrustrum( projection)Matrix⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ LightView(lookat)Matrix⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ModelingMatrix⎡ ⎣ ⎢ ⎤ ⎦ ⎥ x0y0z0w0⎡ ⎣ ⎢ ⎢ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ From “The Cg Tutorial,” p. 252.5 Projective texturing vertex shader void 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”6 Projective texturing pixel shader void 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”7 Watch out for reverse projection! Images from C. Everitt, “Projective Texture Mapping,” developer.nvidia.com/object/Projective_Texture_Mapping.html8 A dramatic shadow in 2K Games’ BioShock From www.wired.com/gaming/gamingreviews/multimedia/2007/08/pl_bioshock?slide=16&slideView=69 The shadow mapping concept (1) • Depth testing from the light’s point-of-view – Two pass algorithm • First, render depth buffer from the light’s point-of-view – the result is a “depth map” or “shadow map” – essentially a 2D function indicating the depth of the closest pixels to the light – This depth map is used in the second pass Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639210 The 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 the light • this light position should be setup to match the frustum used to create the depth map • compare the depth value at light position XY in the depth map to fragment’s light position Z Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639211 The shadow mapping concept (3) • The Shadow Map Comparison – Two values • A = Z value from depth map at fragment’s light XY position • B = Z value of fragment’s XYZ light position – If B is greater than A, then there must be something closer to the light than the fragment • then the fragment is shadowed – If A and B are approximately equal, the fragment is lit Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639212 Shadow mapping with a picture in 2D (1) light source eye position depth map Z = A fragment’s light Z = B depth map image plane eye view image plane, a.k.a. the frame buffer The A < B shadowed fragment case Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639213 Shadow mapping with a picture in 2D (2) light source eye position depth map Z = A fragment’s light Z = B depth map image plane eye view image plane, a.k.a. the frame buffer The A ≅ B unshadowed fragment case Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639214 Shadow mapping with a picture in 2D (3) Note image precision mismatch! Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639215 Visualizing the shadow mapping technique (1) • A fairly complex scene with shadows Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/639216 • Compare with and without shadows Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (2)17 • The scene from the light’s point-of-view Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (3)18 • The depth buffer from the light’s point-of-view Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (4)19 • Projecting the depth map onto the eye’s view Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (5)20 • Projecting light’s planar distance onto eye’s view Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (6)21 • Comparing light distance to light depth map Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the shadow mapping technique (7)22 • Scene with shadows Slide from C. Everitt, “Shadow Mapping,” Powerpoint presentation, developer.nvidia.com/attach/6392 Visualizing the


View Full Document

GT ECE 4893 - Projective Textures and Shadow Maps

Documents in this Course
Load more
Download 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 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 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?