Difference between revisions of "Project3F18"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
Line 76: Line 76:
 
Now that we have the scene graph classes, it is time to put them to work, and build a robot with them.  
 
Now that we have the scene graph classes, it is time to put them to work, and build a robot with them.  
  
Thanks to our tutor Weichen and former tutor Yining, you have the following robot parts to choose from: head, body, limb, eye, antenna. You will find the OBJ files in [[Media:Robot-parts-2018.zip |this ZIP file]]. Each vertex has not only a 3D coordinate and a normal associated with it, but also a texture coordinate. This allows you to map textures to the surfaces of the robot.
+
Thanks to our tutor Weichen and former tutor Yining, you have the following robot parts to choose from: head, body, limb, eye, antenna. You will find the OBJ files in [[Media:Robot-parts-2018.zip |this ZIP file]]. Each vertex has not only a 3D coordinate and a normal associated with it, but also a texture coordinate. This allows you to map textures to the surfaces of the robot. Note that unlike the previous obj files in the course, each face has different indices for v/vt/vn. So you are going to need to update your parser accordingly, when you add texture support. One of ways to deal with the different indices is to re-order (and duplicate) the v/vt/vn data when parsing so that their indices align. The following code fragment from "OpenGLInsights" might be useful:
 +
 
 +
<pre>
 +
// For each triangle
 +
for( unsigned int v=0; v<vertexIndices.size(); v+=3 )
 +
{
 +
    // For each vertex of the triangle
 +
    for ( unsigned int i=0; i<3; i+=1 )
 +
    {
 +
        unsigned int vertexIndex = vertexIndices[v+i];
 +
        glm::vec3 vertex = temp_vertices[ vertexIndex-1 ];
 +
       
 +
        unsigned int uvIndex = uvIndices[v+i];
 +
        glm::vec2 uv = temp_uvs[ uvIndex-1 ];
 +
 
 +
        unsigned int normalIndex = normalIndices[v+i];
 +
        glm::vec3 normal = temp_normals[ normalIndex-1 ];
 +
 
 +
        out_vertices.push_back(vertex);
 +
        out_uvs.push_back(uv);
 +
        out_normals.push_back(normal);
 +
    }
 +
}
 +
</pre>
  
 
Build your own robot using the <tt>addChild</tt> methods. Use at least 3 different types of parts for your robot (e.g., body, head and limb). In total, your robot needs to consist of at least 4 parts, 3 of which need to be moving independently from one another and they need to be connected to the 4th part. (15 points)
 
Build your own robot using the <tt>addChild</tt> methods. Use at least 3 different types of parts for your robot (e.g., body, head and limb). In total, your robot needs to consist of at least 4 parts, 3 of which need to be moving independently from one another and they need to be connected to the 4th part. (15 points)

Revision as of 15:02, 20 October 2018

Project 3: Textures, Scene Graphs and Culling

To be posted Oct 20.