Lecture 21: All Together with Refractioncs410/yr2017fa/more_progress/pdfs/cs410_… · glass = 1.5 θ r =sin −1 η i η r sin(θ i) " # $ % & '=sin−10.67⋅sinθ ((i)) Theta i

Post on 14-Jun-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Lecture 21:All Together with Refraction

December 1, 2016November 9, 2017

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 1

Translucence• Some light passes through the material.– Typically, “passed through” light gets the

diffuse reflection properties of the surface, unless object is 100% translucent (i.e. transparent)

• Speed of light is a function of the medium– This causes light to bend at boundaries– example: looking at the bottom of a pool

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 2

Refraction- WithTrigonometry

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 3

Key is Snell’s law …sin θt( )=ηi

ηt

sin θi( )

WN

R

θ i

θ i

θt TT = ηi

ηt

cos θi( )− cos θt( )"

#$

%

&'N −

ηi

ηt

W

Therefractionrayis:

𝜃" Angleofincidence

𝜃# Angleofrefraction

𝜂" Index ofrefractionmaterial#1

𝜂# Indexofrefractionmaterial#2

Practical Refraction: Solids• When light enters a solid glass object?

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 4

N W

hair= 1.0

hglass= 1.5

θr = sin−1 ηi

ηr

sin θi( )"

#$

%

&'= sin−1 0.67 ⋅sin θi( )( )

Theta i Sin mu Theta r0 0.00 0.67 0.0010 0.17 0.67 6.6720 0.34 0.67 13.3330 0.50 0.67 20.0040 0.64 0.67 26.6750 0.77 0.67 33.3360 0.87 0.67 40.0070 0.94 0.67 46.6780 0.98 0.67 53.3390 1.00 0.67 60.00

More Recursion• This changes ray tracing from tail-recursion

to double-recursion…

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 5

camera

light1 light2

light3

NN

This is the recursiveRefraction ray

PracticalRefraction:Surfaces

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 6

• What happens as it passes through a solid or surface?

sinθ1 =ηi

ηr

sinθi

sinθi =ηr

ηi

sinθ2

sinθ1 =ηi

ηr

ηr

ηi

sinθ2

= sinθ2

Note: this assumes the two surfaces of the solid are coplanar!

Ø Overalleffect:displacementoftheincidentvector

Refraction- NoTrigonometry.

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 7

WN

R

θ i

θ i

θ tT-N

T =αW +βNsin θi( )2 µ 2 = sin θt( )2

FirstConstraint:Snells Law

µ =µi

µt

1− cos θi( )2( )µ 2 =1− cos θt( )2

1− W ⋅N( )2( )µ 2 =1− −N ⋅T( )2

1− W ⋅N( )2( )µ 2 =1− −N ⋅ αW +βN( )( )2

Refraction- NoTrigonometry

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 8

Second Constraint: Refraction ray is unit length.

T ⋅T = αW +βN( ) ⋅ αW +βN( ) =1

=α 2 + 2αβ W ⋅N( )+β 2 =1

Two quadratic equations in two unknowns.Solving is a bit involved, …Here is the answer.

α = −µ β = µ W ⋅N( )− 1−µ 2 +µ 2 W ⋅N( )2

AWonderfulRealExample

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 9

Yes,refractiontypicallymakeseverthingupsidedownandbackwards.

https://physicsb-2009-10.wikispaces.com

Refraction and Polygons• It is entirely possible to implement refraction

through complex solid models defined by polygons.

• But! Doing so requires the following:–Models must be complete: no holes!– All faces (triangles) must be tagged to a solid.• Needed to find where refraction ray exits the solid.

• There is a simpler special case– Thin faces with parallel sides (next slide).

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 10

Special Case: Thin Faces• Consider entrance and exit– The are parallel (see picture)

• Refraction vectors– Pass through at a shifted angle– But exit in the same direction

• Result is an offset only– Offset depends on index of refraction– Offset depends on the thickness of the face

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 11

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 12

TheCompletePackage

11/9/17 CSU CS410 Fall 2017, © Ross Beveridge & Bruce Draper 13

WhenyouunderstandeverylineofcodeintheSageNotebookcreatingthisimageyouarewillbeinapositiontowriteatrulycompellingraytracer.

top related