Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Lens flare not ignored by culling mask

Discussion in 'Editor & General Support' started by imphenzia, Mar 25, 2013.

  1. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    If you have a light where the culling mask for the light is set to ignore a layer, how come the lens flare from that light isn't ignored by a camera set to not render a light based on the culling mask?

    Basically, my camera is ignoring a light source (as I want it to) but the camera still renders a lens flare for the culled light source.

    Could it be a bug? Any way to work around this?
     
  2. JPB18

    JPB18

    Joined:
    Jul 28, 2012
    Posts:
    22
  3. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    Yes - this is still an issue and for SPACE I ended up using subtle flares and disabling flares for the Main Camera. The problem is that I can imagine you may want to use flares on your main camera as well. I'm currently working on writing a custom flare script to get full control over flares although I don't have an ETA for when that is finished.

    I'm creating the flare (as seen below) using a quad mesh which always faces the camera. By doing this the flares and normal flare layer can be used for the main camera rendering flares on engines etc.
    $SU_NXP01i-1280.jpg
     
  4. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    lensflare culling mask work with colider have chack with it.
     
  5. DSebJ

    DSebJ

    Joined:
    Mar 30, 2013
    Posts:
    101
    Did you find a solution for this? I just encountered the problem with Space for Unity; as my engines have lens flares on them which are much more important to me than the light source lens flares from the background - ideally though, I would like both :)
     
  6. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    Hi, I ended up writing my own lens flare solution that will be included in the asset later on. This will allow you to use Unity's own flares along with the custom ones in SPACE. Another reason I went with creating my own shader driven flares is that I wanted them to persist even when the light source was off screen as seen in this video:



    The video does not feature coverage of the flare source yet, I'm doing gradual fading depending on how much of the star/source is being covered.

    I would advise you to use Unity flares for your engine and if you can live without star flares until the update arrives it'll hopefully solve itself =)
     
  7. DSebJ

    DSebJ

    Joined:
    Mar 30, 2013
    Posts:
    101
    Awesome, sounds good to me.

    Looking forward to your update :)
     
  8. Dynam1ke

    Dynam1ke

    Joined:
    Jun 9, 2014
    Posts:
    4
    Putting the lensflare on the directional light instead of the Pointlight fixes this issue. No need to code anything for this :)