# Homework 4 (due 10/14)

Homework is due on Wednesday by 4pm; you can drop it off on the 4th floor front desk. We talked about programming (loops and recursion), and 2D-texture mapping. Next week we will continue with 3D-texture mapping.

1. [Reading Assignment] Read chapter 6 on texture mapping in Wolfe. 3D Graphics, A Visual Approach.

2. [Lawn, 20pt] Extend the lawn macro to include the following functionality:

• the position of each blade is disturbed slightly at random; maximum dislocation controlled by parameter max_jitter (in percent of the xinc, zinc values)
• the rotation of each blade is disturbed slightly at random; maximum rotation (towards left or right) controlled by max_rot
• the blade can, randomly, lean slightly forwards or backwards; extremes controlled by max_forward_angle and max_backward_angle
• the color of each blade is modified sligthly; maximum change (plus or minus) controlled by the vector max_color_jitter

Then build a simple scene using the macro (no additional objects, just adjust lighting, camera, and your parameters). You can start working of hw4_lawn.pov which already contains the parameter declarations (also note that the MakeBlade macro has changed: it now does not take the position of the blade as an input anymore, all of this can be done in the lawn macro).

3. [Fern, 30pt] You want to write a program displaying a fern. Write a macro fern(n, len, wid) that builds a fern of height len and width wid recursively. fern(0,len, wid) should just be a cylinder of height len (and fixed radius, around 0.005), see below.

Then fern(n, len, wid) should be built recursively by alternately placing ferns built as fern(n-1, adjusted length, adjusted width) on the left and right. For example, here are fern(1,1,0.5), and fern(2,1,0.5):

and finally, fern(3,1,0.5):

You can either start from scratch, of use the hw4_fern.pov template, which contains the basic structure of a possible program to build the fern. If your fern doesn't quite look like mine, no problem, maybe it'll look much better.

4. [Trees, 40pt] Plant a tree. There are several macro-packages for building trees, have a look at http://www.oyonale.com/ressources/english/sources01.htm, which lists several of them. Pick one, get familiar with it, and use it to build a tree. Use the tree in a simple scene (just trees and lighting are ok). Note: for this part, on top of your pov-ray file and bitmap, submit a description of what tree to tried to build, and how you used the parameters of the tree-package to achieve that effect.

Submission:

• For questions asking for renderings, submit both .pov and .bmp files (either by email, or on disk).
• Collect the answers to your written questions and submit them on paper
• If you submit multiple items, please place them together in a labeled envelope
• Make sure everything your submit (emails, disks, pieces of paper) is clearly labeled and contains your name

Marcus Schaefer
Last updated:  October 5th, 2005.