Chromatic Aberration. CEDEC 2001 Tokyo, Japan

Similar documents
Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Programmable Graphics Hardware

Tutorial on GPU Programming. Joong-Youn Lee Supercomputing Center, KISTI

Introduction to Programmable GPUs CPSC 314. Real Time Graphics

A Real-Time Procedural Shading System for Programmable Graphics Hardware

Pat Hanrahan. Modern Graphics Pipeline. How Powerful are GPUs? Application. Command. Geometry. Rasterization. Fragment. Display.

Introduction to Programmable GPUs CPSC 314. Introduction to GPU Programming CS314 Gordon Wetzstein, 09/03/09

Reflection & refraction

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Recap: Refraction. Amount of bending depends on: - angle of incidence - refractive index of medium. (n 2 > n 1 ) n 2

Approximating Refraction Kenneth Hurley Please send me comments/questions/suggestions

Reflection and Refraction

Light: Geometric Optics

Complex Shading Algorithms

Outline The Refraction of Light Forming Images with a Plane Mirror 26-3 Spherical Mirror 26-4 Ray Tracing and the Mirror Equation

Reflection and Transmission

Refraction Section 1. Preview. Section 1 Refraction. Section 2 Thin Lenses. Section 3 Optical Phenomena. Houghton Mifflin Harcourt Publishing Company

Chapter 32 Light: Reflection and Refraction. Copyright 2009 Pearson Education, Inc.

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Mathematics of Rainbows

PY106 Class31. Index of refraction. Refraction. Index of refraction. Sample values of n. Rays and wavefronts. index of refraction: n v.

Lecture 14: Refraction

Physics 123 Optics Review

All forms of EM waves travel at the speed of light in a vacuum = 3.00 x 10 8 m/s This speed is constant in air as well

Reflection and Refraction

Refraction of Light. This bending of the ray is called refraction

(Equation 24.1: Index of refraction) We can make sense of what happens in Figure 24.1

Non photorealistic Rendering

Lab 9 - Metal and Glass

Reflection and Refraction of Light

Physics 1C. Lecture 25B. "There are two ways of spreading light: to be the candle or the mirror that reflects it." --Edith Wharton

Lighting and Shading

Non photorealistic Rendering

Geometrical Optics INTRODUCTION. Wave Fronts and Rays

Physics 202, Lecture 23

PHYS 219 General Physics: Electricity, Light and Modern Physics

Chapter 26 Geometrical Optics

ENGR142 PHYS 115 Geometrical Optics and Lenses

Ray Optics I. Last time, finished EM theory Looked at complex boundary problems TIR: Snell s law complex Metal mirrors: index complex

Optics. a- Before the beginning of the nineteenth century, light was considered to be a stream of particles.

Rippling Reflective and Refractive Water

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline:

Today s Topic: Refraction / Snell s Law

CPSC 314 LIGHTING AND SHADING

Home Lab 7 Refraction, Ray Tracing, and Snell s Law

4.5 Images Formed by the Refraction of Light

Physics 102: Lecture 17 Reflection and Refraction of Light

11.2 Refraction. December 10, Wednesday, 11 December, 13

Phys102 Lecture 21/22 Light: Reflection and Refraction

Waves & Oscillations

Refraction Ch. 29 in your text book

Hot Sync. Materials Needed Today

Index of Refraction and Total Internal Reflection

Ray tracing based fast refraction method for an object seen through a cylindrical glass

Internal Reflection. Total Internal Reflection. Internal Reflection in Prisms. Fiber Optics. Pool Checkpoint 3/20/2013. Physics 1161: Lecture 18

Final Exam. Today s Review of Optics Polarization Reflection and transmission Linear and circular polarization Stokes parameters/jones calculus

Light and Lenses Notes

Waves & Oscillations

Purpose: To determine the index of refraction of glass, plastic and water.

Chapter 26 Geometrical Optics

Reflections. I feel pretty, oh so pretty

Real-time Graphics 6. Reflections, Refractions

Geometrical Optics. 1 st year physics laboratories. University of Ottawa

Physics 132: Lecture Fundamentals of Physics II Agenda for Today

1. (25pts) Answer the following questions. Justify your answers. (Use the space provided below and the next page)

Lec. 6: Ch. 2 - Geometrical Optics

Introduction to Visualization and Computer Graphics

Graphics Processing Unit Architecture (GPU Arch)

Figure 1 - Refraction

Light travels in straight lines, this is referred to as... this means that light does not bend...

Chapter 5 Mirror and Lenses

Lecture 10: Ray tracing

Optics Worksheet. Chapter 12: Optics Worksheet 1

Real Time Reflections Han-Wei Shen

speed of light in vacuum = speed of light in the material

Chapter 35. The Nature of Light and the Laws of Geometric Optics

Waves & Oscillations

Physics 1230: Light and Color. Lecture 16: Refraction in more complex cases!

Ray Optics. Lecture 23. Chapter 34. Physics II. Course website:

Shading, Advanced Rendering. Week 7, Wed Feb 28

Light. Form of Electromagnetic Energy Only part of Electromagnetic Spectrum that we can really see

Ch. 22 Properties of Light HW# 1, 5, 7, 9, 11, 15, 19, 22, 29, 37, 38

Light: Geometric Optics (Chapter 23)

SESSION 5: INVESTIGATING LIGHT. Key Concepts. X-planation. Physical Sciences Grade In this session we:

Refraction and Dispersion

GEOMETRIC OPTICS. LENSES refract light, so we need to know how light bends when entering and exiting a lens and how that interaction forms an image.

Chapter 33 Continued Properties of Light. Law of Reflection Law of Refraction or Snell s Law Chromatic Dispersion Brewsters Angle

Lecture Outline Chapter 26. Physics, 4 th Edition James S. Walker. Copyright 2010 Pearson Education, Inc.

Physics 4C Chabot College Scott Hildreth

Light & Optical Systems Reflection & Refraction. Notes

Higher -o-o-o- Past Paper questions o-o-o- 3.2 Refraction

Introduction. Experiment A: Snell s Law. Physics 1CL REFLECTION AND REFRACTION OF LIGHT Summer Session II 2010

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

Windowing System on a 3D Pipeline. February 2005

In-Game Special Effects and Lighting

Geometric Optics. The Law of Reflection. Physics Waves & Oscillations 3/20/2016. Spring 2016 Semester Matthew Jones

Chapter 24. Geometric optics. Assignment No. 11, due April 27th before class: Problems 24.4, 24.11, 24.13, 24.15, 24.24

LIGHT. Speed of light Law of Reflection Refraction Snell s Law Mirrors Lenses

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems

Light: Geometric Optics

Transcription:

Chromatic Aberration CEDEC 2001 Tokyo, Japan

Mark J. Kilgard Graphics Software Engineer NVIDIA Corporation 2

3 Chromatic Aberration Refraction through surfaces can be wave-length dependent Examples: Crystal sculptures Soap bubbles Poor quality lens Prism Rainbows Physics of chromatic aberration Physically plausible rendering model is hard But cool hacks are possible today!

4 Physics of Refraction Snell s law, usually written n = sin θ sin θ 1 1 2 2 where n 1 & n 2 are indexes of refraction of two mediums on either side of a refractive interface and θ 1 & θ 2 are the incoming and outgoing angles of incidence n θ 1 θ 2 n 2 > n 1 η = n n 2 1

Wavelength Dependent Refraction 5 The index of refraction for most translucent materials is wavelength dependent n is a function of wavelength λ θ 1 n 2red > n 2green > n 2blue > n 1 θ 2blue θ θ 2green 2red Chromatic aberration (optics term) is the visual effect of wavelength dependent refraction

6 Real Refraction is Hard Correct refraction is very hard Usually involves multiple interfaces Best technique today s are expensive global illumination techniques such as ray tracing But it s hard to discern if refraction is correct Non-intuitive effect Harder to intuit correctness than reflections Environment mapping fakes convincing reflections, so fake refraction likely to be convincing too So simplify One refractive interface Use environment maps

Sketch of a Chromatic Aberration Technique (1) 7 Per-vertex, compute Three refraction vectors given surface normal, view direction, & indices of refraction one refraction vector for red, green, and blue different indices of refraction for each compute refraction vectors using vertex programs Sample single RGB cube map texture object Extract respective color component for each refraction vector Combine the components in the register combiners

Sketch of a Chromatic Aberration Technique (2) 8 Also blend in conventional reflective environment mapping contribution Again, access same RGB environment map Most transparent surfaces refract and reflect Scalable technique for different GPUs Single-texture GPU, 4 passes Dual-texture GPU (TNT, GeForce 1/2), 2 passes Quad-texture GPU (GeForce3), 1 pass Use CPU math when vertex programs not available Credit for idea & demo: Simon Green, NVIDIA

2D View of Chromatic Aberration Rendering Technique 9 Cube map environment map Surface normal vector View vector Reflected view vector Surface (refraction interface) Red, green, & blue refracted view vectors

Example Refraction/Reflection Environment Map Cube Map 10 Credit: Paul Debevec

Chromatic Aberration Example 11 Crystal bunny floating in the Uffizi Gallery, Florence Credit: Simon Green, NVIDIA

12 Per-vertex Refraction Vector Computations Two refraction vector techniques Physically-based vector approach RenderMan approach Where I=incident vector (to eye), N=normal, and η=ratio of two indices of refraction; to compute the refraction vector R ( ) I N I N I I N R 1 2 2 η η η = ( ) ( )N k N I I k k R N I k 0, (0,0,0) 0, 1 1 2 2 + < = = η η η

13 Vertex Program Formulation!!VP1.0 # refraction # c[4],c[5],c[6] = upper 3x3 of transposed inverse modelview matrix DP3 R11.x, c[4], v[nrml] ; # transform normal to eye-space DP3 R11.y, c[5], v[nrml] ; # R11 = eye-space normal DP3 R11.z, c[6], v[nrml] ; # (assume normalized) # c[8],c[9],c[10],c[11] = 4x4 modelview matrix DP4 R9.x, c[8], v[opos] ; # transform position to eye-space DP4 R9.y, c[9], v[opos] ; DP4 R9.z, c[10], v[opos] ; DP4 R9.w, c[11], v[opos] ; # R9 = eye-space position # R0 = eye-space eye vector ADD R0, -R9, c[59]; # c[59] = position in eye-space; (0,0,0,1) DP3 R8.w, R0, R0 ; RSQ R8.w, R8.w ; MUL R8, R0, R8.w ; # R8 = normalized eye vector DP3 R0.x, R11, -R8; # R0 = N -E = NdotI

14 First Refraction Based on η 1 # c[58] = (η 1, η 1 *η 1, 0.0, 1.0 ) # R1.x = 1-(NdotI)^2 MAD R1.x, -R0.x, R0.x, c[58].w ; # R1.x = k = 1.0- η 1 *η 1 *R1.x MAD R1.x, R1.x, c[58].y, -c[58].w ; RSQ R2.x, R1.x ; RCP R2.x, R2.x ; # R2.x = sqrt(k) MAD R2.x, c[58].x, R0.x, R2.x ; MUL R2, R11, R2.x ; MAD R2, c[58].x, -R8, R2 ; # R = η 1 *I-(η 1 *NdotI+sqrt(k))*N DP3 o[tex0].x, c[12], R2 ; # rotate refraction ray DP3 o[tex0].y, c[13], R2 ; # by cube map transform DP3 o[tex0].z, c[14], R2 ;

15 Second Refraction Based on η 2 # c[57] = (η 2, η 2 *η 2, 0.0, 1.0 ) # R1.x = 1-(NdotI)^2 MAD R1.x, -R0.x, R0.x, c[57].w ; # R1.x = k = 1.0- η 2 *η 2 *R1.x MAD R1.x, R1.x, c[57].y, -c[57].w ; RSQ R2.x, R1.x ; RCP R2.x, R2.x ; # R2.x = sqrt(k) MAD R2.x, c[57].x, R0.x, R2.x ; MUL R2, R11, R2.x ; MAD R2, c[57].x, -R8, R2 ; # R = η 2 *I-(η 2 *NdotI+sqrt(k))*N DP3 o[tex1].x, c[12], R2 ; # rotate refraction ray DP3 o[tex1].y, c[13], R2 ; # by cube map transform DP3 o[tex1].z, c[14], R2 ;

16 Third Refraction Based on η 3 # c[56] = (η 3, η 3 *η 3, 0.0, 1.0 ) # R1.x = 1-(NdotI)^2 MAD R1.x, -R0.x, R0.x, c[56].w ; # R1.x = k = 1.0- η 3 *η 3 *R1.x MAD R1.x, R1.x, c[56].y, -c[56].w ; RSQ R2.x, R1.x ; RCP R2.x, R2.x ; # R2.x = sqrt(k) MAD R2.x, c[56].x, R0.x, R2.x ; MUL R2, R11, R2.x ; MAD R2, c[56].x, -R8, R2 ; # R = η 3 *I-(η 3 *NdotI+sqrt(k))*N DP3 o[tex2].x, c[12], R2 ; # rotate refraction ray DP3 o[tex2].y, c[13], R2 ; # by cube map transform DP3 o[tex2].z, c[14], R2 ;

17 Compute Simple Fresnel Term # c[62] = (fresnel, fresnel, fresnel 1.0 ) # Fresnel approximation = (1-(NdotI))^2 ADD R0.x, c[62].w, R0.x; MUL R0.x, R0.x, R0.x; MUL o[col0], R0.x, c[62];

18 Compute Reflection # c[64].z = 2.0 MUL R0, R11, c[64].z; # R0 = 2*N DP3 R3.w, R11, R8; # R3.w = N dot E MAD R3, R3.w, R0, -R8; # R3 = 2*N * (N dot E) - E # transform reflected ray by cube map transform DP3 o[tex3].x, c[12], R3; DP3 o[tex3].y, c[13], R3; DP3 o[tex3].z, c[14], R3;

19 Transform Vertex to Clip Space // transform vertex to clip space DP4 o[hpos].x, c[0], v[opos] ; DP4 o[hpos].y, c[1], v[opos] ; DP4 o[hpos].z, c[2], v[opos] ; DP4 o[hpos].w, c[3], v[opos] ; END

Per-fragment Math to Combine Reflection and Refractions 20 Combine refractions RefractedColor = red(cubemap(tex0)) + green(cubemap(tex1)) + blue(cubemap(tex2)) Compute reflected color ReflectedColor = cubemap(tex3) Combine color based on Fresnel term color = primarycolor * ReflectedColor + (1-primaryColor) * RefractedColor

Improvements, Optimizations, & Suggestions 21 Dynamic environment mapping Render environment map per-frame Vertex program optimizations Combine scalar instructions together Perform vector math in cube map space rather than in eye space to save DP3s Very cheap refraction approximation R = E ηn Bends ray towards normal in proportion to η

22 Conclusions Chromatic aberration Environment mapping-style technique Convincing if not physically plausible Requires cube maps Accelerated by Vertex programs Multiple hardware texture units Inventor Simon Green, NVIDIA