- Home /
Camera cutout effect (fog of war) based upon particle system
I am prototyping something 2d (top down) at the moment and was looking at trying to create a fog of war style effect around the player using a particle system. However for the life of me I cannot find a way to get it to work. I was assuming I could have a camera which has a solid colour background then do some form of cutout based upon a layer (the particle system) so only areas the particles cover would be visible, then have another camera with a lower depth render the rest of the game, so you would basically have a sort of viewable area based upon the particles.
I am sure this could be achieved with a render texture as a mask but I do not have unity pro, so I cannot do that approach, so there any way to achieve this with unity free?
You could have a look at these :
https://www.assetstore.unity3d.com/en/#!/content/20591
https://www.assetstore.unity3d.com/en/#!/content/11640
You could also have a look at utilizing this (prob you best option) :
http://wiki.unity3d.com/index.php?title=Depth$$anonymous$$ask
I have used depth cutout before, for making a porthole style effect on certain elements, but with the particle systems it does not seem to behave the same way but maybe its because its 2d and not 3d or something. Also this way requires you to have some form of overlay to act as the object you cull through, which is fine, but I thought there would be an easy way to do some form of alpha or depth check purely on the camera via a shader or something.
I wondered if you could have two or three large quads, each with a transparent tiled fog texture on them, each rotating the texture via texture offset, placed slightly above each other. You could then use the depth mask shader to cut through these quads via whatever shaped overlays you wanted to reveal what is underneath...
Just to clarify I am specifically after using particles for the viewing area, so I am not specifically after a fog of war, I just want to work out how to basically define the area to be rendered by where the particles are.