CS 5610/6610 - Spring 2016

Homework Assignment 4

Bump-mapping with Shaders (100 points)

 

Expected start date: March 21, 2016

Due: 11:59pm, Friday April 1, 2016

 

This assignment is for bump mapping.  You should use the scene from the first assignment (4 walls, a cube with a sphere on it). Feel free to add other objects if you’d like.

You should have brick walls (you can get brick normal maps from: http://www.tutorialsforblender3d.com/Textures/Bricks-NormalMap/Bricks_Normal_1.html) You can convert images with GIMP or Photoshop to something you can easily read.  *.rgb images are from the SGI days but there are filters for reading/writing these for GIMP and Photoshop.

The scene should include a floor, bump-mapped with a dune pattern (provided directly as a normal map image), and lit only with diffuse lighting. You can inspire yourself from the bump map shader example in the Cg Toolkit or the class notes. Note, the normals in the normal map modify the Nz component, you'll have to swizzle to get it right for the floor (whose normal points in the +y direction). The Cg tutorials will help since all of the code is basically there.  The walls should be bump-mapped and lit with phong shading (specular, diffuse, and ambient) using bricks.  You should add a keyboard or GUI control to switch from phong lighting to toon lighting for the sphere sitting on the cube.  The toon-lighting should have silhouettes, at least two levels of shading for diffuse and at least one for specular.

CS6610 only:

In addition to bump-mapping the floor, the sphere on the cube should be bump mapped and lit with both diffuse and specular lighting  when using  phong lighting , you should include the bricks, floor, and toon lighting as well. Toon lighting should not use the same texture as used for the bump-mapping. Note, most sphere geometry does not compute tangent vectors.  You will have to do this yourself.  You may want to generate vertex arrays yourself rather than precomputing them but this can be done in a shader as well.
Here is a height map for the sphere and the associated color texture. Since the bump map is provided as a grayscale 'height field', you will need to convert it internally to a normal map, where each pixel contains an RGB value corresponding to a (nx, ny, nz) perturbation of the normal. Note that colors range from 0 to 1, while normal perturbations in x and y can range between -1 and 1 (nz will always be positive), so in your fragment program you will have to convert between the 2 ranges. Scale/bias: Adding .5 and multiplying by 2 can be done by the 'input mapping'. You can use the Nvidia bump-to-normal map conversion routines if you’d like.  Note, you’ll have to deal with the appropriate tangent space information for the sphere.  This can be done with either differential geometry or by computing the tangent and bi-normal vectors at each vertex.

CS5610 and 6610:

The scene should include a floor, and a directional light.

 

Extra Credit

CS5610: you can get extra credit by implementing the part required for 6610.

CS5610 and CS6610

Possible ways to get extra credit include generating your own bump maps, or including other effects such as making the sphere reflective (using a bump map and an environment map) or refractive but always controlled by keyboard or GUI buttons  as I need to check the assigned portion of the code.

 

Additional Resources


header for read routine SGI's "RGB" image format
source for read routine of SGI's "RGB" image format
example of how to use the image read routine
NVidia bumpmap to normalmap conversion

Grading

Section                                    Possible Points  

CS5610:         

Documentation                       10

Scene w/objects & floor          10

Brick texture on walls 10

Dune texture on floor 10

Brick bumpmap on walls        15

Dune bumpmap on floor         15

Toon shaded sphere 

silhouette                                 10

specular highlight                    10

diffuse toon shade                  10

Total Points                             100

CS6610

Documentation                       10

Scene w/objects & floor          10

Brick texture on walls 10

Dune texture on floor 10

Brick bumpmap on walls        5

Dune bumpmap on floor         5

Toon shaded sphere 

silhouette                                 10

specular highlight                    10

diffuse toon shade                  10

Bump mapped shaded sphere         

Texture on sphere                    5

Bump mapped sphere 5

correct                                     10

Total Points:                            100