Interactive Image-Space Refraction of Nearby...

Post on 13-Oct-2020

4 views 0 download

transcript

Interactive Image-SpaceRefraction of Nearby Geometry

Chris WymanThe University of Iowa

Motivation

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

• For many interactive applications– Perfectly specular materials typically avoided

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

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]

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

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

Double Sided Refraction Review

Known per pixel

Can computedirection at each pixel

(Snell’s Law)

To find 2nd refractionpoint, need length

of refracted ray

Double Sided Refraction Review

• Cannot compute distance exactly on GPU• Use an approximation

– View vector distance

– Normal distance

Double Sided Refraction Review1st refraction

positionInterpolated

distance approx1st refraction

direction

=++

2nd refractionposition

2nd surfacenormal

+

View directionat 2nd surface

=

2nd refractiondirection

+

2nd refractiondirection

Environmentmap

=

Result

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

Conceptual Idea

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

Given refractor and nearby opaque 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])

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

Iterative Approach

• Use simplified light transport for 1st guess

Initial guess Actual refractiondirection

2nd guess isΔ1 along ray

Δ1

Iterative Approach

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

Iterative approach Ray traced comparison

Iterative Problems

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

Missed geometry Desired effect

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

Sampling Process

• Sample refracted ray– From exit location to far plane

Far plane

Samples

Sampling ProcessFar plane

• Sample refracted ray– From exit location to far plane

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

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

Results

Problems To Beware

Texture aliasing

Variable visibility

Video

Video

Interactiveapproach

Ray tracedcomparison

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!

Questions?

Beyond this work:caustics!

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