- Home /
Lens Flares are rendered regardless of culling mask?
I have two layers: OuterSpace and Surface. At the OuterSpace layer I have objects that represent planets, stars, moons, and a sun with a lens flare component. At the Surface layer I have objects that represent stuff you find on the surface of a planet like rocks, trees, the ground, characters. Some of these objects have also lens flare components. Think on these two layers as two different, but simultaneous, realities being simulated in the game at the same time.
Then I have two cameras: Camera A has a culling mask so that it only render objects at the OuterSpace layer. This camera is rendered first. Depth -100. Camera B, has a culling mask so that it renders only objects at the Surface layer. This camera is rendered second. Depth -1. Both cameras are synchronized so that Camera A always has the same rotation as Camera B. The effect is that the player sees both surface objects and outer space objects on the sky. Like an astronaut walking on an asteroid or space station.
My problem is that both camera A and camera B are displaying all the lens flares, regardless of what layer their objects actually are at. So when the player looks at the sky, they can see the sun and its lens flare, as seen from camera A, but also they can see the sun's lens flare as seen from camera B at the same time.
Why cameras render lens flare components regardless of the culling mask?
How can I make Camera A render only some particular lens flares, while Camera B renders only some different particular lens flares, if not by using layers and culling masks?
I have searched for this, but only found this unanswered question.
Answer by Exsecratus · Feb 17, 2017 at 05:11 AM
Old post, but better late than never.
Every Camera has a "Flare Layer" you can easily uncheck it. ;-)
Thanks, but that is not what I want. I want camera A that is in layer A to render flares from objects in A, while camera B that is in layer B to render only flares in objects that are in layer B.
With your solution, I would get one camera to render flares in all layers, and the other camera not to render any flare.
The problem is that cameras (with active Flare Layer) render all flares. Even those that are in objects that aren't being rendered by that camera because of layer culling mask.