Book Image

WebGL HOTSHOT

By : Mitch Williams
Book Image

WebGL HOTSHOT

By: Mitch Williams

Overview of this book

Table of Contents (17 chapters)
WebGL HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Bending of light – calculating refraction for surfaces such as water


A variation on reflection is refraction, the bending of light as it passes through a surface, or more accurately, light passing through air into another surface. We see refraction when we observe a straw in a glass of water or view the bottom of a pool. Have a look at the following screenshot:

Refraction as the image of the pen is bent and broken

Prepare for lift off

This won't become a class in physics, I promise. But we cannot ignore it either, and besides, a little physics never hurt anyone (just continue to stay out of the way of falling objects). We need to take a moment and introduce refractive index, which describes how light moves through a surface. Refractive index is the ratio of light moving in a vacuum (which, for our purposes, is air) versus light moving through a substance such as glass or water. In water, the refractive index is 1.33, whereas the refractive index for diamond is 2.42. Types of glass and liquids...