Computer Science 110
The Art & Science of Computer Graphics

Mount Holyoke College
Spring 2010


Studio/Lab 6: Programmed Replication
Due: 11:59 PM, Wednesday, March 31, 2010


For the next week, you are to develop your most complex scene so far. Using the programming techniques we have discussed and will discuss in class, you can develop a scene with replicated components.


Shared Model Repository

The first part of this lab assignment is to contribute one or more models for a shared class model repository. You have created some very interesting models over the first half of the semester, and I would like you to be able to use each others' models as building blocks for the scenes you will be developing for the last few labs and for your final projects. To do this, take your favorite object or objects that you've developed for any previous lab models and put each into a form that will make it easy for your classmates to use.

As an example, here is my modification of the PacMan object put into a format that will make it more easily usable by everyone:

; Mead shared object file -- a Pac Man
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
;
; When developing code to be shared, it is especially important
; to document it well.  The first thing we'll do here is
; to describe the things defined in this shared module.
;
; This module defines a Pac Man object, named pacMan.  It is
; a sphere with a notch cut out, made of yellowPlaster
; material.  The Pac Man occupies the same space as the
; standard sphere - 100x100x100, centered at the origin.
;
; Now, on to the definition.
;
; We define the name of the module first -- this is the
; name of the definitions you intend to provide
(module PacMan mzscheme
  ; inside this "module" definition, we first require
  ; the same things we would normally require in our
  ; Mead models
  (require (lib "Defs.ss" "Mead"))
  
  ; But now we also have to say which names defined in this
  ; module will be visible to users of the module.
  ; Other names defined inside the model are private to the
  ; module and can collide with names in other parts
  ; of the model that uses this module without any trouble.
  ; In this case, we only provide the definition of the Pac Man
  (provide pacMan)
  
  ; we now define our Pac Man as usual.
  ; Pac Man is a circle with a triangular mouth opening, so we
  ; will make him a sphere with a wedge cut out for his mouth
  (object pacMan Difference
          (add sphere yellowPlaster)
          (add cube
               (compose
                (zRot 45)
                ; we don't want his mouth too far open, so
                ; scale down in the y dimension
                (scale 1 .7 1)
                ; the width of the cube along the x-axis is now
                ; 100*sqrt(2), so we translate by half of that
                (translate (* 50 (sqrt 2)) 0 0)
                )
               )
          )
  ; We need to close our module definition.  Notice that we
  ; don't add anything to the scene or shoot any images
  ; with the camera.  That would be the responsibility of
  ; users of our module
  )

This particular shared model is named PacMan.scm. To use it in your model:

Follow the example above to create at least one shared model to contribute to the class collection.

Good documentation is essential if others are going to be able to use your shared model in their models. Clearly specify the default locations and dimensions of your objects. Specify if they come equipped with a material property or if the user should specify a Material. And take pride in your work: put your name in a prominent position in the comment at the top of your file.

To contribute a model to the shared repository:

  1. Create a new Wiki page (not just a section of your main page) that describes your shared model. Include an image, perhaps captured with an IsometricCamera to provide useful views. Add your page to the "Shared Models" category. And of course, include your name on your shared model's wiki page so your classmates know who gets the credit when they use it!
  2. Email your shared model file to jteresco AT mtholyoke.eduso it can be copied into the shared model repository, located in the class shared folder under shared_models. This year's models will be in a subfolder s10.

If you would like to create a shortcut in your home folder to the shared model repository, open a terminal window and issue this command:

ln -s ~jteresco/shared/cs110/shared_models

When you use a classmate's shared model in one of your models, be sure to give proper credit, both as a comment in your model file and as part of your image description on your wiki entry.

Everyone should contribute at least one model by Monday, March 29, 2010, for 10 lab points. You may (and are encouraged to) contribute additional shared models at any time. Please also feel free to request shared objects of any of the models you have seen developed by your classmates and do your best to provide a model when a classmate requests one.


Replicated Objects

The main lab task is to develop a scene that demonstrates some of the programming techniques we have seen that help manage replicated objects. You may model any scene you wish, but it should have at least one component replicated, with its instances added using one of the programming techniques from our class discussion.

Start by defining the objects that you will use in your scene, whether replicated or single instances. You can work on these even before we have seen all of the replication techniques in class.

As the models become more complex, good code organization and documentation becomes essential. Use constants to define sizes and locations. Continue to develop objects hierarchically. Use plenty of comments. When you use a shared model from a classmate or borrow some code from a class example, be sure to give proper credit in comments in your model.

Caution: another issue that arises as your models become more complex is that rendering times will increase. Please plan ahead! You might consider using a lower image quality when developing your models, increasing it only when you wish to generate final images.


What To Submit

Submit your nicely-formatted and appropriately commented model file and the images it generates in a folder named with your last name and "Lab6". For example, I would submit a folder "TerescoLab6". When you have your model file and your generated images ready in that folder, you can drag it to the submit folder.

Also, upload your images to the wiki, and add a new section ("Programmed Replication") to your wiki page that includes the image and a brief description of your model (include both "artistic" information about what you're trying to model and technical information about how you convinced Mead to do it).


Grading

Your submitted model and image will be graded out of 30 points. Your grade will be based on how well the model meets the requirements, documentation, and presentation on your Wiki page. Documentation (comments) in your submitted Mead model should include your name and a brief description of the model at the top, and descriptions of sections of the model that might not be clear to someone trying to understand it.

Grading Breakdown

Programmed replication 18 points
Code organization and style 4 points
Model documentation 4 points
Image and model description on wiki page 4 points