In my new game Spireidoscope I wanted to create a kaleidoscope effect with shapes and spirals being reflected to create hopefully wonderful and interesting effects. As per usual this involved a bit of research on the world-wide interweb. After much searching I discovered that there are a few ways to achieve a mirror effect which include:
- use of shaders, in particular the water shader.
- using a camera.
- using a script and other components.
- Assets from asset store.
As we all are aware that my current scripting skills are still much to be desired I wanted to go with an option that had very little or no scripting required at all. During my search, I came across many methods which all worked but with much tweaking and writing of code, all of which also had comments saying that it was much easier to use a shader. Now shaders is another aspect and feature of Unity that I am not really knowledgeable about. I do know that shaders are used to apply colours to objects as well as textures but I am not absolutely 100% sure how to edit and modify a shader. So these methods, for my current skill level were just not satisfactory.
I then came across a small YouTube tutorial by Jimmy Vegas that made a reflective surface using a camera and had no scripting involved at all so I went with this one. I wont go into details as you should check out the tutorial for yourself as it is only 4-5 minutes long and very simple to follow.
The only issue is that it does not quite correspond with the current version of Unity and therefore the reflection one gets is very dull and requires a lot of tweaking with the mirror camera to line up the images in the correct spot.
As you can see with the image, the reflection is very light and not at all clear. If I was after a frosted glass type reflection, this would be perfect, but I want a clear and sharp reflection otherwise my game will not look and function the way I envisaged.
So I went back to the drawing board and did more interwebing and googling to try to find a better solution, one more suited to my idea and the game I want to create.
Whilst writing this post, I went back and went through the steps of the tutorial again,and although once again I was not able to change some of the functions, obviously I did do something slightly different (although for the life of me, I cannot think what) because in this attempt I achieved a pretty clear reflection. But then I discovered another issue which I can work with and around but with this reflective system, the reflective image will change size depending how near or far the reflective surface is to the original object.
Now whilst this may seem like an issue, I am confident with some tweaking, I can correct this or utilise it to add to the whole effect. When I tried to create more reflective surfaces by duplicating the mirror object, I found that my reflections were once again off. I started to play around with the camera attached to the mirror object and by changing its view-point I was able to get some interesting views and reflections until I came up with a look that I was happy with…for now.
Well that is it for this post, a short one, as I still have to sort out the spirals, spawning and hopefully working out how to take a screenshot in-game.
Thank you for your company, I hope you got something out of it. Until next time…..