We will entertain your mind, enhance your brain, expand your lifestyle.

Implementation of th Mirror

Iridescent materials

As a material for the puzzle, we created a shader whose texture changes depending on the viewing angle. For example, it is gray when viewed from the front, but a picture of a hint is displayed when viewed from an oblique right, and another hint can be seen when viewed from an oblique left. Solve the puzzle with these hints.

It is good to go back and forth between multiple viewpoints such as left and right or up and down, but we thought it would be interesting to combine it with a mirror, so we decided to implement a mirror on Unity.

Difficulty of mirror reflection

At first, we simply thought that we should place a camera for reflection at the position where the mirror surface is the target surface and paste the rendered image on the mirror surface, but it didn’t work.

It was necessary to adjust not only the position but also the angle of view of the camera, which could not be handled when the viewpoint moved. Above all, the difference between the image rendered by the reflection camera and the tilt of the mirror surface could not be adjusted.

In the Unity store, there are many shaders for reflection that include not only the mirror surface but also the water surface and the glass surface, and I considered that, but we were worried that the above self-made shader would display well, so we did not purchase it.

Although it took time, we collected various mirror implementations on the net as reference information and implemented the mirrors.

URP makes it more difficult

However, many of the articles that are a little old do not work in the URP environment and those that do not work in the mobile environment, so we managed to implement it by force with reference to the article ported to URP.

We will consider how to assemble the puzzle based on this.