- Home /
Is there a way to mask out a sprite layer
So I have a scene with 10 parallax scrolling cameras.
- On the far away camera I have the night sky with stars.
- Before the nearest camera I have a time of day layer. This is a full screen black picture with alpha at 150. It comes and goes simulating nighttime. It does this over the whole screen. So the far away camera also has black over it making the stars look dull.
I was wondering if there was a way to ocull out/mask out the far away camera so that the front black gets layered over everything but the back camera? I am using sprites for everything and have a sprite list set up. So the full screen of black is I front of the parallax layers.
Any ideas?
If you manage to get a shader running that writes to the depth buffer, you could cull parts of the front layer off if the background camera renders closer to the camera than the front one. If you know what I mean.
I found this thread here: http://answers.unity3d.com/questions/582064/enable-sprite-depth-write.html
they don't really show what they did, but that's how I'd try to do it.
Thanks for the comment. However that link doesn't do anything for me. What is really needed is for unity to have a sprite layer culling mask. So the full screen layer can not render over top of another layer. So full screen is 1/2 black simulating nighttime and in the distance is a picture of stars nice and bright (no black over top of it)