"Damn! I'm looking good!"
Many people have wondered why so few games feature functional mirrors. It was first seen back in 1996 when Duke Nukem 3D
let the players watch themselves in awe as they jumped up and down in front of a mirror, while they pressed space to have Duke Nukem
say "Damn! I'm looking good!"
The reason functional mirrors appear in Duke Nukem 3D, and not in many modern games, is because of the way the Build Engine
(the engine running Duke Nukem 3D) handles the drawing of the game-world. The Build Engine is a so-called "ray-caster" engine (much like the engines running Wolfenstein 3D
) which produces "pseudo 3D", or sometimes called " 2.5D
To keep it short, a ray-caster engine functions by "shooting" rays from the game's viewport into a level's geometry. When the ray intersects with with a wall, it traces the distance the the wall and thereby deciding the size of the texture which needs to be shown on the screen. A mirror in the Build Engine
, is just a wall flagged as a mirror, which sends incoming "rays" back in a new direction and thereby hitting a new wall. The total distance (length from viewport-to-mirror plus length from mirror-to-wall)
is calculated and the corresponding texture is shown on the screen, thus creating the illusion of a mirror.
- Build Engine Fun Fact: If a player encounters two walls opposite of each other both marked as mirrors, the game will never finish calculating the final distance, since the mirrors keeps sending the rays back and forth. The result: The game freezes.
"Real" 3D engines (also known as rasterizers) such as id Tech 2
, Unreal Engine
etc. draws their images in an entirely different way, which makes it impossible to use the rather simple Build Engine method. In most
cases, a mirror in a 3D engine (like in Max Payne 2
or Condemned: Criminal Origins
) is a smaller secondary viewport projected onto geometry as a texture. This is the same method used for creating the real-time image-in-image effects as seen in e.g. Half-Life 2
and Batman: Arkham Asylum
, and taken to the extremes in Portal
, where the projected viewpoint is a literal connection to the depicted area that the player is able to walk through. The additional viewports are often kept in a small resolution to increase performance, which is why they often are blurry or very small.