Assignment 3 - Viewing and Navigation- (100 points)



Due Date: 10/06/2015 at 11:59pm

Objectives:



  • Use WebGL to control the camera for traversing your texture Terrain
  • Learn to calculate interpolated positions in WebGL
  • Learn to navigate the scene using mouse input in WebGL

Traversing a Terrain



For this assignment, you will be modifying your last assignment to drive over your texture based Terrain.

  • You will replace the former distant camera view with a camera located at the point of view of a person sitting in a vehicle approximately 1 meter above the Terrain.
  • You will replace the mouse motion handler with a new one that maps horizontal mouse motion to looking left and right and vertical mouse motion to speeding up and slowing down your motion.
  • The view should tip to align with the landscape as you move.
  • You should move in the direction your camera is looking.
  • To figure out the vertical position for your vehicle and the up-vector for the view, you will need to calculate what grid triangle you are in from your current x,y position over the grid, then find the height for the vertices of the triangle, and finally interpolate to find the height and components of the up vector of the current position.
  • You will need to adjust the view camera based on this computed information.
  • Perspective projection should be applied in the WebGL projection matrix, while viewing transformations should be applied in the WebGL model/view matrix. It is probably easiest to continue to adjust the view matrix in your draw function and just update state in your motion function.
  • Extra Credit



  • Add some fun additional animated vehicle motion. Be creative - think about what kinds of motion a vehicle might have, then figure out how they'd break down into per-frame steps.
  • Strategy



  • Plan ahead first. Know how you're going to find the position and view vector. Once you have a plan, implement in stages that each produce a visible result. While it is not part of the assigned project, it may also be useful to set up extra keys to show debugging results. For example, a key that switches from the perspective view to an 'assignment 2'  view with the vehicle postion marked by a point could be helpful if you are having trouble debugging your position code.
  • If your assignment 2 did not work, you can get a working sample version from me after you have turned in your final version of assignment 2. However, I would encourage you to start from your own assignment 2 code if at all possible. Problems with your assignment 2 will not count against your assignment 3 grade, but you should at least have some landscape height
  • Submitting the Assignment



    Required files



    Please include the following files for submission.

    • HTML and javascript source code files
    • A few screenshots of your output
    • Any new height field files that you used for testing
    • README - This should be a text file (.txt) and should include your name, a list of the files being submitted, any awesome WebGL or Javascript functions you discovered and used, which extra credit you implemented (if any) and anything you want to tell me about this assignment. Please mention the names of students you worked with or websites you used for this assignment.
    • User manual - A manual.txt file and list any key/mouse combinations for customized interaction (zooming, etc.)

    Put all the required files for the assignment in a single directory, change to that directory and submit using the following command:

    submit stevencutchin cs464 A3