dhpoware logo
home products source demos contact us
navbar navbar
box top left corner box top right corner
OpenGL 3 Parallax Normal Mapping Demo.

This Windows application demonstrates how to implement parallax normal mapping for a single directional light source using OpenGL 3 or a forward compatible OpenGL 3.0 rendering context. The shaders can be extended to support multiple directional light sources.

Parallax mapping is a method for approximating the correct appearance of uneven surfaces by modifying the texture coordinate for each pixel. Normal mapping is commonly used to provide surfaces with very detailed shading without requiring additional geometry to be added to the polygonal model. However such normal mapped surfaces often still appear flat. Parallax mapping corrects this by providing the illusion of depth to such surfaces. Parallax mapping is commonly used in conjunction with normal mapping because parallax mapping is a relatively inexpensive means to enhance the normal mapping effect.

The original idea for parallax mapping came from a paper by Tomomichi Kaneko et al (2001) titled "Detailed Shape Representation with Parallax Mapping". Later Terry Welsh (2004) introduced an offset limiting term to the original parallax mapping technique in his paper titled "Parallax Mapping with Offset Limiting: A Per Pixel Approximation of Uneven Surfaces".

There is a single fixed directional light source shining down the world negative Z axis towards the cube in the scene.

Left click and drag with the mouse to rotate the cube.
Press the SPACE BAR to enable and disable the diffuse color map texture.
Press ALT and ENTER to toggle between windowed mode and full screen mode.

1. This is an OpenGL 3 demo. This demo will not run on OpenGL 2.x and OpenGL 1.x hardware.
2. This demo requires the Visual C++ 2010 Library Runtimes. Download instructions can be found here.

screen shot

zip file Download executable, source, and Visual C++ 2010 solution files.

Change History:

29 February 2012.
Updated to use the latest version of the OpenGL 3 Framework.

main.cpp: Major rewrite to use the Texture2D and Shader classes. The previous version of the demo that used raw calls the OpenGL texture and shader APIs is available upon request.

10 July 2010.
Added missing .vcxproj.filters file to the project.

13 June 2010.
Updated solution to Microsoft Visual Studio 2010.

box bottom left corner content box box bottom right corner
logo logo