Difference between revisions of "Project4F20"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Rendering the Astronauts)
(4. Moving the Astronauts (20 Points))
 
(53 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
[https://www.youtube.com/watch?v=PnjZiHQjmG4 This video] has more active astronauts who keep walking around, which is similar to what you need to simulate for this homework project.
 
[https://www.youtube.com/watch?v=PnjZiHQjmG4 This video] has more active astronauts who keep walking around, which is similar to what you need to simulate for this homework project.
 +
 +
Here is a screen shot of the scenario we are going to mimic in 3D:
 +
 +
[[Image:Amongus-lobby-snapshot.png|x200px]]
  
 
This project implements the following skills from the lectures:
 
This project implements the following skills from the lectures:
Line 19: Line 23:
 
Ideally, you re-use your scenegraph structure from project 3. But if you are not happy with it you can implement your project without a scenegraph structure.
 
Ideally, you re-use your scenegraph structure from project 3. But if you are not happy with it you can implement your project without a scenegraph structure.
  
==Rendering the Lobby==
+
==1. Rendering the Lobby (20 Points)==
  
 
We provide an [[Media:cse167f20-project4-lobby.zip|OBJ file for the lobby]], which includes the obstacles (boxes). Many thanks to Baichuan for converting this from a free online asset!
 
We provide an [[Media:cse167f20-project4-lobby.zip|OBJ file for the lobby]], which includes the obstacles (boxes). Many thanks to Baichuan for converting this from a free online asset!
  
Load the OBJ model and display it on the screen. Map mouse movement to a virtual trackball rotation so that you can rotate the lobby about its center. Adjust its size so that it comfortably fits within your graphics window.
+
* Load the OBJ model and display it on the screen. Adjust its size so that it comfortably fits within your graphics window. (10 points)
  
Create a directional light source to illuminate the lobby using the Phong shading model.
+
* Map mouse movement to a virtual trackball rotation so that you can rotate the camera '''about the center of the lobby''', with the look at point being the center of the lobby. It is sufficient to allow rotations about the horizontal axis (i.e., to tilt the model up/down), but you can choose to rotate about more than one axis. Also allow the user to zoom in and out. The point of this is to be able to look at the lobby top-down, but also from a more oblique angle, to see the astronauts from different angles. (7 points)
 +
 
 +
* Create a point or directional light source to illuminate the lobby using the Phong shading model. You can optionally use toon shading, like you will later for the astronauts. (3 points)
  
 
Note that the minimum requirement is to just load the OBJ file. You do not need to load and render the textures for it. This is an option for extra credit.
 
Note that the minimum requirement is to just load the OBJ file. You do not need to load and render the textures for it. This is an option for extra credit.
Line 34: Line 40:
 
[[Image:amongus-lobby-tex.png|x200px]]
 
[[Image:amongus-lobby-tex.png|x200px]]
  
==Rendering the Astronauts==
+
==2. Rendering the Astronauts (20 Points)==
  
We provide [[Media:Cse167f20-project4-astronauts.zip|three versions of the astronaut model]] (thanks to Baichuan for creating them!): one is the astronaut standing still, the other two are animation frames for the walking animation. Load each OBJ file into a separate data structure so that you can switch between the three animation stages as needed.
+
We provide [[Media:Cse167f20-project4-astronauts.zip|three versions of the astronaut model]] (thanks to Baichuan for creating them!): one is the astronaut standing still, the other two are animation frames for the walking animation and are only needed for the extra credit option.  
  
The astronaut files don't come with color. The only difference between the 10 astronauts in the scene is their colors. Here is a table of the astronaut colors. They are given as hex values for red, green and blue. Example: 132ED1 means: red is 13 hex = 19 decimal, green is 2E hex = 46 decimal, blue is D1 hex = 209 decimal. These are all in a range from 0 to 255, so to get them into the range of 0 to 1 you need to divide by 255.
+
The astronaut files don't come with color. The only difference between the 10 astronauts in the scene is their colors. Here is a table of the 12 options for astronaut colors. They are given as hex values for red, green and blue. Example: 132ED1 means: red is 13 hex = 19 decimal, green is 2E hex = 46 decimal, blue is D1 hex = 209 decimal. These are all in a range from 0 to 255, so to get them into the range of 0 to 1 you need to divide by 255.
  
 
{| border="1" cellspacing="0"
 
{| border="1" cellspacing="0"
Line 71: Line 77:
 
|}
 
|}
  
Apply Toon shading: render the astronauts in their respective color, using the toon shading effect discussed in class (silhouette edges and discretized shading).
+
* Load the OBJ file of the astronaut that is standing still and create a draw function for it Color it in one of the color options above. (10 points)
 +
* Apply Toon shading: render the astronauts in their respective color, using the toon shading effect discussed in class (silhouette edges and discretized shading). Toon shading is required for the astronauts (optional for the lobby model). (10 points)
  
 
Below is a picture of what the astronauts should approximately look like:
 
Below is a picture of what the astronauts should approximately look like:
Line 77: Line 84:
 
[[Image:astronauts.png]]
 
[[Image:astronauts.png]]
  
Note: while the game labels each astronaut with the player names, you are not going to need to show any labels.
+
'''Notes:'''
 +
* While the game labels each astronaut with the player names, you are not going to need to show any labels.
 +
* The game allows players to choose hats and other clothing. Our version is not going to do that.
  
==Setting up Collision Detection==
+
'''Grading:'''
 +
* -5 if silhouette edges don't work
 +
* -5 if discretized shading doesn't work
  
* Create bounding spheres for all astronauts.
+
==3. Collision Detection (20 Points)==
* Create bounding spheres for the obstacles in the room (3 boxes).
+
* Create bounding planes for the walls: 4 axis aligned walls, no need to implement diagonal walls.
+
  
==Moving the Astronauts==
+
You only need to populate the lower level of the lobby with astronauts, not the level with the chairs and the computer. They do not need to go up the stairs.
  
1. Player astronaut:
+
* Create bounding spheres for all astronauts. (4 points)
 +
* Create bounding spheres for the obstacles on the lower level of the room (2 boxes). (4 points)
 +
* Create bounding planes for the walls: 4 axis aligned walls (one of them being the bottom of the stairs), plus the two diagonal walls in the bottom left and right corners. (4 points)
 +
* Write an algorithm that checks for the collision of two bounding spheres. (4 points)
 +
* Write an algorithm that checks for the collision of a bounding sphere with the walls. (4 points)
 +
 
 +
Note that since the astronauts walk around on a plane, it is sufficient for your collision detection algorithm to work in 2D, rather than 3D: your bounding spheres turn into circles, planes turn into lines.
 +
 
 +
==4. Moving the Astronauts (20 Points)==
 +
 
 +
1. Player astronaut: (10 points)
  
 
* Dedicate one of the astronauts to be the one the user controls with the keyboard (cursor keys or WASD keys).
 
* Dedicate one of the astronauts to be the one the user controls with the keyboard (cursor keys or WASD keys).
 +
* Choose one of the 12 astronaut colors for the player astronaut.
 
* Use bounding sphere-based collision detection to keep the astronaut from walking into obstacles (boxes), walls or other astronauts. When a collision is about to occur stop the astronaut's movement until the obstacle clears or the user chooses a different direction to go in.
 
* Use bounding sphere-based collision detection to keep the astronaut from walking into obstacles (boxes), walls or other astronauts. When a collision is about to occur stop the astronaut's movement until the obstacle clears or the user chooses a different direction to go in.
  
2. Non-player astronauts:
+
2. Non-player astronauts: (10 points)
  
 
* Non-player astronauts should appear at random points in time and start walking in a randomized direction after a randomized period of time. They should walk along straight lines until they run into a wall, an obstacle (box) or another astronaut.  
 
* Non-player astronauts should appear at random points in time and start walking in a randomized direction after a randomized period of time. They should walk along straight lines until they run into a wall, an obstacle (box) or another astronaut.  
 
* When they collide with something they should bounce off each other like pool billiard balls (angle of incidence = angle of reflection).
 
* When they collide with something they should bounce off each other like pool billiard balls (angle of incidence = angle of reflection).
 
* Occasionally (randomized) they should stop for a randomized amount of time, before they start walking again.
 
* Occasionally (randomized) they should stop for a randomized amount of time, before they start walking again.
 +
* Eventually (randomized) they should disappear from the lobby.
 +
* There can be a maximum of 10 astronauts in the lobby, including player and non-player astronauts.
  
All astronauts always need to face the direction they walk in: this means that you need to rotate the astronaut model about its vertical axis according to the walking direction.
+
3. All astronauts:
 
+
* Each astronaut has to have a unique color, i.e., no two astronauts (including the player astronaut) can have the same color.
Notes:
+
* The astronauts always need to face the direction they walk in: this means that you need to rotate the astronaut model about its vertical axis according to the walking direction.
 
* The astronauts do not need to be animated (i.e., move their legs when walking). It is sufficient to always render the still standing model. Animation is an option for extra credit.
 
* The astronauts do not need to be animated (i.e., move their legs when walking). It is sufficient to always render the still standing model. Animation is an option for extra credit.
  
==Player Appearance/Disappearance Effect==
+
'''Grading:'''
 +
* -2 points if non-player collision bounces are discretized (eg, only 90 degree angles supported)
 +
* -2 if astronauts don't face the direction they walk in
 +
* -2 if astronauts never disappear
  
In the game, the astronauts materialize with an effect that creates a white halo around them, before they show up. We are NOT going to imitate this effect, but instead use a particle effect whenever an astronaut shows up or disappears. We also won't need the astronauts to appear in their respective seats like in the game, but they can show up anywere in the lobby as long as they don't collide with another astronaut or an obstacle.
+
==5. Particle Effect (20 Points)==
 +
 
 +
In the actual game, the astronauts materialize with an effect that creates a white halo around them, before they show up. We are NOT going to imitate this effect, but instead use a particle effect whenever an astronaut shows up or disappears. We also won't need the astronauts to appear in their respective seats like in the game, but they can show up anywhere in the lobby as long as they don't collide with another astronaut or an obstacle.
  
 
Choose particle effects for the astronauts' appearance and disappearance. The effects must be different, but the difference can be minor. For instance, when they appear there might be points starting in the center point of the newly created astronaut's bounding sphere, moving away from that point. When disappearing, similar points might be traveling in the opposite direction. But your imagination is the limit, as long as you have a particle system with at least 100 particles. The particle animations should last about 3 seconds.
 
Choose particle effects for the astronauts' appearance and disappearance. The effects must be different, but the difference can be minor. For instance, when they appear there might be points starting in the center point of the newly created astronaut's bounding sphere, moving away from that point. When disappearing, similar points might be traveling in the opposite direction. But your imagination is the limit, as long as you have a particle system with at least 100 particles. The particle animations should last about 3 seconds.
  
==Extra Credit (10 Points)==
+
Note that the particles have to move independently from each other. A static point cloud is not a particle effect, even if animated by affine transformations.
 +
 
 +
'''Grading:'''
 +
* -5 if the enter/exit animations are identical
 +
* -10 if the effect looks somewhat like a particle effect but does not involve independent particles
 +
 
 +
==6. Extra Credit (10 Points)==
  
 
You can get up to 10 points of extra credit by adding some or all of the features below:
 
You can get up to 10 points of extra credit by adding some or all of the features below:
  
1. Textures for lobby: parse the texture coordinates for the lobby file and render it with the proper textures. (3 points)
+
1. '''Textured lobby''': parse the texture coordinates for the lobby file and render it with the proper textures. In this case you should not use toon shading on the lobby model. (3 points)
  
2. Animated astronauts: load all three astronaut files and switch between a walking animation (by alternating between the two walking models) when the astronaut is walking, and the still model when not. (3 points)
+
2. '''Animated astronauts''': load all three astronaut files and switch between a walking animation (by alternating between the two walking models) when the astronaut is walking, and the still model when not. (3 points)
  
3. Sound effects: Add the following sound effects to your application: (5 points)
+
3. '''Sound effects''': Add the following sound effects to your application: (5 points)
 
* A sound effect for when players join, and a different one for when they leave the lobby.
 
* A sound effect for when players join, and a different one for when they leave the lobby.
 
* A sound effect for whenever the player character moves (e.g., footsteps)
 
* A sound effect for whenever the player character moves (e.g., footsteps)
 
The sound effects should not cut each other, in other words, they should be able to play at the same time without forcing one another to pause or restart.
 
The sound effects should not cut each other, in other words, they should be able to play at the same time without forcing one another to pause or restart.
 +
We recommend the [https://www.ambiera.com/irrklang/ Irrklang] audio API for sound playback.
  
4. Shadows: use shadow mapping to render the astronauts' shadows on the ground. No other shadows need to be rendered. (5 points)
+
4. '''Shadows''': use shadow mapping to render the astronauts' shadows on the ground. No other shadows need to be rendered. (5 points)
 +
 
 +
5. '''First person view''': Allow switching with a keyboard key between the regular third person view and the view from the player astronaut. (3 points)
  
 
=='''Submission Instructions'''==
 
=='''Submission Instructions'''==
Line 146: Line 182:
 
* Example 4: The base project is complete and I did '''z''' for extra credit.
 
* Example 4: The base project is complete and I did '''z''' for extra credit.
  
Finally, zip up your source code (.cpp, .h, executable and shader files, as well as '''any .obj files which were not provided to you''') and submit the zip file at the Assignment link on Canvas as well.
+
Finally, zip up your source code (.cpp, .h, executable and shader files, sound files if extra credit was attempted, as well as '''any .obj files which were not provided to you''') and submit the zip file at the Assignment link on Canvas as well.  
 +
 
 +
In addition to Canvas, please also submit your code to Gradescope. You should have received an email with an invite to it.
 +
 
 +
<!-- Next time:
 +
Make particle system extra credit. Many students did not have enough time to deal with the particle system.
 +
-->

Latest revision as of 00:16, 16 December 2020

Contents

Project 4: Among Us in 167

In this project you will need to build a 3D scene that resembles the activity in the lobby of the popular game Among Us. The lobby, a.k.a. waiting room, is where all players (astronauts) gather before the game starts.

If you are not familiar with Among Us, we recommend that you watch this video clip, which shows a typical game play. Importantly, the first minute of it shows the action in the lobby where the astronauts gather before the game begins.

This video has more active astronauts who keep walking around, which is similar to what you need to simulate for this homework project.

Here is a screen shot of the scenario we are going to mimic in 3D:

Amongus-lobby-snapshot.png

This project implements the following skills from the lectures:

  • toon shading
  • collisions with bounding spheres (when walking around)
  • particle system (when astronauts arrive or leave)

The total score for this project is 100 points. Additionally, you can obtain up to 10 points of extra credit.

This project will be discussed on Wednesday, November 25th.

Ideally, you re-use your scenegraph structure from project 3. But if you are not happy with it you can implement your project without a scenegraph structure.

1. Rendering the Lobby (20 Points)

We provide an OBJ file for the lobby, which includes the obstacles (boxes). Many thanks to Baichuan for converting this from a free online asset!

  • Load the OBJ model and display it on the screen. Adjust its size so that it comfortably fits within your graphics window. (10 points)
  • Map mouse movement to a virtual trackball rotation so that you can rotate the camera about the center of the lobby, with the look at point being the center of the lobby. It is sufficient to allow rotations about the horizontal axis (i.e., to tilt the model up/down), but you can choose to rotate about more than one axis. Also allow the user to zoom in and out. The point of this is to be able to look at the lobby top-down, but also from a more oblique angle, to see the astronauts from different angles. (7 points)
  • Create a point or directional light source to illuminate the lobby using the Phong shading model. You can optionally use toon shading, like you will later for the astronauts. (3 points)

Note that the minimum requirement is to just load the OBJ file. You do not need to load and render the textures for it. This is an option for extra credit.

Below are two pictures of the lobby: without textures (left), with textures (right):

Amongus-lobby-gray.png Amongus-lobby-tex.png

2. Rendering the Astronauts (20 Points)

We provide three versions of the astronaut model (thanks to Baichuan for creating them!): one is the astronaut standing still, the other two are animation frames for the walking animation and are only needed for the extra credit option.

The astronaut files don't come with color. The only difference between the 10 astronauts in the scene is their colors. Here is a table of the 12 options for astronaut colors. They are given as hex values for red, green and blue. Example: 132ED1 means: red is 13 hex = 19 decimal, green is 2E hex = 46 decimal, blue is D1 hex = 209 decimal. These are all in a range from 0 to 255, so to get them into the range of 0 to 1 you need to divide by 255.

Color Black Blue Brown Cyan Dark Green Lime Orange Pink Purple Red White Yellow
RGB 3E474E 132ED1 71491D 39FEDD 13802C 4EEF38 F17D0C EC54BB 6C2FBC C51211 D6DFF1 F6F657
  • Load the OBJ file of the astronaut that is standing still and create a draw function for it Color it in one of the color options above. (10 points)
  • Apply Toon shading: render the astronauts in their respective color, using the toon shading effect discussed in class (silhouette edges and discretized shading). Toon shading is required for the astronauts (optional for the lobby model). (10 points)

Below is a picture of what the astronauts should approximately look like:

Astronauts.png

Notes:

  • While the game labels each astronaut with the player names, you are not going to need to show any labels.
  • The game allows players to choose hats and other clothing. Our version is not going to do that.

Grading:

  • -5 if silhouette edges don't work
  • -5 if discretized shading doesn't work

3. Collision Detection (20 Points)

You only need to populate the lower level of the lobby with astronauts, not the level with the chairs and the computer. They do not need to go up the stairs.

  • Create bounding spheres for all astronauts. (4 points)
  • Create bounding spheres for the obstacles on the lower level of the room (2 boxes). (4 points)
  • Create bounding planes for the walls: 4 axis aligned walls (one of them being the bottom of the stairs), plus the two diagonal walls in the bottom left and right corners. (4 points)
  • Write an algorithm that checks for the collision of two bounding spheres. (4 points)
  • Write an algorithm that checks for the collision of a bounding sphere with the walls. (4 points)

Note that since the astronauts walk around on a plane, it is sufficient for your collision detection algorithm to work in 2D, rather than 3D: your bounding spheres turn into circles, planes turn into lines.

4. Moving the Astronauts (20 Points)

1. Player astronaut: (10 points)

  • Dedicate one of the astronauts to be the one the user controls with the keyboard (cursor keys or WASD keys).
  • Choose one of the 12 astronaut colors for the player astronaut.
  • Use bounding sphere-based collision detection to keep the astronaut from walking into obstacles (boxes), walls or other astronauts. When a collision is about to occur stop the astronaut's movement until the obstacle clears or the user chooses a different direction to go in.

2. Non-player astronauts: (10 points)

  • Non-player astronauts should appear at random points in time and start walking in a randomized direction after a randomized period of time. They should walk along straight lines until they run into a wall, an obstacle (box) or another astronaut.
  • When they collide with something they should bounce off each other like pool billiard balls (angle of incidence = angle of reflection).
  • Occasionally (randomized) they should stop for a randomized amount of time, before they start walking again.
  • Eventually (randomized) they should disappear from the lobby.
  • There can be a maximum of 10 astronauts in the lobby, including player and non-player astronauts.

3. All astronauts:

  • Each astronaut has to have a unique color, i.e., no two astronauts (including the player astronaut) can have the same color.
  • The astronauts always need to face the direction they walk in: this means that you need to rotate the astronaut model about its vertical axis according to the walking direction.
  • The astronauts do not need to be animated (i.e., move their legs when walking). It is sufficient to always render the still standing model. Animation is an option for extra credit.

Grading:

  • -2 points if non-player collision bounces are discretized (eg, only 90 degree angles supported)
  • -2 if astronauts don't face the direction they walk in
  • -2 if astronauts never disappear

5. Particle Effect (20 Points)

In the actual game, the astronauts materialize with an effect that creates a white halo around them, before they show up. We are NOT going to imitate this effect, but instead use a particle effect whenever an astronaut shows up or disappears. We also won't need the astronauts to appear in their respective seats like in the game, but they can show up anywhere in the lobby as long as they don't collide with another astronaut or an obstacle.

Choose particle effects for the astronauts' appearance and disappearance. The effects must be different, but the difference can be minor. For instance, when they appear there might be points starting in the center point of the newly created astronaut's bounding sphere, moving away from that point. When disappearing, similar points might be traveling in the opposite direction. But your imagination is the limit, as long as you have a particle system with at least 100 particles. The particle animations should last about 3 seconds.

Note that the particles have to move independently from each other. A static point cloud is not a particle effect, even if animated by affine transformations.

Grading:

  • -5 if the enter/exit animations are identical
  • -10 if the effect looks somewhat like a particle effect but does not involve independent particles

6. Extra Credit (10 Points)

You can get up to 10 points of extra credit by adding some or all of the features below:

1. Textured lobby: parse the texture coordinates for the lobby file and render it with the proper textures. In this case you should not use toon shading on the lobby model. (3 points)

2. Animated astronauts: load all three astronaut files and switch between a walking animation (by alternating between the two walking models) when the astronaut is walking, and the still model when not. (3 points)

3. Sound effects: Add the following sound effects to your application: (5 points)

  • A sound effect for when players join, and a different one for when they leave the lobby.
  • A sound effect for whenever the player character moves (e.g., footsteps)

The sound effects should not cut each other, in other words, they should be able to play at the same time without forcing one another to pause or restart. We recommend the Irrklang audio API for sound playback.

4. Shadows: use shadow mapping to render the astronauts' shadows on the ground. No other shadows need to be rendered. (5 points)

5. First person view: Allow switching with a keyboard key between the regular third person view and the view from the player astronaut. (3 points)

Submission Instructions

Once you are done with this project, record a video demonstrating all the functionality you have implemented.

The video should be no longer than 5 minutes, and can be substantially shorter.

Ideally, you will talk over the video to explain what you are showing. Alternatively, you can display text for this purpose.

To create the video you don't need to use video editing software, but you should use software to capture your screen to a video file.

  • For Windows users we recommend the free OBS Studio.
  • On Macs you can use Quicktime to record off the screen.

If this does not work for you, you can hold your phone in front of the screen and record with a steady hand.

Upload this video at the Assignment link on Canvas, and comment which functionality you have or have not implemented and what extra credit you have implemented. If you couldn't implement something in its entirety, please state which parts you did implement and hope to get points for.

  • Example 1: I've done the base project with no issues. No extra credit.
  • Example 2: Everything works except an issue with x, I couldn't get y to work properly.
  • Example 3: Sections 1-2 and 4 work.
  • Example 4: The base project is complete and I did z for extra credit.

Finally, zip up your source code (.cpp, .h, executable and shader files, sound files if extra credit was attempted, as well as any .obj files which were not provided to you) and submit the zip file at the Assignment link on Canvas as well.

In addition to Canvas, please also submit your code to Gradescope. You should have received an email with an invite to it.