CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

10
CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE

Transcript of CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

Page 1: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

CS 450: COMPUTER GRAPHICS

TRANSPARENT SURFACESSPRING 2015

DR. MICHAEL J. REALE

Page 2: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

INTRODUCTION

• A couple of definitions to get us started:

• Opaque = cannot see through

• Transparent = can see through produces reflected and transmitted light

• Translucent = transparent, but transmitted light is diffused in all directions

• Example: frosted glass

• For transparent surfaces, we’ve just done alpha blending, but a true transparent surface is more complicated…

Page 3: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

LIGHT REFRACTION

• When light hits a transparent surface:

• Some light is reflected

• Some light is transmitted (i.e., goes through surface)

• Angle of incidence = angle from normal that light hits surface

• Angle between L and N θi

• Angle of refraction = angle from negative normal that light travels through surface

• Angle between T and –N θr

• HOWEVER, light travels at different speeds through different materials angle of incidence IS PROBABLY NOT THE SAME as the angle of refraction

Page 4: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

LIGHT REFRACTION: SNELL’S LAW

• The angle of refraction depends on:

• Angle of incidence (angle of incoming direction of light relative to the normal)

• Indices of refraction for the incident and refracting materials ηi and ηr , respectively

• Other factors (temperature of materials, wavelength of light, etc.)

• Index of refraction = (speed of light in vacuum) / (speed of light in material)

• The relationship between the indices of refractions and the angles of incidence and refraction is given by Snell’s Law:

iirr sinsin

Page 5: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

LIGHT REFRACTION: MORE COMPLEXITIES

• Refraction can depend on the wavelength of the light (so some frequencies may travel slower or faster, resulting in a different angle)

• Example: rainbow coming out of a prism!

• Refraction also may be different depending on the direction anisotropic materials (e.g., crystalline quartz, calcite) may have double refraction = two refracted light rays are generated

http://www.nmsea.org/Curriculum/4_6/Interaction/Interaction_light_matter.htm

http://www.lhup.edu/~dsimanek/14/stereo.htm

Page 6: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

INDICES OF REFRACTION

• Common indices of refraction:

• Vacuum = 1.0

• Air = about 1.0 (good enough)

• Heavy crown glass = 1.61

• Water = 1.33

• Ice = 1.31

Page 7: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

LIGHT REFRACTION: BORDERS

• Refraction occurs at a transition from one material to another

• So, for, say, a pane of glass, the light ray will be refracted twice:

• Once entering the glass

• Once leaving the glass

• Turns out that the final outgoing light path is parallel to the original but shifted

• SO…can approximate by shifting light path instead of doing trigonometric functions

Page 8: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

GETTING THE DIRECTION OF REFRACTION

• Using Snell’s law and the N and L vectors:

LNTr

iri

r

i

coscos

Page 9: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

TRANSPARENCY IN PRACTICE

• A lot of times refraction is ignored just use alpha blending

• Effectively assumes object is very thin no shift caused by refraction

• Raytracing can model refraction

• Shoot ray through material and change direction because of refraction

Page 10: CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.

TRANSLUCENT MATERIALS?

• Translucent materials a little more complicated, because the light is being scattered as it goes through the object

• Can be simulated by:

• Distribute all intensity contributions from background objects over finite area

• Raytracing

• Expensive to simulate

http://lvluxhome.com/inspiring-home-interior-decoration-with-frosted-glass-room-dividers/amazing-home-interior-decoration-using-swing-door-frosted-glass-room-dividers-along-with-single-glass-interior-door-and-cherry-wood-home-flooring/