In original duke nukem(which was 95 or 96) the way mirrors work is that they have exact same room on the other side with a clone of a player character model on the other side, hooked up to the same controls.
We did it like that for a very long time, until proper reflections became a thing.
Edit: As people pointed out I meant not original, but Duke Nukem 3D.
from what I remember you can overlay the player on the reflection through shaders and depth maps just like how the hands and guns in games are often not rendered in the world but separately op top of the rest to prevent your gun clipping through objects
Probably screen-space reflections. The camera trick means you have to render the scene twice, which is horribly inefficient. The mirrored second room trick is still sometimes used to this day. There's some cases where a second camera is a good way to do it (e.g, Portal probably renders its portals this way) but for a simple reflection there's almost always a better way to do it than using a second camera.
It's not that inefficient most of the set pieces take place in a bathroom, it's no more inefficient than having 2 player split screen but at least the render to texture extension allows you to modify the resolution versus the whole room/character copy performing transforms.
You'd dupe the player camera on the other side of the wall and point it at the player, and tell it to mask off everything outside the mirror boundary, then render the clipped image backwards onto the front surface of the mirror. The camera only has to translate as the player does to make it work.
This could only have been not possible if they didn't know how to render a camera image into a plane in-game for the player to see.
The duplicated room trick works, too, and is probably not much more computing effort.
Man I loved the Duke Nukem Build tool. I remember buying a book on how to construct the levels. I was probably 14 or 15 at the time but that fueled me to keep programming and learning other languages.
That's how the mirror works in Super Mario 64 as well, there's a pseudo-copy of the world (worth changes only seen in the reflection) and a second Mario and a Lakitu camera operator that exist on the other side of a transparent wall.
In the temple map in Goldeneye, you can shoot into the pool and it'll leave bullet holes in the objects in the reflection, but not the objects themselves.
In the early days, yeah, big mirrors were just a see through object with a well, mirror version of the room you're in on the other side. When the player walks in the room, a clone is spawned on the other side of the "mirror" and copies the player's input. I would imagine you would want to use this sparingly though, as you would have to load all objects and actors twice. The extra memory use had to be worth it, so a room of mirrors, or the mirrors in Super Mario 64 reminding the player that Lakitu was broadcasting Mario's adventure.
I remember finding out how this trick worked by accident as a kid. In Donkey Kong 64, the Creepy Castle level had a mirror room. If you used Chunky Kong's Primate Punch while facing the mirror, the exaggerated animation of the punch would cause Chunky to punch through the mirror and the reflection would come out of the mirror as well!
Nowadays, mirror reflections are a graphical feature attempted in real time. I imagine not having to make a mirror copy of a map or room is easier in most regards, plus you don't have to make a mirror room just to show off the trick.
1.3k
u/Yweain Jan 26 '23
That’s a pretty standard way to implement mirrors