- Home /
Can particles block lens flares?
I have a particle system that I'm using to generate asteroids that fly by the camera. This works well, but you can still see the sun's lens flare through them. Is there any way to make the particles block lens flares?
Answer by RafaelCN · May 04, 2013 at 11:36 PM
You need to deactivate the lens flare of the sun when you see the particles, example: When the particles is enabled you can make a script to deactivate the sun's flare. if the script is on the camera you create 2 scripts, one that will be in the light who is the sun, and two that will be in the camera, you can access the properties of the light. Like this:
public class sunScript : MonoBehaviour {
public Flare startflare;
public static bool showFlare = true;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(showFlare == true) {
light.flare = startflare;
}
}
}
and when the particles is activated you make the value of the variable showFlare to false. I don't know if it'll work, but it help a lil bit.
I don't think that'll work. I have the camera constantly pointed at the sun (it's a screensaver) and the asteroids just fly in front of it.
Answer by Chronos-L · May 05, 2013 at 01:38 AM
Lens flare will be visually-blocked when it is blocked by a collider.
However, I am not sure how to work that out with a particle system, do you write it yourself or is it the built-in legacy/shuriken particle system? If you write it yourself, then just add mesh-collider to the asteroid gameobject; but I have no clue on how to do it using the builtin particle system (maybe it will work with legacy, but I have never used it at all, so I am still clueless on how to pull it off).
Your answer
Follow this Question
Related Questions
Script flares onto lights? 1 Answer
Disabling lights collision 2 Answers
VertexLit particles not affected on all directions 0 Answers
Occlude Lense Flare with Particle System 0 Answers
Flashlight Flare 3 Answers