Tuesday, 16 April 2019

How Shenmue creates reflections

Mirrors play an important role in Shenmue and not just the mysterious stone kind.


How do the reflective glass surfaces work in the enviroments of Shenmue and Shenmue II?

I don't think anyone needs an explanation as to why the Phoenix Mirror and Dragon Mirror are very important to the Shenmue saga but I like to refresh your memories on the other kind of mirrors.

That of course means the wall hung glass mirrors at Russiya China Shop and in the Hazuki Basement. They do take a significant part in the quest to find the Phoenix mirror, giving you a little hint and in the case of the former, a hugely important piece of the story.

What could the talisman mean?

With them being featured so prominently during cutscenes, the designers of Shenmue took extra care to make the mirror image as clear and clean as possible and they did so with a simple trick.

Most if not all games today use a technique called render-to-texture (RTT) when something moving in front of a mirror is to be reflected in real time. This approach calculates the geometry of what is standing in front of the mirror surface and converts it to a flat texture.

Back in 1999, this technique was still in it's infancy wich made it hardware taxing and the resulting image was often very pixelated. In Shenmue the illusion was not to be broken by a mirror like this and the developers resorted to a nifty trick.

Behind the mirror, there is actually an exact 3D copy of the room and the characters in it, just that the models are mirrored. The mirror is basically just a hole in the wall to the other half of the room.
To make it more believable there is a transparent texture where the hole is, giving a slight haze to it.
 
Shenmue didn't invent this trick, this was actually somewhat common berfore RTT really took off but it is still implemented very well and left some people scratching their heads how Shenmue got its mirrors so perfect and crisp.

By hacking the game to remove the clipping it is very much possible to just walk through the mirror and explore the "alternate dimension" on the other side. If you like to see this in more detail, I have videos on my channel showing this in various places.

      

In Shenmue II this concept of mirroring the enviroment was taken to the next level with top floor of the Yellow Head Building, there named the Big Ox Building. The stone floor there is polished up so nicely that it is highly reflective. And by placing an upside down copy of the rooms under the rooms and carefully making the floor textures just the right amount of transparent, the illusion is again very much perfect.

Fill my eyes with that double vision
Just one of the many brilliant tricks that the developers have pulled off to make the world of Shenmue be what it is. Hopefully this little insight did not ruin the magic too much for you and was instead just an interesting look under the hood.

No comments:

Post a Comment