Title: Deep Shadow Maps
1Deep Shadow Maps
- Tom Lokovic Eric Veach
- Pixar Animation Studios
- Presented by Tom Lechner
2Outline
- Traditional Shadow Maps (TSMs)
- Other Shadowing Techniques
- Deep Shadow Maps (DSMs)
- Generation
- Sampling
- The Transmittance Function
- The Visibility Function
- Compression
- Lookups
- Comparing DSMs to TSMs
- Implementations
- Examples
3So why are Shadow Maps Important?
4Traditional Shadow Maps (TSMs)
- Generation
- Shadow Camera (SC)
- Rectangular array of depths to the closest
surface of a given pixel - Sampling
- Transform P into SC coordinate system
- Compare point depth to shadow depth
- Higher quality images require
- Percentage closer filtering - examines depth
samples within a given filter region and computes
the fraction that are closer than a given depth z - Stratified sampling in both the original shadow
map and filtering subset
5Traditional Shadow Maps (contd)
- Advantages
- Renders large objects well
- Stores only one depth value per pixel
- Disadvantages
- Poorly Renders highly detailed geometries (e.g.
fur, hair) - Produces artifacts, esp. in animation (e.g.
sparkling) - Rendering time and memory allocation for detailed
renders rapidly increase due to super sampling
6Other Shadowing Techniques
- Ray Casting
- Fuzzy objects (potentially millions of hairs) too
expensive! - No soft shadows (unless using an expensive area
light source) - Smoke and fog require ray marching for each hair
- 3D Texturing
- Has had some success for volume datasets (clouds,
fog, medical imaging) - Relatively course resolution
- Low accuracy in z (creates bias problems)
- Become prohibitively large as detail increases
- Multi-layer Z-buffers
- Renders opaque surfaces from differing viewpoints
- Similar drawbacks to TSMs
7Deep Shadow Maps (DSMs)
- Generation
- Rectangular array of pixels in which every pixel
stores a visibility function - Every value is a function of transmittance - the
fraction of light that penetrates to a given
depth z - The original beam can be shaped and filtered to
any particular filter - A visibility function is calculated by filtering
the nearby transmittance functions and
re-sampling at the pixel center
transmittance function
desired band limiting pixel filter (centered
around the origin)
filter radius
8Deep Shadow Maps (contd)
- Generation (contd)
- Visibility functions are closely related to alpha
channels - Thus a DSM is equivalent to computing the
approximate value 1 - ? at all depths, and
storing result as a function of z - Contains the combined attenuation and coverage
information for every depth
9Deep Shadow Maps (contd)
- Sampling
- Select a set of sample points across the shadow
cameras image plane - For each sample point, determine the
corresponding transmittance function - Given an image point (x,y) compute the surfaces
and volume elements intersected by the
corresponding primary ray - surface transmission function volume
transmission function transmission function of
(x,y) - For each pixel, compute its visibility function
by taking a weighted combination of the
transmittance function at nearby sample points.
10Deep Shadow Maps (contd)
- The Transmittance Function
- Surface Transmittance
- Each surface hit has a depth value, zis, and an
opacity, Oi - Start with a transparency of 1 and then multiply
by 1 Oi at every surface hit (resulting in
piecewise constant function Ts) - Volumetric Transmittance
- Sample atmospheric density at regular intervals
along primary ray - Each volume sample has a depth value, ziv, and an
extinction coefficient, ki, that measures light
falloff per unit distance - Linearly interpolate between the samples to get
the extinction function, k - Since not piecewise linear, approximate by
evaluating transmittance at each vertex of the
extinction function and linearly interpolating - Composite like surface transparencies to find Tv,
except this time interpolate between vertices
rather than forcing discrete steps
11Deep Shadow Maps (contd)
- The Transmittance Function (contd)
- Merge surface and volume transmission functions
- Since result is not piecewise linear, evaluate it
at the combined vertices of Ts and Tv,
interpolating linearly between them
12Deep Shadow Maps (contd)
- The Visibility Function
- At each depth z, the nearby transmittance
functions are filtered like ordinary image
samples - Results in a piecewise linear function with
approx. n times as many vertices as the
transmittance functions - Takes into account the fractional coverage of
semitransparent surfaces and fog as well as light
attenuation
number of transmittance functions within the
filter radius around (i ½, j ½)
normalized filter weight for each corresponding
sample point (xk, yk)
13Deep Shadow Maps (contd)
- Compression
- Visibility functions can have a large number of
vertices depending on filter size and number of
samples per shadow pixel - Fortunately, functions tend to be very smooth
- Compression must preserve z values of important
features, since simple errors in z can cause
self-shadowing artifacts
14Deep Shadow Maps (contd)
15Deep Shadow Maps (contd)
- Lookups
- Apply a reconstruction and re-sampling filter to
a rectangular array of pixels (similar to
textures) - Given a point (x,y,z) at which to perform a
lookup and a 2D filter kernel f, the filtered
shadow value is - Evaluating each visibility function requires
searching through its data points to determine
which segment contains the z-value - May be implemented as a binary or linear search
filter weight for pixel (i, j)
sum over all pixels in filter radius
16Comparing DSMs to TSMs
- Support prefiltering
- Faster lookups
- Much smaller in comparison to an equivalent high
resolution depth map (dependant upon compression) - Fortunately, at any sampling rate there is an
error tolerance that allows significant
compression without compromising quality - Shadows of detailed geometry have an expected
error of about O(N-½) - This error is a measure of the noise inherent in
the sampled visibility function - Actually implemented with a tolerance of
0.25(N-½) half of the maximum expected noise
magnitude - TSM uses O(N) storage, where DSM uses O(N-½),
approaches O(N-¼) when functions are piecewise
linear
17Comparing DSMs to TSMs (contd)
- Significantly more expensive to compute than a
regular shadow map at the same pixel resolution - Bias artifacts possible, due to constant z depths
- Exacerbated by encouragement of large filter
widths - Might be useful, as it provides an extra degree
of freedom - Shadow resolution should be chosen according to
minimum filter width desired (shadow detail) - Number of samples per pixel should be determined
by maximum acceptable noise - Note Bias artifacts and computational expense of
DSMs are no worse off than TSMs that are
equivalent in terms of pixel resolution or sample
size
18Comparing DSMs to TSMs (contd)
19Comparing DSMs to TSMs (contd)
20Implementations
- Incremental Updates
- Can be optimized to proceed in O(nlogn)
- Colored Shadows
- At expense of twice the storage
- Allows for some compression for gray shadows
- Mip-Mapping
- Can dramatically reduce lookup costs when objects
are viewed over a wide range of scales - Tiling and Caching
- Stored similar to textures and share in some of
their advantages - Tile directory
- Motion Blur
21Examples
22Examples (contd)
23Examples (contd)
24Questions?
- E.G.
- Was there anything you didnt understand about my
explanation of the algorithms? - Do you see the correlation between DSMs and Light
Fields? - Do you need clarification on the implementations?
Thanks!