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.
  
-
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)
-
Discussion:
-
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.
Wrote a shader to bake an objects vertex positions in a texture map.
-
Wrote a shader that takes that baked vertex texture and computes a) a tangent map, b) bitangent map.
-
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.
-
Tangent frame was calculated by: (once in x-axis another in y-axis)
-
Looking up a point in the forward direction from the reference point,
-
Looking up a point in the backward direction from the reference point.
-
Computing the difference in height of the vertex (z-coord) and normalizing it by the distance of the 2 sampled points.
-
Finally, T = <1, 0, dx>, B = <0, 1, dy> and normalize them.
-
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).
-
Shadows work as before for the surfaces having the shadowing shader.