CSE 160 -- Prog 4
Early if time stamp is before midnight Nov 25, 2019.
On time if time stamp is before midnight Nov 26, 2019.
Late submissions will not be accepted/graded.
Objectives:
Add camera control.
Description:
Allow the user to change the viewpoint using GUI.
Bonus for Prog4:
Full 3D rotations involve roll, pitch, and yaw
(e.g. from
point of view of pilot).
-
Look around.
When the user double clicks on an object,
the camera (LookFrom) is moved to the center of the object and a full 360
animated view is generated.
The required rotation is around the yaw axis (which is aligned with the
y-axis of the viewing coordinate frame, and also aligned with the z-axis of the world coordinate frame).
-
Examine.
When an object is selected (left clicked)
and the user presses the letter "e" on the keyboard,
the LookAt point is moved to the center of the object and a full 360
animated view looking at the selected object from different vantage points is generated.
This time, the required rotation is around the vertical z-axis of
the world coordinate system.
That is, you need to position the camera (LookFrom) around a circle
on the world xy-plane.
Use the height of the tree for the z-value so that the camera is pointed slightly down.
Details:
-
Zooming.
Allow the user to zoom in and out. This is achieved by modifying the field-of-view (fov)
parameter in your perspective call. Note that the camera position does not change.
To specify zooming, no objects must be selected.
Scrolling the wheel is then mapped to fov --
as the wheel is scrolled up, the fov is reduced thereby creating a zoom-in effect;
when the wheel is scrolled down, the fov is increased thereby creating a zoom-out effect.
-
Panning.
Again with no objects selected,
when the user left clicks on the background and moves the mouse,
it will move the camera horizontally and vertically on XY-plane of the image plane
of current view.
Note that the image plane is not always aligned with the world coordinate frame
e.g. after the view has been rotated (see below).
Panning the camera produces an effect somewhat opposite
to what you saw with object translation.
For example, when the camera is panned to the right, objects appear to move to the left.
-
Move the camera in or out.
This functionality allows the camera to be moved forward or backward along
its current view direction.
If the user clicks on the background with the
middle mouse and scrolls the wheel, it will move the camera in or out along the z-coordinate of
the viewing coordinate frame.
Unlike the zooming operation mentioned above, fov is unchanged,
but this will actually change the position of the camera.
Final Project:
When the size of this class was much smaller,
we used to have
final projects.
That has since evolved into extensions of Prog4 for those who wish to do
extra work.
This quarter's offering allows you plenty of room to do this as well.
Here are some possible extensions that you may consider:
-
Add terrain -- these can either be actual terrain from elevation maps (e.g. USGS
has plenty of data), or computer generated fractal terrains usually done via
triangle subdivision.
-
Add variety to the trees -- add randomness to the angles and lengths,
or even change the grammar rules to produce different types of trees --
google
fractal trees
-
Add leaves, flowers, fruits.
-
Add computer generated grass.
-
Add animation for seasonal changes, or wind, or fire?
Resource:
Detecting
double clicks
How to do
key press events.
Read the examples in chapter 7 of the Matsuda-Lea book.
Grading:
-
Rubric:
You start off with 100 points. You earn additional credit by turning in your assignment
early and/or implementing additional features. You lose credit for missing functionality,
incorrect results, poorly documented or formatted code, or not following instructions.
Below is a partial list:
- up to 10 points off for poor features.html file
- up to 10 points off for inadequate comments or hard-to-read code
- up to 10 points off for not following instructions
- up to 10 points off for special handling to grade your homework (usually
because you did not check that it runs on the computers in the lab first).
- functionality points depending on importance
Make sure you:
a. submit the right files you want us to grade,
b. have tested your code on the browsers in the lab.
c. follow the general instructions described in overview.html
-
Who graded your assignment based on your login name:
Alfred Lam: A - G
Issei Mori: H - M
Adam Filiz: N - Z
Submission:
See
course overview
for instructions on what to submit and what not to submit.
Put materials in a folder named lab4 and zip it up.
Submission must be done using Canvas.
Last modified
Monday, 18-Nov-2019 12:43:51 PST.