Hi,
I’ve got a sun (directional light) with an halo and a lens flare. How can i do to make it invisible when there is an object between my camera and it.
Cheers for the help
BooBi
Hi,
I’ve got a sun (directional light) with an halo and a lens flare. How can i do to make it invisible when there is an object between my camera and it.
Cheers for the help
BooBi
in LensFlare component there is layer mask
In fact what i want to do is a sun with a 50mm lens flare, a draw halo, and an intensity at ±1 but without lighting anything in my scene.
To do that I created a directional light, intensity 1, flare 50mm, tick the draw halo and choose nothing in the culling mask.
(if i choose everything in the culling mask it doesn’t change anything).
If I take a simple directional light, add a lensflare component and a Halo component, it’s never visible.
In my previous project (unity 2.6) I had a directional light with draw halo and 50mm lens, I checked my project I can turn the culling mask between nothing and everything my sun is exactly how I want it to do.
I really don’t know what i’m missing…
not light culling, but ignore layers in lens flare
sorry , ok i’ve made a layer with all my buildings, one with my trees, one with my cameras. I added a lens flare component to my light.
If i ignore the camera layer, I can’t see the lens flare that’s normal, then I can use any of the layers, mixed, just the buildings, just the trees… nothing works I can still see the lens through my buildings…
Do your buildings have colliders attached to them? I seem to remember the lens flare going through objects without colliders attached. It’s been a long time since I’ve messed with lens flares though, so I could be wrong.
actually these are IGNORED layers. By default the value is Transparent + IgnoreRaycast. So if your buildings are in one of ignored layers then lens flare will be visible
no there is no colliders, and yes I knew that it was ignored even if i’m tired I still can read, but I tried to ignore it aswell (I tried all the configurations: through the trees, buildings, not,…) and in both case it doesn’t change anything.
It come from the fact that i don’t have any colliders. In this scene (a big one) I created a really basic scene which is basically my ground and planes (as sort of fences) which I imported in the same scene and use them as colliders, because I read that using the generate collider is no so good for the performances (my scene is a complex of building and we can turn around or walkthrough the scene (not in the buildings)).
Should I rebuild this file to really include completely my buildings, or is there a better way to do it ?
for anybody who came across this same problem, you need to attach a collider like magadeath suggested
Yep you need colliders, if there is none, your lensflare goes trough the object.
If you don’t want to generate colliders, you can use boxes to make a collider object yourself. I do that a lot when creating huge environments with 3d objects. For houses this is a simple solution, for more advance objects, this can be a pain in the butt.
and what if the object is moving? like a cockpit? colliders mess everything up!
Add a custom tag for your flare emitting objects and set the flare components to ignore it, and not “default” Default is probably your buildings.
Worked for me, my 3km wide star had no flare until i figured out i had to do that.