- Home /
Fade camera in/out using image effects shader
I want to fade in and out part of the scene (like a room or a corridor). I have found a couple of solutions to doing this, but they have their flaws. The result I'm looking for is shown on fig. 2
One of the solutions I have found, is changing the alpha on all materials on the objects that needs to be faded in or out. The problem with that, is that the fading objects will be visible behind each other. See fig 3.
Another solution is to place the fading objects on a layer and have a camera render that to a texture. That texture is then rendered on top of all other objects and it's alpha is changed. But that will mess up the z-depth and show section of an object that should be behind non-fading objects. See fig. 4.
So, I was thinking if it's possible to achieve it using an image effect shader that can change the alpha. Then place the fading objects in a specific layer, and have the camera with the image effect only render that layer, and then change the alpha dynamically?
I have no experience writing shaders myself, but it may be fairly simple to do for one with experience.
So, my question is, if the explained solution, if possible, would give the result I'm looking for? And if it's simple to write, the shader script?
Of course any alternative solutions are welcome as well.
Thanks in advance