Search Unity

[Solved] [HDRP] Random black flickering | 2018.2.1

Discussion in 'High Definition Render Pipeline' started by PitHeimes, Jul 30, 2018.

  1. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Hey there,

    I sincerely hope, this has not been posted yet, but at least I was unable to find anything similiar.
    We are currently working with HDRP and everything went fine so far. Expected behaviour.
    There is just 1 strange issue we are facing.

    Sometimes the screen (or some materials) flicker black. Randomly. Just a millisec. Not view angle dependent. We also deactivated all PostFX. No changes. Tried different shaders. No changes.

    Does anyone have any clue, where this is coming from?

    Any help is greatly appreciated.
     
    Last edited: Jul 30, 2018
  2. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    239
    try to off some features from HDRenderPipeline settings at Light Loop Settings
     
  3. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Hey peter,

    thanks for your hint. Could you also tell me where to find those settings?
    Seems like I am unable to locate them. Nothing in SRP Debug window at least.

    Thanks again!

    ---

    Oh nevermind. I found it :D Going to investigate on this
     
  4. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Well nothing. All enabled, All disabled. No difference :(
     
  5. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Tried to off all features available. No difference.
    But it has to do something with the lights. If I disable Lightin in SceneView everything's fine.
     
  6. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Well it's strange sometimes... Just opened this thread after 2 days of searching and 30minutes later got the solution.

    Disabling the contact shadows of our Main Directional Light helped :)
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah it's all WIP so you'll get this sort of problem...
     
  8. tjarkohillebrink

    tjarkohillebrink

    Joined:
    Oct 22, 2019
    Posts:
    1
    Unfortunately I have the same problem and this didn't fix the problem :( Anyone who knows the solution?
     
  9. vloosfelt

    vloosfelt

    Joined:
    Apr 17, 2014
    Posts:
    1
    i've got the same problem... flickering randomly even in the scene. annoying.
     
  10. Doomlaser

    Doomlaser

    Joined:
    Dec 9, 2013
    Posts:
    24
    Also have this problem HDRP Unity 2019.30f3. Scene flickers to total black seemingly randomly
     
  11. Leniaal

    Leniaal

    Joined:
    Nov 7, 2012
    Posts:
    119
    I've had this problem. For me it was one specific model that caused the flickering after a Unity and HDRP upgrade. No guarantees it will solve it for you, It but it might be worth checking by disabling objects to see if you can identify which object could be causing this. When I found the object that caused it for me, reimporting the model was enough to fix it.
     
  12. MartinWorker

    MartinWorker

    Joined:
    Feb 24, 2015
    Posts:
    12
    Its still exists in 2019.3.0f6 with HDRP 7.1.8. I got black frames.
     
  13. EJSainz

    EJSainz

    Joined:
    Mar 24, 2015
    Posts:
    30
    I was getting lots of black frames and found out some causes.

    - Cause 1: objects with scale 0. If an object has any of its scales set to 0, it's quite probable that the screen will flicker in black when it is being rendered.

    - Cause 2: certain normal maps. Some normal maps that I downloaded from the internets where causing this flicker. Quite interestingly, it also depended on the scale! The same model, at scale 1, had no errors. For reasons, I use the model at scale 0.064, which caused tremendous flickering.

    - Cause 3: certain normal maps + distortion. At scale 1, this does not cause flickers, but black squares, being it angle dependent. At scale 0.064, the flicker covers the whole screen.

    We've solved each case differently:

    - Cause 1: avoid objects getting scale 0.
    - Cause 2: using a different normal map.
    - Cause 3: not using distortion - for now.

    Hope it helps.
     
  14. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    We have problems with flashing black polygons when they are duplicate. We check the geometry for duplicate polygons (especially CAD data (especially CATIA)).
     
  15. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Why this thread mark as solved? It not solved at all! In my case black squares or flickering caused by planar reflection. No workaround, only disable it.
     
  16. iSpiegelball

    iSpiegelball

    Joined:
    Jan 7, 2020
    Posts:
    14
    Just noticed the same problem. I have a Radeon Pro Vega on a bootcamped Mac. What card do you have? Maybe its a driver issue...
     
  17. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    iSpiegelball I hardly doubt it. I have gtx-1650 and Windows 7
     
  18. MartinWorker

    MartinWorker

    Joined:
    Feb 24, 2015
    Posts:
    12
    this bug is still exists in 2019.3.4f1 with hdrp on all hardware
     
  19. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    I solved the problem for myself by disabling the static batching that was enabled on some objects.
     
  20. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I can confirm this as well. I have to say that this is really annoying.
     
  21. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yep, I've encountered this after porting my (semi-large) project to the HDRP from the built-in renderer.
    (Unity 2019.3.7f1 / HDRP 7.1.3)

    Tried disabling lighting settings in the HDRP pipeline asset, w/o any luck. As well as shadows / contact shadows.
    And objects with distortion applied to them.

    I guess its object related, alas, I can't pinpoint which one it is yet.

    If anyone else have suggestions how to find out what's causing these artifacts, please share them.

    Edit: Found some normal maps that are causing this issue. Not sure how to replace them though. Or how to even debug what's wrong with them.
     
    Last edited: Apr 18, 2020
  22. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    So, it seems like in HDRP Lit does normalize the input normal map without suppressing potential NaN's.
    (Judging by this shadergraph post, https://forum.unity.com/threads/mod...fter-adding-a-normal-map.822486/#post-5450790 which probably means default shaders do the same)

    Question is, how to find and test existing normal maps against zero / NaNs?
    Unpacking normals in C# in my attempts just result in -inf, -inf results (e.g. DXT5).
    But most likely I'm doing it wrong.

    Stop NaNs are enabled in the pipeline asset settings, but I think those are for post processing only.
     
    Last edited: Apr 18, 2020
  23. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, any flickering black screen mean you have a NaN somewhere in your scene which can be to various reasons.

    If it is a bad material operation that is done in Shader Graph or a custom shader, there is nothing HDRP can do about it, you must solve it.
    We have a debug mode to track NaN: windows -> Render Pipeline Menu -> Rendering -> Full screen mode -> NaN detector. NaN pxiel will appear in red, then you can disable feature one by one in HDRP FrameSetttings to find what pass cause the issue.

    We have also a "stop NaN" that apply just before postprocess can help.
    Usually black screen is cause by bloom spreading the NaN everywhere.

    If you have high value in lighting it is possible that you get an Inf, that later can be convert to a NaN. For example this is what often happen with planar reflection. A specular highlight is very strong (due to a sun with value of 100 000 lux) and cause NaN in reflection and spread everywhere. We have recently (for 7.4.0) clamp to avoid Inf for such a case.

    If the Inf appear in Main view, HDRP do nothing currently. So reading this value later could cause problem depends how it is use.

    We have get various discussion internally about the "NaN" silent fix. We believe it is better if users are aware that they have a NaN and try to fix it, as it always highlight a true problem somewhere that should be understand and fix correctly, rather than trying to "fix" NaN silently at every place. But we are conscious that this choice may be difficult with people not aware of what is a NaN and how to solve it. We may revisit this and try to more silently fix NaN.
    Still Stop NaN should work. It apply to the whole frame just before postprocessing to avoid to spread the NaN.
    If Stop NaN don't work, the black flickering is something else, (maybe exposure issue?).

    To sum up, a lot of black filtering problem mention in this thread are just NaN that happen in different cases, they are all different NaN and can't be classify as same bug, or single stuff that can be fixed.
     
  24. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    That's nice to know. Thanks.

    However, how do I fix normal map caused NaN's?
    I'm 100% sure that it is caused by one. Because removing it also removes the flickering.
    And the Stop NaN's in this case does nothing.

    Do I need to rebake / modify it somehow?

    Any suggestions would be great, because I'm not artist and I don't have the sources either.

    I was thinking about it, but it seems like its just plain easier to just suppress it via custom shader.
    Because there's like a ton of art that probably have 0,0,0 normals out there.
     
    Clonkex likes this.
  25. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Seb, mine flickers like crazy whenever I select something with a mesh renderer (the scene view). I've tried the debug view for NaN, but I don't observe any red dots. Also, if i select anything that has lightmaps, the meshrender's lightmap section opens and closes indefinitely, and the scene view flickers like crazy.

    Any idea on the underlying issue?
     
  26. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Edit: Okay, the issue that somehow imported normals on the model get messed up.
    Setting Normals to Calculate and Tangents -> Calculate Mikktspace instead of Import solves the issue.


    Edit 2: Most of those models are generated with RealtimeCSG, setting every one of them to Calculate instead of Import solved my flickering issue. I've made an issue for that on the RealtimeCSG github.

    Tried making today a shader that replaces zero vector normals with 0.001;
    And it didn't worked either. It seems like there's an internal issue after normals being assigned to the surface data.

    Here's normal map example:
    [Redacted]

    That also got me thinking whether it can be caused by the model itself somehow;

    There's also a different case of the flickering, but it doesn't show up in the NanTracker debug as red pixels.
    Need to investigate those as well. It could be light max count reaching, but I'm not sure about that.
     
    Last edited: Apr 20, 2020
  27. lucyyfraal

    lucyyfraal

    Joined:
    May 31, 2020
    Posts:
    1
    Hello Guys! I'll leave this comment here since I had the same problem and I found another "solution".

    For me, the problem was that I had a tree that I had exported from SpeedTree. I followed all the instructions to import a tree from SpeedTree to Unity HDRP, that I found on the SpeedTree documentation page, but whenever I placed the tree in my scene I had this weird flickering.

    After reading your comments I realized it was my post-processing that was making the flickering, more specifically the Bloom, so I turned it off and the problem was solved, it is a little shame to not have a little bloom but it's better than to have a flickering scene. I hope this helps someone is a similar situation in the future!
     
  28. oneak

    oneak

    Joined:
    Oct 23, 2018
    Posts:
    2
    I solved this by unchecking Post Processing Profile -> Screen Space Reflections.

    The problem came specifically in Basic Unity 3D Project not in HDRP. This caused the flickering of shadows with Direction Light and Post Processing Effects when the mouse was moved in the editor or the camera rotated in the runtime.
     
  29. Zaine7673

    Zaine7673

    Joined:
    Feb 15, 2018
    Posts:
    238
    So for me it seems like it disappears when i switch off my Bloom. However, I'm curious to know if there is a way around this without switching off Bloom?

    Also I should add that this only occurs when using a specific material created in shader graph. On that shader if I turned down the normals strength all the way to zero - the flickering also disappears
     
  30. Neiist

    Neiist

    Joined:
    Sep 18, 2012
    Posts:
    31
    In my case with HDRP 10.2.0, the flashes were caused by the Temporal Accumulation setting of the Ambient Occlusion being disabled, after switching it back on (or after disabling the Ambient Occlusion all together) there's no more flickering of the lights in the scene view.

    To be precise, my flashing problem was happening when selecting a gameobject with a mesh renderer or a material and moving the cursor over the fields in the inspector.
     
  31. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Normally, NaN and bloom usually causes this weird problem, but the other causes of the black flickering problem, mentioned by the others were really interesting to read.
     
    Last edited: Mar 12, 2021
  32. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,813
    For me, it was indeed materials made in Amplify Shader. All I had to do is have NaN off and it fixed it for me. I have no idea how to fix the actual issue myself...
     
    BrandyStarbrite and TheGamery like this.
  33. Zihaben

    Zihaben

    Joined:
    Apr 6, 2015
    Posts:
    6
    Get this ugly flickering on 2019.4.10. Was caused by one of ProBuilder meshes after edge dividing and face extruding.
     
    pierre92nicot likes this.
  34. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Glad to hear that solved it.


    Interesting.
     
    Last edited: Aug 3, 2021
  35. Kadae

    Kadae

    Joined:
    Dec 7, 2013
    Posts:
    52
    F***ing NaNs.
     
  36. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,813
    Actually I found out later by accident that the "normal map intensity" in the amplify shader causes those NaNs. I forget about it them someone reminds me years later. It looks like it's safer to have a value of "1" in HDRP normal maps intensity. Even today there are probably still asset store publishers that have this issue in their asset packs and they don't know it.
     
  37. SangSensei

    SangSensei

    Joined:
    Oct 11, 2020
    Posts:
    1
    guys, I found how to solve it, I saw that my unityhub account was auto log out, so when I login back, click some update in the hub, woala, it's fixed ^^
     
  38. REDACT3D_

    REDACT3D_

    Joined:
    Nov 8, 2020
    Posts:
    222
    Problem: objects appear to flash black when moving in the game view only.
    This occurred only in the "game" window but not in the editor window. (runtime and editing) While using unity 2022.1.12f1. HDRP outdoors.

    Problem was caused when deleting a Decal Object that caused the renderer to default to the Deferred renderer in the pipeline settings.

    Took some fiddling around before realizing what had occurred.
    Seems like there's a few things the user can do to trigger this, not just deleting a decal prefab.

    To be clear, the solution for my issue in HDRP 2022.1.12f1 was fixed by toggling the renderer from Deferred to Forward then playing the scene.

    an error message for when the renderer changes like this would be great.
     
    Last edited: Aug 19, 2022