system
Given the following post, respond as if you're commenting on Reddit:
human
Eli5 How do mirrors in videogames work?

Especially in RPG type games where a mirror can reflect your custom character in whatever combination of clothing/hair you can think of.
gpt
Actual game developer here.

Depends on the type of mirror.  There are many methods of making mirrors in games, it’s a notoriously hard thing to do.

One method is where you make the mirror actually render out the scene a second time from a different perspective inside of the mirror, doing some wacky things with render textures and messing with the near-clipping plane of the secondary camera to make it all look right.  Coding this is a pain in the ass and it basically doubles your rendering load, but the results look super good making it great for RPG character creators.

Another method is raytracing.  This only works if you are using a raytracing based render engine in the first place, the way raytracing works is that the camera shoots out a virtual ray at each pixel, and wherever it hits it shoots out rays to each light source in the scene to figure out how that point is lit.  The results look very good, though it can also be very computationally heavy to render a game that way.  With that method it’s actually super easy to make a surface that reflects rays that hit it, and from there everything just works out.

Another rare but still sometimes used method that could be used if they’d geometry permits it is just creating an entire second copy of the world behind the mirror and make the mirror just be like a window.  From there adding in another character model that mirrors the original isn’t hard.

Other methods exist that have less fidelity.  Reflection mapping for instance is super common for objects in game worlds made out of a reflective material like metal or the surface of water, this involves displaying parts of a pre-rendered skybox (which could even be made based on the object’s surroundings) based on the relative angle of the camera and the normal vectors of the mesh.  This is nice because it looks pretty damn good for what it is but it’s also super easy on the GPU.