Difference between revisions of "Project3F17"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
Line 1: Line 1:
<!--
+
=Project 3: Robot Army=
 
+
keep sky box
+
 
+
frankenrobot construction kit
+
 
+
android robot: get pieces from yining, use at least one leg
+
 
+
extra credit: add robot editor 10 points, vote for top 5 most creative robots, submit JPG or GIF on Piazza by deadline (instructions will be posted on piazza) post link to GIF converter giphy
+
 
+
=Project 3: Scene Graph=
+
  
In this project you will need to implement a scene graph to render an army of robots.
+
In this project you will need to implement a scene graph to render an army of Android-inspired robots.
 
   
 
   
 
The total score for this project is 100 points. Additionally, you can obtain up to 10 points of extra credit.
 
The total score for this project is 100 points. Additionally, you can obtain up to 10 points of extra credit.
Line 17: Line 7:
 
==1. Sky Box (25 Points)==
 
==1. Sky Box (25 Points)==
  
Start with code that uses your trackball code, and modify it to control the camera instead. (If you didn't get that to work the keyboard controls will suffice.)
+
Start with code that uses your trackball code, and modify it to control the camera instead. (If you didn't get that to work, keyboard controls will suffice.)
  
 
Create a sky box for your scene with the robots. A sky box is a large, square box which is drawn around your entire scene. The inside walls of the box have pictures of a sky and a horizon. Sky boxes are typically cubic, which means that they consist of six square textures for the six sides of a cube. [http://learnopengl.com/#!Advanced-OpenGL/Cubemaps Here] is a great tutorial for sky boxes in modern OpenGL.
 
Create a sky box for your scene with the robots. A sky box is a large, square box which is drawn around your entire scene. The inside walls of the box have pictures of a sky and a horizon. Sky boxes are typically cubic, which means that they consist of six square textures for the six sides of a cube. [http://learnopengl.com/#!Advanced-OpenGL/Cubemaps Here] is a great tutorial for sky boxes in modern OpenGL.
Line 23: Line 13:
 
[http://www.f-lohmueller.de/pov_tut/skyboxer/skyboxer_3.htm Here is is a nice collection of textures for sky boxes], and [http://www.custommapmakers.org/skyboxes.php here is an even bigger one].  
 
[http://www.f-lohmueller.de/pov_tut/skyboxer/skyboxer_3.htm Here is is a nice collection of textures for sky boxes], and [http://www.custommapmakers.org/skyboxes.php here is an even bigger one].  
  
Draw a cubic sky box and make it extremely big.
+
Draw a cubic sky box and make it extremely big. For instance, by giving it coordinates like -1000 and +1000.
  
 
Make sure single-sided rendering (triangle culling) is enabled with these lines somewhere in your code to ensure that you will never see the outside of the box (this assumes that your sky box is defined with the triangles facing inward):
 
Make sure single-sided rendering (triangle culling) is enabled with these lines somewhere in your code to ensure that you will never see the outside of the box (this assumes that your sky box is defined with the triangles facing inward):
Line 75: Line 65:
 
* <tt>Cube</tt> should have a draw function which draws a cube. You can extend the Cube arrays given in project 2, or use your own implementation of a cube. (3 points)
 
* <tt>Cube</tt> should have a draw function which draws a cube. You can extend the Cube arrays given in project 2, or use your own implementation of a cube. (3 points)
  
 +
<!--
 
==3. Walking Robot (25 Points)==
 
==3. Walking Robot (25 Points)==
 +
 +
android robot: get pieces from yining, use at least one leg
 +
Your robot needs to have at least three moving parts that are connected to the robot's torso and are moving independently from one another.
 +
 +
  
 
Now we are going to finish our robot's geometry. First get your rendering engine ready to recursively traverse the scene graph for rendering by creating a root node of type Group and calling its draw() function with the identity matrix as its parameter.
 
Now we are going to finish our robot's geometry. First get your rendering engine ready to recursively traverse the scene graph for rendering by creating a root node of type Group and calling its draw() function with the identity matrix as its parameter.
Line 118: Line 114:
  
 
b) Modify your spot light shader to work with textures, so that you can see the flashlight's light spot properly illuminating the sky box. (3 points)
 
b) Modify your spot light shader to work with textures, so that you can see the flashlight's light spot properly illuminating the sky box. (3 points)
 +
 +
extra credit: add robot editor 10 points, vote for top 5 most creative robots, submit JPG or GIF on Piazza by deadline (instructions will be posted on piazza) post link to GIF converter giphy
 +
  
 
-->
 
-->

Revision as of 21:29, 27 October 2017

Project 3: Robot Army

In this project you will need to implement a scene graph to render an army of Android-inspired robots.

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

1. Sky Box (25 Points)

Start with code that uses your trackball code, and modify it to control the camera instead. (If you didn't get that to work, keyboard controls will suffice.)

Create a sky box for your scene with the robots. A sky box is a large, square box which is drawn around your entire scene. The inside walls of the box have pictures of a sky and a horizon. Sky boxes are typically cubic, which means that they consist of six square textures for the six sides of a cube. Here is a great tutorial for sky boxes in modern OpenGL.

Here is is a nice collection of textures for sky boxes, and here is an even bigger one.

Draw a cubic sky box and make it extremely big. For instance, by giving it coordinates like -1000 and +1000.

Make sure single-sided rendering (triangle culling) is enabled with these lines somewhere in your code to ensure that you will never see the outside of the box (this assumes that your sky box is defined with the triangles facing inward):

glEnable(GL_CULL_FACE); 
glCullFace(GL_BACK); 

Use the following settings for your texture after your first glBindTexture(GL_TEXTURE_CUBE_MAP, id) for correct lighting and filtering settings:

  // Make sure no bytes are padded:
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

  // Select GL_MODULATE to mix texture with polygon color for shading:
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

  // Use bilinear interpolation:
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

  // Use clamp to edge to hide skybox edges:
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

To familiarize yourself with texture mapping in OpenGL, we provide sample code, which loads a PPM file and uses it as a texture for a quad. If you decide to use one of the above referenced sky box images, you will have to convert them from JPEG to PPM format. The free image processing tool IrfanView for Windows will do this for you. Alternatively, you can use a third party library such as SOIL to natively load JPEG images.

Grading:

  • 5 points for functional camera controls with keyboard or mouse
  • 5 points for the sky box without textures
  • 5 points for the textures
  • 5 points for correct rendering of edges and corners (seamless edges)
  • 5 points for correct culling of the skybox

2. Scene Graph Engine (20 Points)

To create the parts of the robot (torso, arms, legs), we need to first implement a scene graph structure for our rendering engine. Use the following hierarchy:

Project4F14-scenegraph-half.jpg

The classes should have at least the following functionality:

  • Class Node should be abstract and serve as the common base class. It should implement an abstract draw method: virtual void draw(Matrix4 C) = 0, and also an abstract virtual void update() = 0 method to separate bounding sphere updates from rendering. (3 points)
  • Group should store a list of pointers to child nodes (std::list<Node*>) and provide functionality to add and remove child nodes (addChild(), removeChild()). Its draw method needs to traverse the list of children and call each child node's draw function. (3 points)
  • Geode should be an abstract class. It should set the modelview matrix to the current C matrix, and have an abstract render function to render its geometry. (3 points)
  • MatrixTransform should store a 4x4 transformation matrix M which is multiplied with matrix C, which is passed to the draw method. (3 points)
  • Sphere should have a draw function which draws a sphere. You need to write your own tessellation algorithm to render a sphere. (5 points)
  • Cube should have a draw function which draws a cube. You can extend the Cube arrays given in project 2, or use your own implementation of a cube. (3 points)