Top Banner
CSM Scrolling An acceleration technique for the rendering of cascaded shadow maps
69

CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Apr 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

CSM ScrollingAn acceleration technique for the rendering of cascaded shadow maps

Page 3: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Quick Background

Page 4: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

From light POV, imagine whole world as single mega shadow

texture

Page 5: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

On any particular frame, a shadow map represents a 2D

rectangular slice of that volume.

Page 6: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Cascade refers to multiple resolutions of that slice

Page 7: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Assumptions

Page 8: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Most of the time, the camera does not make radical changes

across frames

Page 9: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Most geometry is relatively static across frames

Page 10: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Geometry which has changed from the previous frame can be

identified

Page 11: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

The light direction and shape is relatively stable across frames

Page 12: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Results of spatial queries can be used in the same frame as

shadow rendering

Page 13: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Geometry is divided into small* instances

Page 14: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Concept

Page 15: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Store “static” geometry from previous frame in cached map

Page 16: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Scroll cached map to account for change in camera view

Page 17: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render additional “static” geometry into edges exposed by scrolling

Page 18: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render newly “static” geometry in cached area

Page 19: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Copy map to use as final shadow map for current frame

Page 20: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render non-static geometry into final shadow map for frame

Page 21: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

CSM Caching

Page 22: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Assumption: Camera is not moving (much)

Page 23: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Store “static” geometry from previous frame in cached map

Page 24: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Store “static” geometry from previous frame in cached map

“static” = not moved for t time. (e.g. 5 seconds)

Page 25: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Each frame, render non-static geometry on to cached copy

Page 26: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Cache of previous frame shadow map

Page 27: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Cache of previous frame shadow map

Invalid if…

Page 28: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Cache of previous frame shadow map

Invalid if…• Camera moves• Camera FOV changes

Page 29: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Cache of previous frame shadow map

Invalid if…• Camera moves• Camera FOV changes• “Static” geometry moves

Page 30: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render newly “static” geometry in cached area

Page 31: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Query for state of “static” geometry

Page 32: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Diff current “static” versus previous “static” query results

Page 33: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Dynamic occlusion system used

Page 34: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Create copy new map cache to use this frame

Page 35: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

“Dynamic” geometry rendered to temporary shadow map

Page 36: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

CSM Scrolling

Page 37: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Assumption: Camera moves a lot (but slowly*)

Page 38: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Insert in to CSM Caching:1. Scroll map2. Render into exposed

edges

Page 39: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Scroll cached map to account for change in camera view

Page 40: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Sample shadow texelsfrom previous frame

Page 41: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Scrolled area is clamp-to-border (color=1.0)

Page 42: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Observe: Camera motion is 3D

Page 43: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Observe: Camera motion is 3D

• Lateral scrolling• Depth scrolling

Page 44: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Lateral scrollingTranslation perpendicular to light rays

UV translated by delta camera in light frame

Page 45: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Lateral scrollingTranslation perpendicular to light rays

Simple texture lookup(Point sampling)

Page 46: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Additional handling needed for depth scroll

Page 47: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Delta camera depth in light frame

Page 48: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Offset all previous depths (scroll depth)

Page 49: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Gotchas:• Near plane• Far plane

Page 50: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Gotchas:• Near plane• Far plane

Clamp to 0.0

Page 51: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Gotchas:• Near plane• Far plane Problem 1.0 = buffer clear

Page 52: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Depth scrollingTranslation parallel to light rays

Gotchas:• Near plane• Far plane Problem 1.0 = buffer clear

No offset

Page 53: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render additional “static” geometry into edges exposed by scrolling

Page 54: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Scrolled in area divided into slabs (thin OBBs)

Page 55: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

‘Static’ geom with overlapping bounding volume rendered

Page 56: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Observe: Coarseness of geometry relative to view

Page 57: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Lots of overlapping volumes

Page 58: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Very few overlapping volumes

Page 59: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Jagged pattern not relevant: Using square geom tiles

(Aside)

Page 60: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Render newly “static” geometry in cached area

Page 61: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Copy map to use as final shadow map for current frame

Page 62: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

CSM Scrolling

Page 63: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Each map (512x512) PS3/360

Page 64: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Another view…

Page 65: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Wrap up

Page 66: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Straightforward addition to CSM Caching

Page 67: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Key: Like 2D bitmap scrolling

Page 68: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Do not render ~70% of ‘static’ geometry in to CSM

Page 69: CSM Scrolling - Real-time renderingadvances.realtimerendering.com/s2012/insomniac/Acton-CSM_Scroll… · An acceleration technique for the rendering of cascaded shadow maps. CSM Scrolling

Detailed paper:

bit.ly/QIoBr9