Project 10: Non-Photorealistic Rendering

In this assignment you will implement and demonstrate two more drawing styles in the Interpreter class. To implement a new style, add another case to the if statement in the forward method of the Interpreter class.

You will enhance your scene from the last project by making use of the various drawing styles you implement. You should be able to run the scene with different styles using minimal changes to the code.

Tasks

  1. Implement an NPR style 'broken' that draws a line segment as two jittered half line segments. The implementation is similar to the 'jitter' case, but instead of drawing one line, you draw two. One line goes from the jittered start point to a jittered midpoint, the second line goes from another jittered midpoint to the jittered final point. The midpoint of the line segment is:
    (xm, ym) = ( (x0 + xf)/2, (y0 + yf)/2 )

    Once you have the midpoint, creating two jittered lines is simple.

    # Pick the pen up
    # Go to (x0 + jx, y0 + jy)
    # Put the pen down
    # Go to (xm + jx, ym + jy)
    # Pick the pen up
    # Go to (xm + jx, ym + jy)
    # Put the pen down
    # Go to (xf + jx, yf + jy)
    # Pick the pen up
    # Go to (xf, yf)
    # Put the pen down
    

    Note that for each goto statement, the jx and jy values should be regenerated from a Gaussian distribution (random.gauss) with a zero mean and jitterSigma as the standard deviation. They should not all be the same.

  2. Make a file taskA.py that draws three copies of one of your shapes from last week. Show the shape drawn in 'normal', 'jitter', and 'broken' style.

    An image with three copies of a shape in different styles is required image 1.

  3. Create a 'dash' style that draws straight, but does not draw a solid line. Do not hard code the dash length—instead, create a field in Interpreter.__init__ method called dashLength. You'll also need a setDash method in the Interpreter class and a setDash method and associated dash field in the Shape class, just as we did with the style and jitter information.
  4. Make a file taskB.py that generates a collection of shapes that show the 'dash', 'normal', 'jitter', and 'broken' drawing modes. Your writeup should point out which examples are which.

    An image of the collection of shapes in four different styles is required image 2.

  5. Copy your indoor scene code from last week into the working folder for this project. Edit your scene so that it makes use of the different drawing styles. Feel free to enhance the scene in other ways, but focus on making use of the different drawing styles and shape classes you've created. When you're done, you should have something that looks a bit more like a real painting or drawing.

    The updated indoor scene is required image 3.

  6. Make a parameterized, stochastic, multirule L-system. You can create a variation on one of the given files or look in ABOP for inspiration. If you create a variation, you need to do more than just add ornaments (leaves or berries). Make the shape structurally different so the change is obvious.

    Your new L-system does not have to be a tree, but it does need to include branching, multiple rules, and at least one rule with more than one replacement string. Describe the L-system you designed in your writeup and explain your design choices. Make a scene or image that includes your L-system.

    A picture of the new L-system is requied image 4.

Extensions

Writeup

Remember, there are two components you need to hand in: your code and a writeup. Put the Python source files you wrote on the Academics server in your private directory. (You can find instructions for accessing the Academics server on the Lab FAQ.)

Make a new wiki page for your assignment in your personal wiki space. Add the following label to the page:

cs151f11proj10

Colby Wiki

In general, your writeup should follow the outline below.