Parallax Mapping

I first wrote this in C++ some time either early in my masters' school or late in my undergraduate. I wrote it up as a demo for a presentation that our weekly paper reading group was doing. I got the topic of parallax mapping, so I figured I would code up a demo with it.

The original C++ version comes with code to construct and store a basis at each vertex, as is done with traditional dot3 bump-mapping on 3D models. I just hacked in a sphere, but the basis calculation code is flexible enough that you can feel free to add in whatever other loaders and models as you see fit. The Lua version didn't quite have flexibility enough built into it to perform such precalculations on models (without doing the whole operation in Lua, which would've taken more coding and more time). I believe I even used a lot of the original C++ version when creating the GL Lua Shell. You can see a lot of code design similarities between the two.

The shader supports bump mapping, single-step parallax mapping, iterative parallax mapping, iterative shadow traces, and offset limiting for both the view and light vectors. Most of these are provided as flags that you can turn on or off during runtime. The C++ version supports interpolation with the iterative parallax mapping.

The Windows version of the C++ one supports drag-and-drop image loading on the colormap and bumpmap files. I believe I maintained this feature in the GL Lua Shell when reconstructing it from the parallax mapping demo.

I went to the Steep Parallax Mapping page for a lot of help. I didn't achieve results anywhere as close to theirs though. I also looked at Interactive Horizon Mapping, though if I remember correctly it required a precaching step, some extra lookups, and once again provided much better results.

This was one of the first programming projects I ported to my Mac. It was also one of the first I ported over to use the GL Lua Shell. Ironic considering it's taken me so long to give it a page of its own.

Download the GL Lua Shell Script Here
Download the C++ Source Code Here
Download the C++ Mac OS X Binary Here
Download the C++ Windows Binary Here
Source Code Dependencies OpenGL Lua Shell , Core Libraries v.2