accelerating real-time shading with reverse reprojection caching
DESCRIPTION
Accelerating Real-Time Shading with Reverse Reprojection Caching. Diego Nehab 1 Pedro V. Sander 2 Jason Lawrence 3 Natalya Tatarchuk 4 John R. Isidoro 4. 1 Princeton University 2 Hong Kong University of Science and Technology 3 University of Virginia - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/1.jpg)
Accelerating Real-Time Shading withReverse Reprojection Caching
Diego Nehab1 Pedro V. Sander2 Jason Lawrence3
Natalya Tatarchuk4 John R. Isidoro4
1Princeton University 2Hong Kong University of Science and Technology
3University of Virginia
4Advanced Micro Devices, Inc.
![Page 2: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/2.jpg)
Motivation
![Page 3: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/3.jpg)
Motivation
![Page 4: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/4.jpg)
Previous work
• Dedicated hardware
• Address Recalculation Pipeline [Regan and Pose 1994]
• Talisman [Torborg and Kajiya 1996]
• Image based rendering
• Image Warping [McMillan and Bishop 1995]
• Post Rendering 3D Warp [Mark et al. 1997]
![Page 5: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/5.jpg)
Previous work
• Interactivity for expensive renderers
• Frameless rendering [Bishop et al. 1994]
• Render Cache [Walter et al. 1999]
• Holodeck/Tapestry [Simmons et al. 1999/2000]
• Corrective Texturing [Stamminger et al 2000]
• Shading Cache [Tole et al. 2002]
![Page 6: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/6.jpg)
Our approach
• Explore coherence in real-time rendering
RecomputeRecompute
![Page 7: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/7.jpg)
Our approach
• Explore coherence in real-time rendering
LookupLookup Hit?Hit?
Load/ReuseLoad/Reuse
RecomputeRecompute
UpdateUpdate
![Page 8: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/8.jpg)
Requirements
• Load/reuse path must be cheaper
• Cache hit ratio must be high
• Lookup/update must be efficient
LookupLookup Hit?Hit?
Load/ReuseLoad/Reuse
RecomputeRecompute
UpdateUpdate
![Page 9: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/9.jpg)
First insight
• Cache only visible surface fragments
• Use screen space buffer to store cache
• Output sensitive memory
• Keep everything in GPU memory
• Leverage hardware Z-buffering for eviction
![Page 10: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/10.jpg)
Cache hit ratio
![Page 11: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/11.jpg)
Cache hit ratio results
![Page 12: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/12.jpg)
[Walter et al. 1999]
Second insight
• Use reverse mapping
• Recompute scene geometry at each frame
• Leverage hardware filtering for lookup
![Page 13: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/13.jpg)
Third insight
• Do not need to reproject at the pixel level
• Hard work is performed at the vertex level
![Page 14: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/14.jpg)
Address calculation
Time t Time t+1
![Page 15: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/15.jpg)
Hit or miss?
Time t Time t+1
![Page 16: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/16.jpg)
Hit or miss?
cached depth
Time t
• Load cached depth
• Compare with expected depth
expected depth
![Page 17: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/17.jpg)
Third insight
• Do not need to reproject at the pixel level
• Hard work is performed at the vertex level
• Pass old vertex coords as texture coords
• Leverage perspective-correct interpolation
• One single final division within pixel shader
![Page 18: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/18.jpg)
What to cache?
• Slow varying, expensive computations
• procedural albedo
• Values required in multiple passes
• color in depth of field or motion blur
• Samples within a sampling process
• amortized shadow map tests
![Page 19: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/19.jpg)
Refreshing the cache
• Cached entries become stale with time
• View dependent effects, repeated resampling
• Implicit (multipass algorithms)
• Flush entire cache each time step
• Random updates
• Refresh random fraction of pixels
• Amortized update
• Combine cache with new values at each frame
![Page 20: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/20.jpg)
Motion blur
60fps brute force
3 passes
![Page 21: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/21.jpg)
Reuse albedo in multipass
• For each time step
• Fully compute albedo in first pass
• For each remaining pass
• Lookup into first pass and try to reuse
![Page 22: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/22.jpg)
Motion blur
60fps brute force
3 passes
![Page 23: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/23.jpg)
Motion blur
60fps cached30fps brute force
6 passes
![Page 24: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/24.jpg)
Motion blur
30fps cached
14 passes
![Page 25: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/25.jpg)
Randomly distributed refresh
1/4th updated
Error plot
![Page 26: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/26.jpg)
Amortized super-sampling
• Cache updated by recursive filter rule
• Lambda controls variance reduction...
• ...but also the lifespan
![Page 27: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/27.jpg)
Trade-offs
Variance
Lifespan
![Page 28: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/28.jpg)
Variance reduction at work
4 tap PCF16 tap PCF
![Page 29: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/29.jpg)
Reusing shadow map tests
• At each frame, perform new shadow tests
• Read running sum from cache
• Blend the two values
• Update cache and display results
![Page 30: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/30.jpg)
Variance reduction at work
4 tap PCF16 tap PCF
![Page 31: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/31.jpg)
Variance reduction at work
16 tap PCF 4 tap amortized
![Page 32: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/32.jpg)
Conclusions
• Shading every frame anew is wasteful
• We can reuse some of the shading computations from previous frames
• Use reverse reprojection caching to do that in real-time rendering applications
• Less work per frame = faster rendering
![Page 33: Accelerating Real-Time Shading with Reverse Reprojection Caching](https://reader036.vdocuments.net/reader036/viewer/2022062408/5681357f550346895d9cdd93/html5/thumbnails/33.jpg)
Future work
• Track surface points and select shader level of detail based on screenspace speed
• Change refresh rate per pixel based on rate of cached value change
• Use code analysis to automatically select appropriate values to cache