Interior Mapping meets Escher

One cube, six interiors

My Inspiration

My program was inspired by a piece of M.C. Escher's artwork, “Other World” (seen below).  In this artwork, the viewer looks from the inside of a cube and sees five walls, and each pair of walls shows a different view angle of the moon's surface.  In my program, I have reproduced the effect of that painting, inverted: using interior mapping, I have given each face of the cube a different interior, occupying the same virtual space.
Escher painting, "Other World"
"Other World", by M.C. Escher

Screenshots

left side front side right side back side
top view bottom view corner view

Program Logic

C++ 

The first piece of logic is in my C++ program: it loads all six cube maps (one “interior” cube map for each exterior face of the cube). It then draws the 6 faces of the cube, binding the cube maps in place. The C++ program is also responsible for feeding the world position into the shader as a texture coordinate.

Shader

My shader implements the following techniques:

Resources

Interior Mapping

http://interiormapping.oogst3d.net/

I had previously seen an interior mapping demo created by “Joost 'Oogst' van Dongen”; this demo provided the base shader code.  I fed the provided shader code through the NVIDIA CG compiler to obtain GLSL code, and then revised from there.

Textures

http://humus.name/index.php?page=Textures – Cube Map Textures

http://www.humus.name/index.php?page=3D&ID=80 – Interior Mapping Demo

I obtained my cubemap textures from Emil Persson (“Humus”) -- more specifically, I used the following named cubemaps (note that the camera starts out looking at the "left" side):

Right:   "MarriottMadisonWest"
Left:    "Interior" (from InteriorMapping demo)
Front:   "DallasW"
Back:    "Skansen2"
Top:     Walls are the window texture; top and bottom are from the open-source game Nexuiz.
Bottom:  "Earth"; exterior bottom is from Nexuiz.

Challenges

Some of the most challenging aspects of this program were as follows:

Demo and Code Assumptions

I have archived the demo (compiled for Linux) here: dgoyette_interiormapping_demo.tar.bz2

My demo assumes the following:

Other Notes:

If I really wanted to confuse the viewer, I could have made each of the rooms have a different definition of "up"... but I decided that that would be a bit too evil.

In addition to the Escher painint, I was also inspired by a level from the old game Duke Nukem 3D, "Tier Drops" [youtube.com], that used the game engine design to awesome effect:   Picture a spiral staircase with four central landings (also connected via vertical tubes)... and then flatten it so that all four center areas occupy the same physical space.  This was the effect I was trying to create in my program.