CMPS 160 -- Program 3
Early if time stamp is before midnight May 12, 2016.
On time if time stamp is before midnight May 13, 2016.
Late if time stamp is after midnight May 13, 2016.
Submissions turned in after midnight May 14, 2016 will not be accepted/graded.
Objectives:
Create a basic scene modeler
Description
-
We want to allow the user to create a scene by placing different
objects of different sizes and orientations into the scene.
The first thing to do is to have a wide enough view so that you
can see "everything" in the scene.
So, rather than scaling to the dimensions of a single object,
you'll be scaling your objects to fit inside the volume bounded by
-1 to +1 along each dimension.
-
Allow users to translate an object by left clicking on it and dragging
it to the desired position.
Note that since we have a fixed viewpoint only, translations will not affect the z coordinate.
Bonus (10): come back to do this after you've completed the other requirements --
make sure that the mouse position is tracking the object position i.e. a one pixel move
of the mouse to the right will cause a one pixel move of the object to the right, etc.
-
As each object is read in and displayed (initially in the middle of your canvas),
the user can scale it, position it, rotate it, etc.
As much as possible, use direct manipulation (with mouse drags and button clicks
rather than sliders) for these transformations.
Include a README file, or some text as part of your display on how to do translate,
rotate, scale.
It is fine to do rotations about the "vertical" axis only i.e. the axis through the
current position of the object and aligned with the world y-axis.
You don't need to worry about rotations about the other 2 axes.
-
An important (and challenging) part is that the transformations should be done "in place".
For example, like in Lab3, rotations are done "in place". If an object has been moved to
some location other than the origin, any rotations should make the object rotate in place
and not about the origin. To implement this, you need to move the object to the origin
first, do the rotation, then undo the translation.
Same thing for scaling, it should be scale in place.
-
Like in Lab3, users should be allowed to carry out the transformations in any order to any
object, and the results are cumulative.
That is, if I've scaled an object already, and I later pick it again and move it, the scaled
object is moved to the new location, etc.
The standard way to do this is by maintaining a composite matrix per object.
Subsequent transformations are multiplied to the composite matrix.
-
Part of the scene description is lighting.
Here we will add a second white light source in addition to the headlight.
This light source should be represented by the cube object in our
data repository, and initially positioned at (0.5, 0.5, 0.5).
This cube / light object is only lit by the headlight. It does not light itself.
Allow the user to pick the cube / light object and move it around the scene.
-
In addition to diffuse lighting, add specular lighting also.
Just as you specified a material color (K_d) for an object,
you will also specify a specular color (K_s) for an object.
Select a different specular color from material and light colors
to help you see the effects of specular lighting.
Add a GUI (e.g. slider) to allow users to vary how shiny the object is.
The range should go from 1 (dull) to 20 (shiny).
Add another GUI (e.g. toggle) to turn on specular lighting on/off.
Grading:
This program will form part of your CMPS 160 grade.
10 separate html and javascript files, both well documented
10 making everything fit the viewing area
10 translation (series of translations on an object)
10 scaling (series of scaling on an object) -- in place scaling
10 rotation (series of rotations on an object) -- in place rotations
10 any order of transformation on an object
10 extra light source which can be moved around
10 correct lighting as light source is moved or as objects are moved.
10 toggle for specular lighting (if off, then diffuse only).
10 specular lighting
10 bonus -- mouse tracking during translation
10 bonus -- undo button to undo the last action, no need to keep track of chain of events.
added:
-5 take off at least 5 points if they still can't do object selection via mouse clicks.
-5 if they can only deal with 1 object plus the box for the light
-20 if they can only deal with 1 object and not even the box for the light
Who graded your assignment:
John (Andy): aassi - dpeat
David: dstanbe - kercoffm
Daniel: kevylet - nmlamper
Joseph: nnakano - zpeterse
Submission:
Submit your index.html file and the javascript code in SceneModeler.js.
Include a README file as appropriate.
Zip everything up into prog3.zip
Submission must be done using the "submit" command from unix.ic.ucsc.edu
- submit cmps160-ap.s16 prog3 prog3.zip
Last modified
Tuesday, 17-May-2016 20:56:22 PDT.