47
Shadow Maps

Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

  • View
    223

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Shadow Maps

Page 2: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Previous Work

1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 )

2.Deep Shadow Maps ( Lokovic/sigg2000 )

3.Adaptive Shadow Maps ( Fernando/sigg2001 )

4.Perspective Shadow Maps ( Stamminger/sigg2002 )

Page 3: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Adaptive Shadow Maps

1. Introduction

2. The ASM2.1 Creating Nodes

2.2 Removing Nodes

3. Implementation

4. Results

Page 4: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps

1. Introduction

2. The DSM 2.1 Definition

2.2 Sampling

2.3 Compression

3. Results

4. Conclusion

Page 5: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Adaptive Shadow Maps

Randima Fernando Sebastian Fernandez

Kavita Bala Donald P.Greenberg

Program of Computer Graphics

Cornell University

Page 6: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Introduction

Want to create high-resolution pieces of the shadow map when needed.

Page 7: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Adaptive Shadow Maps

Observation

Only regions that contain shadow boundaries need to be high-quality.

Solution

ASM hierarchically subdivides the shadow map in visually important regions.

Page 8: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Adaptive Shadow Maps

ASMs has three main characteristics:

1.It is view-driven.

2.It is confined to a user-specifiable memory limit.

3.It is progressive. Meaning that once a particular viewpoint is established , image quality continues to improve until the user-prescribed memory limit is reached.

Page 9: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Adaptive Shadow Maps

ASMs are organized as trees.

Each node in an ASM tree has a shadow map of a fixed resolution and a partitioning of that shadow map into a fixed number of cells.

Each of these cells may contain another tree node.

All this is done in response to the user-specified restrictions on memory usage.

Page 10: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Creating Nodes

Page 11: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Creating Nodes

At any time there are many cells that require new nodes to be assigned to them.

It is only beneficial to create a new node if it causes a perceived improvement in shadow quality.

Page 12: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Creating Nodes

Using cost-benefit metric

We quantify this perceived benefit by counting the number of transformed eye pixels within the cell that straddle a depth discontinuity and whose shadow map resolution is lower than eye view resolution.

Page 13: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Creating Nodes

The resolution required for the new shadow map to match the eye view resolution is:

N’ = N * (Projected Area in Eye) / (Projected Area in Shadow Map)

N :current resolution

N’:required resolution

Page 14: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Creating Nodes

The cost of generating a new shadow map can be approximated by:

cost = a*N’ + b

a :the per-pixel rendering

b :the constant overhead

Page 15: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Removing Nodes

Page 16: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Removing Nodes

Since the ASM only uses a fixed amount of memory, a particular node’s memory might need to be reclaimed.

LRU( Least Recently Used) is used .

Removing least recently used nodes.

But, if there are no such nodes……….

Page 17: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Implementation

Mip-mapping It has the advantages of increasing the rendering speed and the level of detail. MIP Mapping works by using more than one version of each texture. With multiple levels of detail, it is not necessary to do as much computation to draw the texture, saving valuable processor time.

Performing this calculation in software is too expensiv

e ,so we approximate this calculation using mip-mapping.

Page 18: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Implementation

Combining ID and Depth Comparisons

1.Depth Comparison

Shadow Maps

2.Polygon IDsAlgorithms for Antialiased Cast Shadows(Nicolas/1985)

3.Depth Comparison + Polygons IDs

Page 19: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

Page 20: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

Page 21: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps

Tom Lokovic Eric Veach

Pixer Animation Studios

Page 22: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Introduction

Because accurate self-shadow

ing is so important, rendering hair,fur,and smoke is difficult.

The traditional Shadow Maps whose inadequate sampling results in sparkling when in the animation.

Page 23: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Introduction

Deep Shadow MapsRather than storing a single depth at each pixel, which stores a fractional visibility function.

補充 shadow maps: depth value / pixel

deep shadow maps: visibility function / pixel

DSP can process the opacities of surfaces and volume element in the same time.

Page 24: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Introduction

DSP’s advantages:

1. They support semitransparent surfaces and volumetric primitives, such as smoke.

2. For high-quality shadows, they are smaller than equivalent shadow maps by an order of magnitude and are significantly faster to access.

3. Unlike ordinary shadow maps, they support mip-mapping. This can dramatically reduce lookup costs when objects are viewed over a wide range of scales.

Page 25: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps

Definition

A deep shadow map is a rectangular array of pixels in which every pixel stores a visibility function.

visibility function :

The function value at a given depth is simply the fraction of the beam’s initial power that penetrates to that depth.

The visibility function of each pixel is now obtained by filtering the nearby transmittance functions and resampling at the pixel center.

Page 26: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps

Page 27: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps

Transmittance function

The fraction of light that penetrates to a given depth z is known as the transmittance

Visibility function

),,( zyx

1. (i + 1/2 , j + 1/2) is the pixel center.

2. f is the desired bandlimiting pixel filter,and r is the filter radius.

Page 28: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Deep Shadow Maps Visibility functions are closely related to the alpha channels

used for image compositing.

A deep shadow maps is equivalent to computing the approximate value of 1-α at all depths, and storing the result as a function of z.

Page 29: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Sampling

Page 30: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Sampling

To generate a deep shadow map, we select a set of sample points across the shadow camera’s image plane.

Page 31: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Sampling

For each sample point we determine the corresponding transmittance function.

Finally, the visibility function for each pixel is computed by taking a weighted combination of the transmittance function at nearby sample points.

Page 32: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

To compute a single transmittance function

s

Given an image point (x , y),

The transmittance function at this point can be expressed as:

:Surface transmittance function

:Volume transmittance function v

Page 33: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

To compute a single transmittance function

sWhich is estimated using all of the surface intersection along the primary ray at( x,y ).

Each surface hit has a depth value Zi and an opacity Oi.

Starting with a transparency of 1 and multiplting by 1-Oi at each surface hit ,to yield a piecewise constant function.

Page 34: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

To compute a single transmittance function

vWe sample the atmospheric density at regular intervals along the ray.

Each volume sample has a depth value Zi and an extinction coefficient Ki that measures the light falloff per unit distance along the ray.

Page 35: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

To compute a single transmittance function

Since that function is not piecewise linear,we approximate it by evaluting the transmittance at each vertex of the extinction function and linearly interpolating.

Finally transmittance function

Page 36: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Sampling

Page 37: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Compression

Page 38: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Compression

It is very important that the compression method preserve the z values of important features,since even small errors in z can lead to undesirable self-shadow artifact.

V :visibility function V’:a new visibility function of our algorithm,and where V’ typ

ically has a much smaller number of control points.

Page 39: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Compression

The basic idea is that at each step , the algorithm draws the longest possible line segment that stays within the error bounds.

Similar to hitting a ball through as many wickets as possible in a game of croquet.

The origin of the current segment is fixed , and we only need to choose the direction and length of the segment.

Page 40: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Compression

Page 41: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

Page 42: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

19 sec 559 sec

400 samples/lookup

37 sec

256 samples/pixel

Page 43: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

Page 44: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Results

Page 45: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Conclusion

Page 46: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

Conclusion

A nice feature of deep shadow maps is their generality:they suppport ordinary surfaces,volumetric objects,and dense fur.

A deep shadow map can be viewed as a two-dimensional function image of piecewise liner one-dimensional functions.

Page 47: Shadow Maps. Previous Work 1.Casting Curved Shadows On Curved Surfaces ( Williams/sigg1978 ) 2.Deep Shadow Maps ( Lokovic/sigg2000 ) 3.Adaptive Shadow

報告完畢