CS513 Assignment 3: Bumpmapping

by Muhammad Karim

General Configurations:
   # Development Platform: Visual C++ 2008, Debug+Release build
   # Used OpenFrameworks library
   # Graphics Hardware: ATI Mobility Radeon HD 3470 (OpenGL 2.1)
Deliverable Notes:
   Used OpenGL extension: GL_EXT_framebuffer_object for creating depth map.
   Used OpenGL extension: GL_ARB_texture_float for writing floats in FBO bound textures.
   Used nVidia cg as the shading language.
   Used tangent/binormal map with Resolution: 1024x1024.
  

  1. Bumpmapping Results:

    Screen-shot 1: Frank with Phong shading using obj model's vertex normals



    Screen-shot 2: Frank with the normal map computed from the Tangents and Bitangents from 2 texture samplers



    Screen-shot 3: Frank with the computed bumpmap in texture space (debug rects showing baked tan/bitan/verts)



    Screen-shot 4: Frank with the final bumpmap (with some seam corrections)



    Screen-shot 5: Seam correction before (left) and after (right)



    Source Code:

    Project (contains Win32 executable)

    Shaders are located in "/bin/shaders/"


    Project with OpenFrameworks codes (required for compilation)
  2. Discussion:

    1. Extended my FBO class to handle floating point textures using the extension GL_ARB_texture_float and to handle Multiple Render Targets (MRT), each bound with a texture.
    2. Wrote a shader to bake an objects vertex positions in a texture map.
    3. Wrote a shader that takes that baked vertex texture and computes a) a tangent map, b) bitangent map.
    4. Finally wrote a shader that takes eye/light/transformation parameters and the tangent+bitangent maps. Then it transforms all phong shading parameters (light direction, eye direction) into the texture space defined by the basis matrix created with the Tangent/BiTangent/Normal. The final shading is computed using these texture space dot product functions.
    5. Tangent frame was calculated by: (once in x-axis another in y-axis)
      1. Looking up a point in the forward direction from the reference point,
      2. Looking up a point in the backward direction from the reference point.
      3. Computing the difference in height of the vertex (z-coord) and normalizing it by the distance of the 2 sampled points.
      4. Finally, T = <1, 0, dx>, B = <0, 1, dy> and normalize them.
    6. Problem: discontinuety in the seams were resolved to a great extent by simply looking up the texture from the reference point instead of looking forward or backward (if the tex2D function returns a Black pixel).
    7. Shadows work as before for the surfaces having the shadowing shader.