this post was submitted on
377 points (87% like it)
439 up votes 62 down votes

HIFW

unsubscribe14,273 readers

~13 users here now

One place for all the pics and gifs that beg the caption "How I feel when..."

Reposts are welcome, so don't complain. Enjoy the various captions, expect the reposted gifs.

Please tag everything like this "[HIFW] Title..."

Use Imgur

created by hotcarl7379a community for

reddit is a source for what's new and popular online. vote on links that you like or dislike and help decide what's popular, or submit your own! learn more ›

all 28 comments

[–]ramwilliford 31 points32 points ago

Why don't they?

[–]Contero[S] 83 points84 points ago

They do. Portal is a great example. It's not exactly a mirror, but it represents the exact same problem: You're creating a viewport that looks back into the scene, potentially at other viewports which do the same thing.

One of the biggest problems is: Imagine two mirrors facing each other in a room, or two portals facing each other. It creates one long hallway. Portal manages to handle "mirrors looking at mirrors" problem quite elegantly: They render each mirror viewport over and over again down to a depth of 7, and then they put a "good enough" texture on the last one. This ends up looking quite nice since the 8th mirror/portal will usually take up a small part of your screen and you won't be able to tell the difference.

The real question is, why don't most games do this? The answer is some combination of the lack of: time, budget, developers, experience, and bang for buck. In portal it's extremely important to get the mirror effect to look good because you'll be looking at it the whole game. For other games you might run into one or two mirrors ever, so it's not worth it to spend time and effort to get that part of the game to look good when you're already running behind in other areas.

The smart thing would just be to not have mirrors, or to have them be broken/dirty so that you can't see your reflection. With small shards of glass or dirty glass (that you couldn't see your reflection in) you can "fake it" using a simple, pre-baked cubemap effect.

[–]betaknight94 3 points4 points ago

I'm working to become a game designer and you sir made my day.

[–]mr1337 2 points3 points ago

What about making an identical room on the other side of the "mirror" (actually more like a window at this point) and render the player in that space as reverse of the "real" room?

[–]iambeard 5 points6 points ago

That's a fairly bad idea, and I have no idea why any level designer or programmer would do that. To explain what Contero suggested a little more, with most modern 3d backends (Direct3d and OpenGL), you have two options for rendering - render to the screen (your monitor), or render to a texture (an in-memory 2d surface). There is also the concept of a camera, which has a position, and also a direction that it's looking, and what this camera sees can either be rendered to the screen or texture.

Contero is saying that the game would need at least two "cameras", one for the player (that's how you can see where you are), and one for the mirror. The player camera renders to the screen, using the position and facing-direction of the player. The simple version of the mirror would have it's own camera, and it is always facing the same direction of the player, BUT it would have to have the opposite "up" angle (to match the behaviour of a real mirror). The mirror's camera would then render to a texture, and that texture would then become the image used for the surface of the mirror.

This isn't actually terribly difficult to do, but as stated, there are many factors as to why a mirror is and isn't used. Some of it is processing power, but the bulk of it is whether or not the developers have the time or experience.

I hope that explains things a little better.

[–]coastercrazy10 -2 points-1 points ago

If a developer does choose to use a mirror, then I believe they do that. However, understand that hardware is limited, so rendering the same scene twice can be demanding, especially in a complex one. Also, keep in mind that simply rendering something twice doesn't really solve the multi-mirror problem, as it doesn't necessarily take into account both reflections. As OP says, it would be ideal if there were no mirrors, or if a mirror is a necessity, then only use one. But should such an occasion where multiple mirrors in view of each other are necessary, other considerations must be made. Portal is built around that concept so I'm sure it utilizes some sort of optimization so that the same exact scene isn't rendered multiple times/renders are stacked or ordered somehow, but for most games this would be entirely too much work to be worth it.

[–]superthrowaway1120 1 point2 points ago

This is called a Stencil Buffer. You rerender the room in reverse, then make a "window" to the reversed room where the mirror is. It works really well for single, large mirrors, and is probably the technique they used in games like the older Silent Hills. The catch is you need to render everything twice, and it doesn't handle reflecting other mirrors well. Certain other effects don't reflect either, such as the light coming from Heather's flashlight in the first video I put up there.

Sources: Took a college class in computer graphics, got an A

[–]jonathanrdt 1 point2 points ago

Because developers are vampires and do not understand their workings.

Edit: For the record, this is a great explanation.

[–]Dead_Rooster 7 points8 points ago

I distinctly remember a working mirror in Duke Nukem 3d which came out in 1996. So surely they do work?

[–]withmorten 0 points1 point ago

Read this!

[–]BlueThundah 2 points3 points ago

Raycasting dude. Shit wasn't even in actual 3d the whole time. Crazy stuff.

[–]chewp911 0 points1 point ago

Sleeping Dogs has well working mirrors as well.

[–]snakepants 0 points1 point ago

You and me both man. I've basically stopped commenting on stuff like this. Too frustrating reading the posts where people go full retard.

I think this is like our little version of when doctors see super-inaccurate stuff in TV shows and are all jhkhfsdfskjhsfsjkhfskh. If you wanna rage go read game tweaking forums about how to "optimize" your game.

[–]Dohr 0 points1 point ago

Postal 2 had mirrors

[–]bigguss 0 points1 point ago

AvP from the 90s had a mirror. that game is sweet.

[–]on0bi -3 points-2 points ago

DX11 supports reflective surfacing, why can't they make a decent mirror?

for the haters that don't know anything:

http://www.youtube.com/watch?v=gbjW57zlVfc

[–]snakepants 2 points3 points ago

That demo is cool (download here) but it's not real reflection. It's similar to the old rthdribl demo in that it's mostly a HDR cubemap demo. It has some nice DOF and gem refraction-from-cubemap effects for sure, but there aren't any true mirrors here beyond a single XZ-plane mirroring effect, which is kind of trivial being a single plane and all.

[–]iambeard 1 point2 points ago

Now, I could be wrong, as I don't really deal with DirectX, but from my understanding, the reflective surfaces only deal with reflecting light sources, and not textures and polygons. I could be wrong, though.

[–]bakerie -1 points0 points ago

Is such bullshit. Duke Nukem Forever is fucking full of mirrors.

[–]BlueThundah -3 points-2 points ago

Proving that mirrors do not make a game great. At all.

[–]bakerie 0 points1 point ago

Proving that a game that was full of bugs and released unfinished could have fantastic mirrors. Even smashed ones that still worked.

[–]BlueThundah -1 points0 points ago

Maybe they should've focused developmental assets on making the game good.

[–]jamaces -3 points-2 points ago

false. duke nukem was already terrible.