Fragment Shader Effects



Read Chapter 7.10.

Class startup

git checkout master
git pull
git checkout working
git merge master
Impatient? Git not being friendly today?
git fetch origin
git checkout -b temp origin/master
You will not be able to push from the temp branch. You must add a symlink before running today's code.
cd ~/cs40/code/w08-noise/
ln -s /usr/local/doc/textures/ data
Switch to your working branch, open qtcreator, and set your executable to nmap in w08-noise.
Initial Explorations
When you first run your program, you should get a texture mapped sphere. You can rotate using the x,y, and z keys. Use the v key to toggle shaders. The second shader is currently a per fragment lighting shader.
Perlin Noise
Ken Perlin's 1999 Talk

We need random noise maps. Add srand(time(NULL)) to NoiseGenerator constructor.

Let's build a color gradient map. We'll need some helper functions in test_noise

Make a gradient image. Let yval vary from 0 to 1 as the rows change, and let the img(j,i)=vecColor(lerp(blue, white, yval)),

Now add some noise. To a first approximation, something like this could work: yval = yval + 0.15*surf1(x,y);. Note yval could exceed the range 0 to 1. If so, clamp it, don't wrap it