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

Bug Lens Flares (SRP) occlusion work in reversed order in builds.

Discussion in 'Universal Render Pipeline' started by tomekkie2, Dec 14, 2022.

  1. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    I have an issue with Lens Flare (URP).
    This what I am getting in WebGL:
    flares_urp_browser.gif

    And this is the same scene rendering properly in Editor:
    flares_urp_editor.gif

    Is this a bug or does anybody know some fix?
    It happens in a range of Unity versions.
    I have tested this and got the same results in Unity 2022.1.0f and 2022.2.0f.
     
    Last edited: Dec 15, 2022
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,254
    Please file a bug report in a project with the issue (in Help -> Report a bug)
     
  3. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    Yes, I did.
     
    DevDunk likes this.
  4. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    Does anyone is also experiencing this?
     
  5. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    I wrote to cancel the report bug.
    This is not a bug, but a result of using a MirrorFlipCamera from here:
    https://answers.unity.com/questions/20337/flipmirror-camera.html
    - which uses GL.invertCulling
    With GL.invertCulling set to true, the flares work as expected.
    The issue is that the code in MirrorFlipCamera doesn't switch GL.invertCulling back, I don't know why.
     
  6. ElliotB

    ElliotB

    Joined:
    Aug 11, 2013
    Posts:
    203
    tomekkie2 likes this.
  7. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    Than
    Thanks, anyway I was using the second version of the script, from answer by _geo__.

    Finally I wrote a flip camera render feature, basing on this article:
    https://docs.unity3d.com/Packages/c...renderer-features/how-to-fullscreen-blit.html
    -and all the problems have gone.
    __________________________
    Update:
    Only the problems with reflection probe has gone.
    The lens flare seems to be unaffected by GL.invertCulling setting and still renders defectively in webgl.
     
    Last edited: Jan 9, 2023
    ElliotB likes this.
  8. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello guys,

    This is happening to me at the moment. I am using URP Unity 2021.3.14f1. Any solution yet?

    Regards,
    Carlos
     
    tomekkie2 likes this.
  9. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    Unfortunately not.
    I have reported a bug, submitting this unitypackage with a sample scene, where it happens.
    But they say they can't reproduce it.
    https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-25988

    I have just changed the thread title, because it happens not only in WebGL, but also for other build targets.
    The same happens in Android, when I tested it on Samsung Galaxy S8.

    Maybe Editor is the only place, where the lens flare occlusion works as expected.

    Possibly they would succeed to reproduce your case if you send it to the bug report.
     

    Attached Files:

  10. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    Can anyone get the Lens Flare (URP) occlusion to work properly (outside Editor) in any scene for any build target in Unity 202x.xx?
     
  11. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Well I would say that this is pretty sad, that this issue has been there for such a long time and Unity hasn't fix it. It is such an important bug when you think about modern games, where lens flares is a given! I love Unity Engine and I have been working with it since the very first version came out, but if there is something that I noticed always is the unfinished features plaguing the engine. I would venture to say that most new features always come unfinished/half done/buggy and it usually takes a second sit when it comes to fixing it, to more new unfinished features.

    It is just a shame, that it is difficult to trust that it will be ok to go into production using the many features of Unity. I again I love the engine for its simplicity and speed, so I am not an enemy of either Unity or the wonderful team behind it, but more like again the planning or decision to bring new features that are usually buggy, unfinished, or not tested thoroughly.

    I hope someone from the team read this and realize that this essential bug was found since December last year and after all who would want to play a game with lights without lens flares eh?
     
    tomekkie2 likes this.
  12. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    I agree.
    Lens Flares were present since early versions of Unity3d.
    I remember using them in Unity 3.xx.
    After SRP has appeared, they were not supported in LWRP and then in URP at all for a quite long time.
    Now it looks that they are supported, but are not finished completely.
    Take a look at Universal RP samples after importing them to Unity using Package manager.
    Just take a sunflare scene from it. Play the scene in Unity Editor and then in Android or WebGL or (probably) any other built target.
    The below .gif image comes from Editor. This is the sunflare scene; I have only changed the LensFlare occlusion radius from 15 to 0 in order to highlight the effect.
    movie_001.gif

    The next image comes from Android build, deployed to Samsung Galaxy S8. You can see the LensFlare occlusion does not work and also the LensFlare screen position is mirrored relative to middle horizontal screen axis.
    az_recorder_2.gif
     
  13. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,254
    Check the issue tracker and if not findable make a bug report
     
  14. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
  15. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,254
  16. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    946
    I don't know the bug reports workflow well.
    This bug has IN REVIEW status, but I could not find it in issue tracker.
    I made a fresh bug report, but I didn't know how to make it public, and I fear it will stay as private again.
    https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-34267
    I hope they wouldn't ban me for spamming the bug reporting portal:).
     
    Last edited: Mar 5, 2023
  17. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,254
    Ahhh sorry, if it's still on jira it's private untill confirmed. Then it's just waiting
     
  18. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    99
    I cannot explain my feelings after I encountered such problem with so basic functionality for modern engines!
    Lens Flare SRP just dont work!
    There is at least TWO bugs!
    If you enable Allow Offscreen along with Occlusion - it will make lens flare to be visible near the screen edges even through walls! I was pretty dissapointed with this bug so I just disabled Allow Offscreen and everything was looking right in the editor... but not in the android build. In the android build Lens Flare SRP are visible through walls even with occlusion enabled.

    Two critical bugs for year(or more?) in something that should just work!
    I just hate this entire company, how long we will suffer from such incompetence?
    So much of half-working or non-working at all features that should be pretty basic for any modern engine. So much of issues :mad::mad::mad:
     
  19. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,254
    If you hate it this much, why still use it?
    Getting mad gets no one nowhere. Best thing to do is to report issues and try to get people to vote on them if they are public.
    Or if you feel like other engines do this better, use those
     
  20. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    99
    Thanks for advice, this is really so helpful for peoples like me. We stuck here because of our commercial work projects. You better ask why I cannot enjoy it, instead of pushing away anyone who suffer from its services when its not so simple to leave.
     
  21. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    99
    After your message to guy who tell you that he created bug report in December 2022 and still no answer from Unity and your reply to me you looks a bit trolling, you know? Like "Hey, I created a bug report for something simple that should just work and despite a lot of time passed there is no real reply to it" and you: "Ah, okay, just wait", "If you don`t like to mess around with critical issues in basic functionality for months - then just leave, there is no problem"

    I don't want to be toxic nor aggressive at all, I just struggle with Unity services along with a lot of other peoples for years. No one care about what is really matters like everything is okay, while everything is so bad.
     
    lilacsky824 likes this.
  22. tlovidiu

    tlovidiu

    Joined:
    Nov 13, 2012
    Posts:
    20
    Same problem :( 2021.3.19