Hardware accelerated rendering of antialiased shadows with shadow maps
Download
1 / 33

Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps - PowerPoint PPT Presentation


  • 169 Views
  • Uploaded on

Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps. Stefan Brabec and Hans-Peter Seidel Max-Planck-Institut f ür Informatik Saarbrücken, Germany. Overview. Introduction Shadow mapping using graphics hardware Hardware-based percentage closer filtering A faster approach

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps' - yagil


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Hardware accelerated rendering of antialiased shadows with shadow maps

Hardware-accelerated Rendering of Antialiased Shadows With Shadow Maps

Stefan Brabec and Hans-Peter Seidel

Max-Planck-Institut für Informatik

Saarbrücken, Germany


Overview
Overview Shadow Maps

  • Introduction

  • Shadow mapping using graphics hardware

  • Hardware-based percentage closer filtering

  • A faster approach

  • Results

  • Conclusions

Stefan Brabec, MPI Informatik


Introduction
Introduction Shadow Maps

  • Hardware-accelerated rendering mostlydominated by local effects

    • Triangle through-put

    • Fast lighting & texturing

  • Most important global effect are shadows

    • Two main classes of shadow algorithms

      • Shadow Volumes [Crow ’77]

      • Shadow Maps [Williams ’78]

Stefan Brabec, MPI Informatik


Shadow mapping
Shadow Mapping Shadow Maps

  • Sampling based approach

    • Generate depth map from light source position

      • Store depth values of frontmost pixels

    • Final rendering pass

      • Foreach pixel seen by the camera:

        • Transform to light source coordinate system

        • Compare corresponding entry in depth mapwith transformed camera depth

Stefan Brabec, MPI Informatik


Shadow mapping1
Shadow Mapping Shadow Maps

  • Shadow Maps

    • Make their way to hardware

      • SGI InfiniteReality, NVIDIA GeForce3, ATI

    • Implemented as special texture map operation

      • Compare value at (s/q,t/q) with r/q -> result 1 or 0

    • Can also be implemented using standard OpenGL

Stefan Brabec, MPI Informatik


Shadow mapping2
Shadow Mapping Shadow Maps

  • Pros:

    • Does not depend on scene geometry

    • Can be implemented using graphics-hardware

  • Cons:

    • Sampling problems (aliasing)

      • High resolution depth maps

      • Filtering

Stefan Brabec, MPI Informatik


Shadow mapping3
Shadow Mapping Shadow Maps

  • Percentage closer filtering [Reeves `87]

    • Filtering depth values makes no sense

    • Perform shadow test before filtering

Stefan Brabec, MPI Informatik


Shadow mapping4
Shadow Mapping Shadow Maps

  • Our Shadow Mapping Approach

    • Render scene as seen by light source

    • Encode depth values in alpha channel

    • Project this texture into the final scene

    • Subtract depth values to determine lit pixels

Stefan Brabec, MPI Informatik


Shadow mapping5
Shadow Mapping Shadow Maps

  • 1D ramp texturebrings depth tocolor values

Stefan Brabec, MPI Informatik


Hardware based pcf
Hardware-based PCF Shadow Maps

  • How can Reeves’ scheme be adopted for hardware-based shadow mapping ?

  • Idea:

    • Generate multi-channel depth mapwhere each entry contains also valuesof neighborhood pixels

Stefan Brabec, MPI Informatik


Shadow mapping6
Shadow Mapping Shadow Maps

  • Problem: 1D ramp texture can only use 256 depth values because of frame buffer depth

    • Only for scenes with moderate complexity

  • But: 16 bits possible with NVIDIA’sregister combiners

    • Use two color channels (high & low 8 bits)

    • See NVIDIA website for more details

Stefan Brabec, MPI Informatik


Hardware based pcf1
Hardware-based PCF Shadow Maps

  • Multi-channel shadow map

    • Use RGBA instead of alpha channel only

      • 4 values to sample a 2x2 region

      • Increases effective shadow map resolution by a factor of 2in each dimension

    • Shadow map generation:

      • Render scene four times where in each pass

        • One channel (R,G,B or A) is selected

        • Image-plane is jittered (stratified sampling)

      • Copy RGBA image to texture

Stefan Brabec, MPI Informatik


Hardware based pcf2
Hardware-based PCF Shadow Maps

  • Stratified sampling and pixel packing

Stefan Brabec, MPI Informatik


Hardware based pcf3
Hardware-based PCF Shadow Maps

  • Computing the percentage of shadowing

    • Final pass using all four channels

      • R = camera_z – light_z_sample_1

      • G = camera_z – light_z_sample_2

      • B = camera_z – light_z_sample_3

      • A = camera_z – light_z_sample_4

    • Channel is in shadow if value > 0

Stefan Brabec, MPI Informatik


Hardware based pcf4
Hardware-based PCF Shadow Maps

  • Computing the percentage of shadowing

    • Implemented using OpenGL Imaging Subset

64,63 corresponds to 25 % shadow

Sums up to 255 for full shadow

Stefan Brabec, MPI Informatik


Hardware based pcf5
Hardware-based PCF Shadow Maps

  • Larger filter sizes possible

    • Split up into parts of max. 4 components

    • Sum up shadow contributions using theaccumulation buffer

  • Problem:

    • Number of rendering passes (scene geometry)not really practical for dynamic scenes

Stefan Brabec, MPI Informatik


Fast pcf
Fast PCF Shadow Maps

  • Problem:

    • Previous algorithm needs four passesonly for shadow map generation

      • Unsuitable for very complex scenes

  • Fast PCF:

    • Use only one rendering pass and collectneighborhood pixels

Stefan Brabec, MPI Informatik


Fast pcf1
Fast PCF Shadow Maps

  • Fast PCF filtering and pixel packing

Stefan Brabec, MPI Informatik


Fast pcf2
Fast PCF Shadow Maps

  • Collect pixels using convolution

  • Currently the only hardware-acceleratedoperation to include information from adjacent pixels

Stefan Brabec, MPI Informatik


Fast pcf3
Fast PCF Shadow Maps

  • Assemble pixels using neighborhood channels

  • Center pixel consists of RGBA values taken from lower-left 2x2 region

  • Use larger (3x3) filter for best hardwaresupport

Stefan Brabec, MPI Informatik


Fast pcf4
Fast PCF Shadow Maps

  • Texture coordinate offset

    • Shift center pixel to be centered in 2x2 region

Stefan Brabec, MPI Informatik


Fast pcf5
Fast PCF Shadow Maps

  • Fast PCF only uses one rendering passfor shadow map generation

    • Suitable for larger filter sizes

    • Example: 4x4 footprint

      • Four passes which will sample the lower right, lower left, upper right and upper left2x2 region

      • Results in 4*5=20 shadowing levels

      • Four shadow map textures used

Stefan Brabec, MPI Informatik


Results
Results Shadow Maps

without filtering

Stefan Brabec, MPI Informatik


Results1
Results Shadow Maps

normal PCF (filter size 2x2)

Stefan Brabec, MPI Informatik


Results2
Results Shadow Maps

fast PCF (filter size 2x2)

Stefan Brabec, MPI Informatik


Results3
Results Shadow Maps

real PCF vs. fast PCF

Stefan Brabec, MPI Informatik


Results4
Results Shadow Maps

fast,multipass PCF (filter size 4x4)

Stefan Brabec, MPI Informatik


Results5
Results Shadow Maps

  • Timings & Overview

Machine: SGI Octane VPro/8Image Resolution: 800x600Shadow Map: 512x512Polygons: 7000

Frame rate

Generation

Shadowing

No filtering

30 fps

1 pass

2 levels

PCF 2x2

10 fps

4 passes

5 levels

Fast PCF 2x2

20 fps

1 pass

5 levels

PCF 4x4

< 0.5 fps

16 passes

20 levels

Fast PCF 4x4

5 fps

4 passes

20 levels

Stefan Brabec, MPI Informatik


Hardware accelerated rendering of antialiased shadows with shadow maps

no filtering Shadow Maps

Stefan Brabec, MPI Informatik


Hardware accelerated rendering of antialiased shadows with shadow maps

fast PCF (filter size 2x2) Shadow Maps

Stefan Brabec, MPI Informatik


Conclusions
Conclusions Shadow Maps

  • Benefits:

    • Good-looking, anti-aliased shadows

    • Hardware-based (fast)

    • Standard OpenGL

  • Drawbacks:

    • OpenGL Imaging Subset not everywhere available

    • Depth to color mapping needs more than 8 bits per channel for complex scenes

Stefan Brabec, MPI Informatik


Conclusions1
Conclusions Shadow Maps

  • Future Work:

    • Now: only constant filter sizes

    • Better: mipmap-like method to compute filter sizeusing the projected area

Stefan Brabec, MPI Informatik


Thank you
Thank You ! Shadow Maps

Visit us at

http://www.mpi-sb.mpg.de

Max-Planck-Institut für Informatik

Computer Graphics Group

Stefan Brabec, MPI Informatik