Interactive Image-Space Refraction of Nearby...

26
Interactive Image-Space Refraction of Nearby Geometry Chris Wyman The University of Iowa

Transcript of Interactive Image-Space Refraction of Nearby...

Page 1: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Interactive Image-SpaceRefraction of Nearby Geometry

Chris WymanThe University of Iowa

Page 2: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Motivation

• Real environments have varied materials– Diffuse– Glossy– Reflective– Refractive– Complex BRDFs

• For many interactive applications– Perfectly specular materials typically avoided

Page 3: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Specular Rendering Problems

• Easy concepts– Law of Reflection– Snell’s Law

• Apply for each ray

• Per-ray computations straightforward• Not straightforward using rasterization

– Rays not coherent– Non-obvious interactions with global geometry

Page 4: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Background• Infinitely distant environment maps [Blinn 76]

• Thin object approximation [Kay 78]

• Multi-pass approaches [Diefenbach 97]

• Explosion mapping [Ofek 98]

• Single layer refraction [Oliveira 00]

• Double layer refraction [Wyman 05]

• Iterative approximations [Ohbuchi 03] [Szirmay-Kalos 05]

Page 5: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Problems in Previous Work

• Either– Assume an infinitely distant environment– Unrealistic restrictions on behavior of light– Restrict geometry

• Previous iterative techniques– Assume static background– Artifacts combining infinite & nearby geometry

Page 6: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Contributions

• Extend double-sided refraction– Allow nearby geometry (non-environment maps)

• Use an image-space approach– Look up refracted color from planar 2D texture

• Choose good seeds for iterative approach– Helps eliminate missed background features

Page 7: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Double Sided Refraction Review

Known per pixel

Can computedirection at each pixel

(Snell’s Law)

To find 2nd refractionpoint, need length

of refracted ray

Page 8: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Double Sided Refraction Review

• Cannot compute distance exactly on GPU• Use an approximation

– View vector distance

– Normal distance

Page 9: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Double Sided Refraction Review1st refraction

positionInterpolated

distance approx1st refraction

direction

=++

2nd refractionposition

2nd surfacenormal

+

View directionat 2nd surface

=

2nd refractiondirection

+

2nd refractiondirection

Environmentmap

=

Result

Page 10: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Double Sided Refraction Problem

• Unable to intersect background– Don’t know where it is along refracted ray!

• Finding this distance key– Ray tracing the best way, but too slow– Intelligently search along ray

Page 11: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Conceptual Idea

For each exit point & refracted direction Search all image pixels along ray for hits

Given refractor and nearby opaque geometry:

Page 12: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Improvements

• Searching is slow!– ~512 texture reads at 10242 image resolution

• How to avoid search?– Simplify behavior of light (e.g., [Kay 78])– Iterate using starting guess (e.g., [Ohbuchi 03])

Page 13: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Simplifying Light Behavior

• Light travels parallel to viewing direction– When outside refractive geometry

• Find background intersection with 1 lookup

Light travels parallel to viewing ray Ray traced comparison

Page 14: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Iterative Approach

• Use simplified light transport for 1st guess

Initial guess Actual refractiondirection

2nd guess isΔ1 along ray

Δ1

Page 15: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Iterative Approach

• Project 2nd guess into eye texture, iterate– Pretty good results, with few iterations (~5)

Iterative approach Ray traced comparison

Page 16: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Iterative Problems

• What if 1st guess “invalid”?– Hits environment map or distant geometry– Completely skips important objects

Missed geometry Desired effect

Page 17: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Avoiding Invalid Guesses

• Sample a few points along ray– Find the “best” valid guess– Iterate from improved 1st guess

• Limited range for possible intersections– From geometry exitant point to far plane

• Error bounds– Number of points sampled– Direction of refracted ray

Page 18: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Sampling Process

• Sample refracted ray– From exit location to far plane

Far plane

Samples

Page 19: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Sampling ProcessFar plane

• Sample refracted ray– From exit location to far plane

• Lookup depth of samples– In eye’s background texture

Page 20: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Sampling Process

• Sample refracted ray– From exit location to far plane

• Lookup depth of samples– In eye’s background texture

• Compare to actual depth– Find closest to background

geometry

• Seed iteration with guess

Far plane

Page 21: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Results

Page 22: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Problems To Beware

Texture aliasing

Variable visibility

Page 23: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Video

Page 24: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Video

Interactiveapproach

Ray tracedcomparison

Page 25: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Summary And Future Work

• Extends 2-sided refraction– Allows nearby geometry– An iterative approach in image space– Improved seeding reduces missed geometry

• Examine non-opaque background objects• Visibility of geometry not visible from eye• Utilize approach from light…for caustics!

Page 26: Interactive Image-Space Refraction of Nearby Geometrycwyman.org/supplement/ISRefractWNearby/InteractiveNearbyRefraction… · Interactive Image-Space Refraction of Nearby Geometry

Questions?

Beyond this work:caustics!

(To appear at 2006 ACM Symposium on Interactive 3D Graphics and Games)