COL781/COL7681 Assignment 2

Due: Feb 16, 11pm. To be turned in on Moodle New.

Basic Model Rendering

This assignment is based on OpenGL and has several parts.
  1. Write an OpenGL (Core 4.1) based renderer for Wavefront obj files. Use Assimp to load Obj model.

    Be sure to use vertex arrays and element arrays as geometry, handle textures, and illum = 2, i.e., Blinn-Phong illumination model (inclusive of diffuse and ambient terms). In addition, implement the following modifications to the MTL file format.

    illum 5 # corresponds to Cook Torrance illumination model with Beckman's distribution function
    rough <%f> # corresponds to roughness term, given as a real number, in the Beckman's distribution function

    Use Schlick's approximation for the Fresnel factor, with F0 given by the dielectric approximation. (Use the provided Ni as the refractive index.)

    Make sure that the camera is initially looking directly at the centre of the model.

  2. Read a directional light from a file named "lights" having the following format, with one light per line:
    Sp X Y Z R G B

    Sp is 0 (i.e., light is specified in the camera coordinate system) or 1 (light is specified in the world coordinate system) The remaining six items are real numbers. <X, Y, Z> is the direction of the light in the listed space (do not forget to normalize it), and <R, G, B> is its color (spectral radiance). The world space is given by the coordinate system of the first read Obj file.

  3. Create a mouse based viewing user interface, which allows the camera to be rotated about the center of the models (use trackball UI) and moved forward or backward (along its Z axis) when used with SHIFT.

  4. Read multiple Obj files, with an editing user interface to align them. Use key 't' to toggle between the viewing and editing UIs. In editing mode, use mouse-based interaction to transform (rotate, translate, and scale) the object nearest to the mouse's cursor on screen.
Extra Credit Add a 'constraint' feature in the editing UI: Select any plane or line in one of the models, and then Resources: Use GLFW for window operations, glad for OpenGL functions, glm for matrix operations, Assimp for Obj model loading functions, and stb_image for image IO.

Sample model files


** Revised: Mon, 26 Jan 2025 by Subodh Kumar

-- The URL of this page is: http://www.cse.iitd.ac.in/~subodh/courses/CSL781/a2_opengl.html --