##
Homework 11

The previous homework was tricky,
in that you needed to figure out how to shape
the function so as to create round dots instead of
square shapes. I know that a good number of you got
stuck on this point.
The basic trick was to make the "waterline" that forms
the dots' silhouette high enough up so that the silhouette
shape is round instead of square.
I've decided that this was a bit
*too* tricky, so I'm going to roll the last assignment
and this one into a combined assignment, all to be due next Monday.

The combined assignment is to take the
specific `f(xyz)` implementation at the bottom of this email, and to use
that function to make fuzzy dots, sharp dots, and bumps,
respectively, on your sphere, as in last week's
assignment. What you hand in will count
as both last week's and this week's assignment.

Again: extend your Phong-shaded sphere Applet,
so that it can be used to
apply the following procedural textures
to your test sphere:

- A pattern of fuzzy dots.
- A pattern of tunably sharper dots.
- A bump pattern.

Anybody who has already succeeded in producing round
dots before now will receive one point of extra credit,
and you get another point if you've already made a bump
texture that matched your dots (round or not) before now.
That's just to be fair to the students who have worked things
out on their own before now.
Some hints:

- you must do the bumps calculation before doing the
lighting, whereas it's fine to do the dots texture calculation
after lighting.
- When you do the bumps calculation,
be sure to start out by copying
`xyz[]` into some
separate variable (since in the code I gave
you last week, I used the same `double[3]` location
for both `xyz[]` and `nn[]`, and if you keep them in the
same place it will screw up any calculations that
involve modifying either `xyz[]` or `nn[]`).
- a reasonable way to
do dot texturing is to do some amount of scaling
of all components of
`rgb[]` by the result of `f(xyz)`,
after lighting.

Here's a definition of `f(xyz)` you can use:
double f(double[] xyz) {
return _f(xyz, -.785) + _f(xyz, .785);
}
private double _f(double[] xyz, double z) {
double t = Math.sin(20*xyz[0]) *
Math.sin(20*xyz[1]) *
Math.sin(20*xyz[2] + z);
t = Math.max(0,Math.abs(t)-.3);
return 4 * t * t;
}