## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

425
Serious Fun
16
One of the great things about computer graphics is that it gives you the ability
to create exciting images by simulating a number of special eects. It’s a way
to have fun and still convince people that you are doing serious work, which is
why we have entitled this chapter “Serious Fun.” We think you will nd these
eects to be both interesting and informative.
This chapter is something of a potpourri—or perhaps a bag of magic
eects. The rst area we will explore is light interference, through both a dif-
fraction grating and an oil slick. The interaction of light with dierent parts of a
surface creates some exciting surface eects that we explore with shaders. The
next area is lenses that bend light as it passes through them, and we explore the
way a lens aects our view of space by looking at lenses within a cube map.
The third area is atmospheric eects and how they capture and distribute light
426
16. Serious Fun
within a scene, and we consider the familiar rainbow and the common, but
perhaps less familiar, glory eect by simulating them with shaders and puing
them in the context of scenes. We go on to note the various ways you can cre-
ate an interesting path from zero to one and how we can manipulate motion
with these techniques. Fog is next on the list, and we show how we can make
fog more interesting by applying noise techniques to vary the fog’s density.
We then look at morphing (some might say “abusing”) 3D geometry. A short
excursion into a dierent kind of exploration gives us algorithmic art, where
we operate on either pixels or texels to create some new kinds of 2D images.
We then consider the concept of information in an image and explore a way
we can provide information with pure motion. We close with a bang, with an
explosion shader that the geometry shader makes possible. This gives you an
indication of just how many things you can do with shaders, and we would
love to hear from you, via the book’s website, about your own creations.
Light Interference
The general concept of light interference is that two light waves can interfere
with each other, reinforcing each other at times or canceling each other at
Figure 16.1. How a CD or DVD acts as a diraction grating.

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required