Chris Pollett> Old Classes> CS185c
( Print View )

Student Corner:
[Submit Sec1]
[Grades Sec1]

[Lecture Notes]
[Discussion Board]

Course Info:
[Texts & Links]
[Description]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Grading]
[Requirements/HW/Quizzes]
[Class Protocols]
[Exam Info]
[Regrades]
[University Policies]
[Announcements]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Project] [Quizzes]

Practice Exams:
[Midterm] [Final]

HW#2 --- last modified March 12 2019 15:42:55.

Solution set.

Due date: Mar 6

Files to be submitted:
  Hw2.zip

Purpose: To gain experience with WebGL and computer graphics connected with VR

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO1 -- Be able to create VR apps using WebVR, a VR mobile SDK, or Unity game engine.

CLO2 -- Be able to calculate by hand the effects of various VR rendering transformations on different input vectors.

CLO5 -- Be able to code a VR app in which objects move according to some kind of simulated physics and in which collisions are detected.

CLO6 -- Be able to code a VR app that does head motion tracking.

Specification:

This homework consists of two parts both of which are aimed at giving you some simple computer graphics experience. For the first part I'd like you to do the written problems below and submit your solutions in the file Hw2.pdf which you include in your ZIP file. For the second part I'd like you to code using WebGL and WebVR a simple scene which I describe below.

  1. Suppose one has a model which consists of a line segment `((0,0,1)`, `(0,0, -1))`. One wants to counter-clockwise rotate it by 45 degrees about the x-axis and move it `(3,-2, 4)` from the origin. Give the homogeneous transformation matrix for this.(1pt) Compute the effect of the transformation on the points in the segment (1/2pt). What would the matrix be if we wanted to scale the figure by a factor of 2? (1/2pt)
  2. Suppose one wants perform a counter-clockwise rotation of `pi/3` about the vector `(-1, 3, 5)`. Compute the quarternion needed to do this (1pt). Let `vec v = (1, 0, 0)`. Show your quarternion works by computing `q vec v q^{-1}` and verifying it makes sense (1pt).
  3. Suppose distances in our virtual world are measured in meters. Let's assume people's eyes are 6cm apart. We want to view a scene from the point `(5, 0, 5)` looking at the origin. What would be the view matrix for each eye? (1pt/eye).

For the coding part of the assignment I want you to make a simple animation of a day in the life of a Smurf Mushroom House using pure WebGL and WebVR (no A-Frame). If you are wondering what a Smurf is check out the Smurf Wikipedia Article. For the purposes of this homework, a Smurf house is a red half-sphere on top of a squat cylinder. Place a 2m tall Smurf house at the origin. Make the x-z plane green to represent grass. Set up the scene so we are viewing it from `(0,5, -5)` looking at the origin. In the Smurf universe, nothing happens until we click an enter VR button, although on a HTML canvas we would see the 3D scene. When the Enter VR button is clicked, the scene is rendered to left and right eye displays stereoscopically. At location `(4, 0, 0)` a yellow sphere representing the sun should rise and traverse a circular bath in the `x-y` plan until it reaches/intersects the ground at `(-4, 0, 0)`. This should take 20 seconds. If desired, you can make this loop. That is all there is to a day in the life of a Smurf House. Put your house in the file index.html and include it and any external Javascripts you write in your Hw2.zip folder.

Point Breakdown

Written exercises (2pts each)6pts
3D Scene on HTML Canvas draws okay and uses only pure WebGL and WebVR, makes use of shaders to draw1pt
Enter VR toggles into VR mode1pt
In VR mode, scene draws stereoscopically1pt
Animation is as described1pt
Total10pts