Homepage Portfolio Information Final Product Metadata Create Shapes Apply Texture Reflection Any Questions?
C++ Assorted Models and Mapping Textures
Student programmer.

Information

    Lighting and Shading -
    vec4 light_position(10.0f, 15.0f, 10.0f, 1.0f); vec3 light_ambient(0.3, 0.3, 0.3);
    vec3 light_color(0.9, 0.9, 0.9); float material_shininess = 50.0f;
    View and Projection Matrices -
    The camera moves around the scene onto the XZ plane at a radius of a 14.0 unit from the origin while maintaining a constant distance of a 4.0 unit along the Y-axis. The camera switches between the top view and front view with the toggle of the keyboard button ‘t’/’T’. The following projection matrix has been used:
    mat4 projection_matrix = perspective(radians(45.0f), 1.0f, 1.0f, 50.0f);

Final Product

Metadata

Create Shapes

    I modeled this assortment of objects: cubes, cones, discs, cylinders, and spheres. I applied different transformations; the number of models on the scene also vary.
    For cones, per-vertex normal has been used before starting the assignment.
    Modeling a cylinder is similar to modeling cones, but a cylinder's top is open and parallel to the bottom. While constructing a smooth cone, for every base vertex, you constructed a triangle. Our professor advised modeling cylinders with the same approach. However, with cylinders, for every base vertex, we will have a parallel top vertex instead of a single tip as found in cones. Each base vertex and the parallel top vertex will construct a rectangular plane with the next base vertex and its parallel top vertex. Use per-vertex normal for modeling a cylinder.
    I establish a relationship between the number of vertices, number of triangles, and number of indices -
    Declare some attribute arrays for vertices, colors, and normal. Once the iteration is over, all vertices, colors, and normals are generated.

Each iteration generates two vertices: top (points[i]) and bottom (points[i + STEP]) and find out triangle one (points[i], points[i + STEP], points[i + 1]), and triangle two (points[i + STEP], points[i + 1], and points[i + 1+ STEP]).

Each iteration established a relationship between consecutive base vertices and find out (p1, p2, and p3) in a particular triangle making a cross product between (p3-p1) and (p2-p1).

Apply Texture

For mapping textures onto objects, at first, find out texture coordinates. Next, use texture coordinates as an additional attribute.

For cones, use per-vertex normal in texture mapping. In a similar way, map textures onto a disc.

Reflection

    This assignment helped create a fundamental knowledge of C++, especially how to create objects from the relationships behind vertices, indices, and triangles. These projects helped me become aware of the mathematics behind the assembly of each object.