Difference between revisions of "Project1S18"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Starter Code)
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
To be released by 4/7
 
 
<!--
 
- use starter code with SLN file
 
- add touch controllers
 
- load sphere from obj file
 
- draw one sphere in environment, one at hand
 
- task: draw 3d array of spheres; highlight one in different color; user clicks on it with cursor; measure time to find 10 spheres.
 
- extra credit: hand avatars, new gameplay, different shapes
 
 
 
=Where's Waldo 3D=
 
=Where's Waldo 3D=
  
 
+
In this first programming project of the course you need to extend our starter code to a game in which the player needs to find a highlighted sphere among a 3D array of similar spheres, and click on it. The player has one minute to click on as many highlighted spheres as possible.
  
 
==Starter Code==
 
==Starter Code==
  
We recommend using the [https://github.com/jherico/OculusMinimalExample/blob/master/OculusMinimalExample.cpp Oculus Minimal Example] code from GitHub to start with. It's very compact but yet uses most of the API functions you will need. The code is slightly outdated though and will require some updating. [https://github.com/wangtim1996/MinimalVR Fixed version here so you don't need to deal with Visual Studio as much]
+
We recommend using this [https://github.com/wangtim1996/MinimalVR Oculus Minimal Example] code from GitHub to start with. It's very compact but yet uses all of the API functions you will need.
 +
 
 +
To the minimum example you will need to add controller support, which [[OculusControllerCode |this piece of sample code]] illustrates how it can be done. You can add this code to the draw() function of the minimal example to get printouts of the controller parameters. To see the <tt>cerr</tt> messages you have to display the terminal window, which you can do by replacing the line with <tt>WinMain</tt> with this one: <tt>int main(int argc, char** argv);</tt>
  
 
To better understand how the Oculus API works, we recommend [https://developer3.oculus.com/documentation/pcsdk/latest/concepts/dg-sensor/ this example from Oculus]. It is up to date for the current version of the Oculus SDK and can be very useful.
 
To better understand how the Oculus API works, we recommend [https://developer3.oculus.com/documentation/pcsdk/latest/concepts/dg-sensor/ this example from Oculus]. It is up to date for the current version of the Oculus SDK and can be very useful.
 +
 +
If you want to use a different programming environment, [http://ivl.calit2.net/wiki/index.php/CalVR UCSD's CalVR] and [http://www.chai3d.org Stanford's CHAI3D] are approved alternatives.
  
 
==Project Description (100 Points)==
 
==Project Description (100 Points)==
  
Download the starter code and get it to work with the Oculus Rift. (5 points)
+
Download the starter code and get it to work with the Oculus Rift. (10 points)
 
+
Based on the starter code, write a VR application for the Oculus Rift and the Touch controllers with the '''Oculus SDK in C++ and OpenGL''' (no Unity etc). Here are step by step instructions for it:
+
 
+
* Make the background color of the application a dark blue (for a dark blue sky). (5 points)
+
* Pick out a factory model from the list below (or a different one of your choice) and load it into memory. A good way to load it is with the [http://www.assimp.org/ Assimp library] as described on the discussion slides. (10 points)
+
* Place the factory model as a miniature model (~1 foot wide) in front of the user and just below table height. (5 points)
+
* Have the factory emit a CO2 molecule every ~1 second. Start the game with 5 CO2 molecules floating in the air. The CO2 molecules each need to have independent initial (upwards) velocity and spin. Their initial velocity and spin should be randomized. For a 3D model of CO2 see below. Scale the molecule so that each atom is about the size of a tennis ball (7cm diameter). (20 points)
+
* Define an invisible box (about 3 foot cubed) in front of the user which keeps the CO2 molecules contained and makes them bounce off the walls. The bouncing can be done very simply by negating the coordinate axis which would make the molecule escape the bounding box. (5 points)
+
* Add support for the Oculus Touch controllers. Display a green laser beam as an OpenGL line or a thin cylinder, emanating from the location of each touch controller. (20 points)
+
* When the user pulls the index finger trigger, change the color of the laser of that Touch controller to red. (5 points)
+
* When both triggers are pulled, and the user points both laser beams at a C atom so that they both intersect the atom's bounding sphere, the C atom should disappear and an O2 molecule remains. For a 3D model of O2 see below. (10 points)
+
* Once more than 10 molecules are in the environment, the trainee loses. To visually indicate the loss you should draw 100 or more CO2 molecules in random locations in the environment. (5 points)
+
* Once all molecules have been eliminated, the trainee wins and the factory stops producing CO2. Change the background color to light blue in this case to indicate the victory. (5 points)
+
* After the game ends, show win or lose state until the user presses any one of the controller buttons (not triggers), then restart the game. (5 points)
+
 
+
'''Grading:'''
+
* -3 if model colored incorrectly
+
* -3 if molecules don't spawn from factory
+
* -3 if molecules don't spin
+
* -5 if lines don't move correctly with controllers
+
 
+
==3D Assets==
+
 
+
We provide the following 3D models for you to use in your application, in [[Media:project1-assets.zip | this zip file]]:
+
 
+
* CO2 molecule
+
* O2 molecule
+
* 4 factory models to choose from. The pictures below are in order, factory1..factory4.
+
  
[[File:factory1_360.png | x200px]][[File:factory2_360.png | x200px]][[File:factory3_360.png | x200px]][[File:factory4_360.png | x200px]]
+
Based on the starter code, write a VR application for the Oculus Rift and the Touch controllers with the '''Oculus SDK in C++ and OpenGL''' (no Unity, Unreal, DirectX, etc). Here are step by step instructions for it:
  
To import these OBJ files, we suggest using the [http://www.assimp.org/ Assimp library].
+
* Use a background color of your choice other than black for your application (5 points).
 +
* Load the [http://ivl.calit2.net/wiki/images/a/a9/Sphere2.zip the OBJ file of a sphere] and display it at the user's dominant hand's controller position. This is the cursor sphere. To load the sphere you can use the [http://www.assimp.org/ Assimp library]. (10 points)
 +
* Create and render a 3D array of 5x5x5 = 125 spheres in a color of your choice. Each sphere should be the size of a tennis ball (0.07 meters diameter), and the balls' center points should be 0.14 meters apart from one another in all three dimensions. (10 points)
 +
* Wait for the user to pull the trigger button (index finger) to start the game. (10 points)
 +
* Create a way to change the color of a random sphere of the array to highlight it. (10 points)
 +
* Create the ability to move the cursor sphere to the highlighted sphere and upon trigger button click on the controller (index finger) test to see if the cursor is touching the highlighted sphere (a simple center-distance test will do). (15 points)
 +
* Once the highlighted sphere has been clicked on, move the highlight to a new randomly selected sphere. (10 points)
 +
* Repeat the above until one minute has passed since the game was started. (10 points)
 +
* Display the number of correctly clicked spheres in the terminal window (not in VR), and restart the game. (10 points)
  
 
==Extra Credit (Max. 10 Points)==
 
==Extra Credit (Max. 10 Points)==
Line 59: Line 33:
 
Options for extra credit are:
 
Options for extra credit are:
  
* Audio: use the [http://www.softpedia.com/get/Programming/SDK-DDK/Oculus-Audio-SDK.shtml#download Oculus Audio SDK] to play sounds for eliminating C molecules (sound should come from location of eliminated molecule), generating new ones in the factory (sound should come from spawn location), and a sound for when the game is won. (10 points) Note: must use Oculus SDK to get full points.
+
* Avatar hands: use the [https://developer3.oculus.com/documentation/avatarsdk/latest/concepts/avatars-sdk-intro/ Oculus Avatar SDK] to show stylized hands and/or touch controllers in their correct locations (where the user's physical hands are). (10 points)
* Haptic feedback: the Oculus Touch controllers have built in vibration generators. Add support for vibration feedback for when a C molecule is eliminated, and potentially other events. (5 points)
+
* New game play: come up with a game that also involves clicking on things but is more fun than the homework project. (up to 10 points)
* Draw hands: use the [https://developer3.oculus.com/documentation/avatarsdk/latest/concepts/avatars-sdk-intro/ Oculus Avatar SDK] to show stylized hands and/or touch controllers in their correct locations (where the user's physical hands are). (10 points)
+
* Instead of displaying text in the terminal window, display all text within the VR environment. You need to display at least the following things: a message to start the game, a countdown timer that shows the remaining seconds in the game, a message that the game is over along with the number of correctly clicked spheres. (5 points)
 +
* Support grabbing the set of spheres with the controller in the non-dominant hand: pressing and holding a button on the controller grabs the entire set of spheres as if they're all invisibly connected rigidly to the user's hand (they need to both translate and rotate with the hand). Once the button is released the movement of the spheres stops. (5 points)
 +
* Instead of (or in addition to) highlighting the sphere that is to be clicked on, wrap a [https://metrouk2.files.wordpress.com/2012/09/article-1346848996385-14d8f9fb000005dc-43911_636x475.jpg picture of Waldo] around it as a texture. Note that the sphere OBJ does not include texture coordinates. You're going to have to add them or find a sphere model with texture coordinates. (5 points)
  
-->
+
We might add more options later.

Latest revision as of 11:18, 18 November 2018

Contents

Where's Waldo 3D

In this first programming project of the course you need to extend our starter code to a game in which the player needs to find a highlighted sphere among a 3D array of similar spheres, and click on it. The player has one minute to click on as many highlighted spheres as possible.

Starter Code

We recommend using this Oculus Minimal Example code from GitHub to start with. It's very compact but yet uses all of the API functions you will need.

To the minimum example you will need to add controller support, which this piece of sample code illustrates how it can be done. You can add this code to the draw() function of the minimal example to get printouts of the controller parameters. To see the cerr messages you have to display the terminal window, which you can do by replacing the line with WinMain with this one: int main(int argc, char** argv);

To better understand how the Oculus API works, we recommend this example from Oculus. It is up to date for the current version of the Oculus SDK and can be very useful.

If you want to use a different programming environment, UCSD's CalVR and Stanford's CHAI3D are approved alternatives.

Project Description (100 Points)

Download the starter code and get it to work with the Oculus Rift. (10 points)

Based on the starter code, write a VR application for the Oculus Rift and the Touch controllers with the Oculus SDK in C++ and OpenGL (no Unity, Unreal, DirectX, etc). Here are step by step instructions for it:

  • Use a background color of your choice other than black for your application (5 points).
  • Load the the OBJ file of a sphere and display it at the user's dominant hand's controller position. This is the cursor sphere. To load the sphere you can use the Assimp library. (10 points)
  • Create and render a 3D array of 5x5x5 = 125 spheres in a color of your choice. Each sphere should be the size of a tennis ball (0.07 meters diameter), and the balls' center points should be 0.14 meters apart from one another in all three dimensions. (10 points)
  • Wait for the user to pull the trigger button (index finger) to start the game. (10 points)
  • Create a way to change the color of a random sphere of the array to highlight it. (10 points)
  • Create the ability to move the cursor sphere to the highlighted sphere and upon trigger button click on the controller (index finger) test to see if the cursor is touching the highlighted sphere (a simple center-distance test will do). (15 points)
  • Once the highlighted sphere has been clicked on, move the highlight to a new randomly selected sphere. (10 points)
  • Repeat the above until one minute has passed since the game was started. (10 points)
  • Display the number of correctly clicked spheres in the terminal window (not in VR), and restart the game. (10 points)

Extra Credit (Max. 10 Points)

Options for extra credit are:

  • Avatar hands: use the Oculus Avatar SDK to show stylized hands and/or touch controllers in their correct locations (where the user's physical hands are). (10 points)
  • New game play: come up with a game that also involves clicking on things but is more fun than the homework project. (up to 10 points)
  • Instead of displaying text in the terminal window, display all text within the VR environment. You need to display at least the following things: a message to start the game, a countdown timer that shows the remaining seconds in the game, a message that the game is over along with the number of correctly clicked spheres. (5 points)
  • Support grabbing the set of spheres with the controller in the non-dominant hand: pressing and holding a button on the controller grabs the entire set of spheres as if they're all invisibly connected rigidly to the user's hand (they need to both translate and rotate with the hand). Once the button is released the movement of the spheres stops. (5 points)
  • Instead of (or in addition to) highlighting the sphere that is to be clicked on, wrap a picture of Waldo around it as a texture. Note that the sphere OBJ does not include texture coordinates. You're going to have to add them or find a sphere model with texture coordinates. (5 points)

We might add more options later.