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:

  1. A pattern of fuzzy dots.
  2. A pattern of tunably sharper dots.
  3. 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:

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;