Normal Mapped Pyramid

Alex Haag

Cpe471 Spring 2012
 
 

 

 

 

 

 

 


Introduction

The goal of this project was to implement normal mapping on a simple object; in this case a cube, in order to give it a much greater level of detail, and then used that to create a scene.

Design

Normal Mapping:

Normal mapping is the technique of taking a texture map, and applying it to the objects normal vector, instead of the surface color. A map like the one above is used, Where the color is representitive of the surfaces normal vector, using RGB values for the XYZ coordinates of the normal. This is then multiplied by the normal vector of the cube, and applied to the lighting model as normal, in the fragment shader.

The result is an object with a very simple geometry, such as a cube, having a much more detailed, lighting accurate surface. As you can see in Picture 2, the outlines of the bricks are visible and distinct in different lighting levels from the overal face. This is a very easy way to get high levels of surface detail, for very little cost, since the model/mesh can remain reletively simple.

The pyramid itself is generated by creating an array of modeling transformations, and procedurally generating the coordinates for the blocks to be placed, based on the desired height of the pyramid. The current implemetation supports a pyramid 9 blocks tall, which contains 969 individual blocks, which is shown in Picture 1.

Controls

WASD - Straffe and zoom.

Mouse - Controls 1st person camera when clicked.

m - Change model from pyramid, inverted pyramid, arch.

, . - Cycle the number of layers/size of the pyramid.

9 - Cycle the grounds texture.

0 - Cycle the pyramids texture.

- - Toggle texture type between matte and shiny.

= - Toggle between displaying final texture and normal map.

IJKL - Controls the X and Z position of the light source.

q - Exit program.

Additional Screenshots

[Screenshot 1] [Screenshot 2] [Screenshot 3] [Screenshot 4][Screenshot 5]

Resources

OpenGL man pages

Normal Mapping information

 

 

Picture 1

Picture 2