Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

nVIDIA Shadow Mapping - Lecture Slides | CS 5610, Exams of Computer Science

Material Type: Exam; Class: Interactive Comp Graph; Subject: Computer Science; University: University of Utah; Term: Unknown 2007;

Typology: Exams

Pre 2010

Uploaded on 08/31/2009

koofers-user-f8s
koofers-user-f8s 🇺🇸

5

(1)

10 documents

1 / 5

Toggle sidebar

Related documents


Partial preview of the text

Download nVIDIA Shadow Mapping - Lecture Slides | CS 5610 and more Exams Computer Science in PDF only on Docsity! 1 Cass Everitt NVIDIA Corporation cass@nvidia.com Shadow Mapping 2 Render Scene and Access the Depth Texture • Realizing the theory in practice • Fragment’s light position can be generated using eye-linear texture coordinate generation • specifically OpenGL’s GL_EYE_LINEAR texgen • generate homogenous (s, t, r, q) texture coordinates as light-space (x, y, z, w) • T&L engines such as GeForce accelerate texgen! • relies on projective texturing 3 What is Projective Texturing? • An intuition for projective texturing • The slide projector analogy Source: Wolfgang Heidrich [99] 4 About Projective Texturing (1) • First, what is perspective-correct texturing? • Normal 2D texture mapping uses (s, t) coordinates • 2D perspective-correct texture mapping • means (s, t) should be interpolated linearly in eye- space • so compute per-vertex s/w, t/w, and 1/w • linearly interpolate these three parameters over polygon • per-fragment compute s’ = (s/w) / (1/w) and t’ = (t/w) / (1/w) • results in per-fragment perspective correct (s’, t’) 5 About Projective Texturing (2) • So what is projective texturing? • Now consider homogeneous texture coordinates • (s, t, r, q) --> (s/q, t/q, r/q) • Similar to homogeneous clip coordinates where (x, y, z, w) = (x/w, y/w, z/w) • Idea is to have (s/q, t/q, r/q) be projected per- fragment • This requires a per-fragment divider • yikes, dividers in hardware are fairly expensive 6 About Projective Texturing (3) • Hardware designer’s view of texturing • Perspective-correct texturing is a practical requirement • otherwise, textures “swim” • perspective-correct texturing already requires the hardware expense of a per-fragment divider • Clever idea [Segal, et.al. ‘92] • interpolate q/w instead of simply 1/w • so projective texturing is practically free if you already do perspective-correct texturing! 2 7 About Projective Texturing (4) • Tricking hardware into doing projective textures • By interpolating q/w, hardware computes per- fragment • (s/w) / (q/w) = s/q • (t/w) / (q/w) = t/q • Net result: projective texturing • OpenGL specifies projective texturing • only overhead is multiplying 1/w by q • but this is per-vertex 8 Back to the Shadow Mapping Discussion . . . • Assign light-space texture coordinates via texgen • Transform eye-space (x, y, z, w) coordinates to the light’s view frustum (match how the light’s depth map is generated) • Further transform these coordinates to map directly into the light view’s depth map • Expressible as a projective transform • load this transform into the 4 eye linear plane equations for S, T, and Q coordinates • (s/q, t/q) will map to light’s depth map texture 9 Shadow Map Operation • Automatic depth map lookups • After the eye linear texgen with the proper transform loaded • (s/q, t/q) is the fragment’s corresponding location within the light’s depth texture • r/q is the Z planar distance of the fragment relative to the light’s frustum, scaled and biased to [0,1] range • Next compare texture value at (s/q, t/q) to value r/q • if texture[s/q, t/q] ≅ r/q then not shadowed • if texture[s/q, t/q] < r/q then shadowed 10 Dedicated Hardware Shadow Mapping Support • SGI RealityEngine, InfiniteReality, and GeForce3 Hardware • Performs the shadow test as a texture filtering operation • looks up texel at (s/q, t/q) in a 2D texture • compares lookup value to r/q • if texel is greater than or equal to r/q, then generate 1.0 • if texel is less than r/q, then generate 0.0 • Modulate color with result • zero if fragment is shadowed or unchanged color if not 11 OpenGL Extensions for Shadow Map Hardware (See Page 445) • Two extensions work together • SGIX_depth_texture (see page 445) • supports high-precision depth texture formats • copy from depth buffer to texture memory supported • SGIX_shadow (see page 445) • adds “shadow comparison” texture filtering mode • compares r/q to texel value at (s/q, t/q) • Multi-vendor support: SGI, NVIDIA, others? • Brian Paul has implemented these extensions in Mesa! 12 New Depth Texture Internal Texture Formats • SGIX_depth_texture supports textures containing depth values for shadow mapping • Three new internal formats • GL_DEPTH_COMPONENT16_SGIX • GL_DEPTH_COMPONENT24_SGIX • GL_DEPTH_COMPONENT32_SGIX (same as 24-bit on GeForce3) • Use GL_DEPTH_COMPONENT for your external format • Work with glCopySubTexImage2D for fast copies from depth buffer to texture • NVIDIA optimizes these copy texture paths
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved