Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved LensFlare (SRP) does not work properly in VR and URP

Discussion in 'VR' started by KuanMi, Mar 7, 2022.

  1. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    I find the position of the lens flare is wrong in VR and URP.
    In Scene Tab:
    upload_2022-3-7_11-16-22.png
    But in Game Tab or HTC Vive:
    upload_2022-3-7_11-16-39.png
    I tried Single Pass Instanced and Multi Pass but both have the same result
    Is this a bug, or am I setting it wrong?
     

    Attached Files:

  2. mashixuan8

    mashixuan8

    Joined:
    Nov 4, 2014
    Posts:
    22
    it's just bugged and they don't really care about it. I reported this bug like three monthes ago and no one replied me. I guess it will never be fixed.
     
  3. JamieVRcade

    JamieVRcade

    Joined:
    Oct 21, 2012
    Posts:
    32
    Same. This has been a longstanding problem and I don't know if there is a fix ever coming.
     
  4. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    I simply made some modifications to adapt to VR by referring to the code of URP, and I will submit the code to github when I finish sorting out the code. Here are some instructions in Chinese.
    https://kuanmi.top/2022/06/27/LensFlare-SRP-in-VR
     
    hippocoder likes this.
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Can someone report a bug with case number # please? If you genuinely want it fixed, this is the only way it can be assigned actual developers.

    Looks like a drop in fix for Unity to do. Great work!
     
  6. jukibom

    jukibom

    Joined:
    Aug 31, 2015
    Posts:
    54
    Have just submitted repro in a simple project with a link to this thread, will update with a case number when I get one.
     
  7. jukibom

    jukibom

    Joined:
    Aug 31, 2015
    Posts:
    54
    apparently Fixed in: 2022.2.0a17
     
  8. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11
    I tried 2022.2.0b10 and it does not work, I see duplicate flare, one for each eye. Maybe my camera config is wrong?
     
    Boodums likes this.
  9. VRLab

    VRLab

    Joined:
    Mar 8, 2015
    Posts:
    1
    Getting a 404 on this link which appears to be exactly what I need.....as I'm getting serious "double vision" flares on Unity 2021.3.1f1 with URP 12.1.6
     
  10. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,974
  11. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    @VRLab I don't think modifying the official code is a mature solution, maybe you should wait for the official modification. If you want to reference some code, this is the git repository. MaZhengKe/LensFlareVR (github.com)
     
  12. Kevin-VFX

    Kevin-VFX

    Joined:
    Apr 17, 2016
    Posts:
    54
  13. SirEugen

    SirEugen

    Joined:
    Aug 4, 2020
    Posts:
    5
    Hi.
    As I understand - your fix doesn't work with Occlusion?
     
  14. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Just seeing this now, going to try to get this fast tracked as you provided ample info showing it's a legit bug. Sorry for long delay.
     
    KuanMi and DevDunk like this.
  15. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    It's been too long and I've forgotten. But it looks like Unity is going to fix this.
     
    Unifikation likes this.
  16. KuanMi

    KuanMi

    Joined:
    Feb 25, 2020
    Posts:
    41
    In URP, the problem lies in the LensFlareDataDriven function of PostProcessPass, where only the VP matrix of a camera is passed in, without considering that the VP matrix of the left and right eyes in VR should be different.
     
  17. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    There's a fix currently in the merge queue for this. It's been tested with occlusion. Looks like it's been tagged for backport to 2022.3. Not sure how long it will take to get in your hands, but it's on the way.
     
    SirEugen, KuanMi and DevDunk like this.
  18. SpaceCatStudio

    SpaceCatStudio

    Joined:
    Apr 7, 2021
    Posts:
    1
    The lens flares still don't work correctly in vr, im using 2022.3.4f1. how long do we need to wait ? I klnow its low priority because it makes no sense for realistic games but im making a stylized game and lens flares would be an amazing addition to bring over that cinematic feeling.
     
  19. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    It looks like this is still trying to land in 2023.3 .. we have a pretty large suite of rendering regression tests and this feature broke some of them. Looks like it's close to landing again.

    so will still be some time before it makes it to 2022.3.
     
  20. The_Pied_Shadow

    The_Pied_Shadow

    Joined:
    Jul 25, 2018
    Posts:
    12
    Any updates? Was this fixed? What version?
     
  21. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    Looks like it was fixed in URP 16 (2023.1+)
     
  22. The_Pied_Shadow

    The_Pied_Shadow

    Joined:
    Jul 25, 2018
    Posts:
    12
    What about HDRP?