Search Unity

HDRP black rectangular area appearing in 3D space - cause unknown

Discussion in 'High Definition Render Pipeline' started by simonkendrew, Jun 2, 2021.

  1. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    I am almost at the end of developing an application for Windows 10 desktop, for use in a museum with a touch screen. The app is built in HDRP and has a bug where a black rectangular area appears in 3D space (see 2 of the videos for examples of the bug). I do not know what is causing this black area to appear. The app will run on 2 almost-identical PCs (identical hardware, slightly different drivers / windows build) in the museum, both of which I currently have for testing. I have seen the bug happen on both of these PCs. The bug appears to be a visual issue only, the app still continues to run and can be interacted with.

    The black area bug

    upload_2021-6-2_11-52-9.png








    Basic overview of 3D space in Unity Editor, showing the plane used for the background image and also the globe.

    upload_2021-6-2_11-32-26.png



    How the scene looks through the camera when the bug has not occurred.

    upload_2021-6-2_11-32-34.png


    The problem can occur when the app is not being used / interacted with, just running in screensaver mode where a 3D globe rotates constantly. The problem appears after a variable amount of time after the app has been started. I have seen it happen after 1 hour of running, after 4 hours of running. If I leave both PCs / apps running overnight or over a weekend, when checked the next morning / after the weekend, the problem has occurred on both PC / apps. I have also left the app running on my own development laptop for 3.5 days over a long weekend, and the app was actually running OK when I checked it, the bug had not occurred. I am now running the app on another (4th) PC to see if the issue is PC-related. I have only seen the problem when running the app as a windows exe, not in the Unity Editor.

    When the problem occurs, if I navigate the app to another unity scene and then return to the scene with the rotating globe, all the visuals appear correctly and the issue has gone, until it happens again.

    When the black rectangle occurs, many items on screen can still be seen in front of the black (they are mostly coloured white or cream in the videos I have included). All these items are either HDRP Unlit transparent materials rendered after post-process, or Canvas UI. The items that seem to be covered / hidden by the black area are the 2 meshes used for the globe (ocean and land), and also the plane used for the background image. The ocean and land on the globe both use HDRP Lit opaque materials, the background plane material uses a HDRP Unlit opaque material.

    The app was initially developed in Unity 2019.4.7f1 (HDRP 7.3.1). After the bug was discovered, I updated the app to Unity 2019.4.26f1 (HDRP 7.6.0), but the bug is still happening. I have duplicated the Unity project and updated the duplicate to Unity 2020.3.10f1 (HDRP 10.5.0), so I now have 2 versions that I am testing and trying to eliminate features from, in order to identify the cause. I have only been testing the Unity 2020.3.10f version for less than a day, the problem has not occurred yet.

    So far I have disabled the following in my scene and then retested, to see if these might be the cause:
    • Post Processing global volume (contains 9 overrides) - Vignette, Exposure, White Balance, Film Grain, Depth Of Field, Tonemapping, Color Adjustments, Ambient Occlusion, Contact Shadows. These were disabled by deactivating the entire gameobject that contains the volume. The bug still happens with these disabled.
    • Directional Light (there is only one light in the scene). This was disabled by deactivating the entire gameobject that contains the light. This is currently being tested to see if the bug occurs.
    • Sky and Fog global Volume. This was disabled by deactivating the entire gameobject that contains the volume. This is currently being tested to see if the bug occurs.
    The videos I have included show that the globe and background plane are still actually present when the black area appears, they just seem to be covered / hidden by it.

    Can anyone help me to identify what might be the cause of this issue?


    Testing PC specifications
    • Museum PC 1 – Windows 10 Enterprise (20H2 19042.928), i5-9400F (2.9 GHz), 8GB RAM, 500GB SSD, Nvidia GTX 1660 Ti 6GB (driver 432.00)
    • Museum PC 2 – Windows 10 Enterprise (20H2 19042.746), i5-9400F (2.9 GHz), 8GB RAM, 500GB SSD, Nvidia GTX 1660 Ti 6GB (driver 456.71)
    • My development laptop – Windows 10 Pro (20H2 19042.985), i7-6700K (4 GHz), 32GB RAM, 2 x 500GB SSD, Nvidia GTX 970M 6GB (driver 466.27)
     
    Last edited: Jun 2, 2021
  2. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    no solution,

    but if you have objects with transparency this may be a place to look into. If you have objects with transparency that also cast shadows then maybe is this reason.
     
  3. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    Thank you for your advice. I've checked through all my game objects, meshes, materials, etc. The only object that casts shadows is the land on the globe. All other objects, including all the transparent objects rendered after post-processing do not cast shadows. There are only two objects that receive shadows, the land and ocean on the globe. I will look further into transparency, as you suggested.

    Over the past 3 days I have been constantly running the app on a couple of PCs, one app is published in Unity 2020.3.10f1 (HDRP 10.5.0), and the other is published in Unity 2019.4.26f1 (HDRP 7.6.0). On both of these apps I have disabled the directional light and also the sky and fog volume. So far, the black rectangle issue has not occurred at all. I will leave the PCs and apps running over the weekend, to see what happens by Monday morning.
     
  4. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    An update on my testing......
    I have been running my app (published in two different versions of Unity, as mentioned above). non-stop for 5 1/2 days, and the black rectangle issue has not occurred. The directional light and the sky and fog volume were disabled in both apps. Therefore, I don't believe the Unity / HDRP version has any relevance on the issue but it is more likely related to either the lighting and / or the sky and fog volume.

    Going forward, I am now testing the app in it's intended Unity version (Unity 2019.4.26f1 and HDRP 7.6.0) on two PCs. One app has only the directional light disabled and the other app has only the sky and fog volume disabled, to further determine which does / doesn't encounter this problem.
     
  5. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    can you also check if the app runs on the Nvidia GPU and not on the integrated CPU graphics?
     
  6. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    It's definitely running on the GTX 1660 Ti GPU, as I've already been checking usage through GPU-Z.
     
  7. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    After 2 days of testing the app (Unity 2019.4.26f1 and HDRP 7.6.0) on 2 PCs, here are my results.

    App with directional light enabled, but sky and fog volume disabled - Seems to work OK, no issue with the black rectangular area appearing.

    App with directional light disabled, but sky and fog volume enabled - The black rectangular issue has occurred, I have a video recording below that shows it growing in size as the camera is zoomed in / out on the globe.

     
  8. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, these look like nans.

    On the camera, do you have "Stop NaNs" enabled?
     
  9. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    "Stop NaNs" are disabled on the camera. I haven't tried changing this setting, but I have looked at this option in the documentation, and it would suggest that I should keep it disabled. If I enable it, it could cause black pixels to appear. So I think I already have the correct setting here?
     
  10. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    Not a solution, but you could try using RenderDoc to identify what is happening when the issue occurs.
    Start the app with renderdoc, wait until the issue is visible and make a capture to analyse the rendering.
     
  11. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Does stop NaN have any performance impact?
     
  12. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    Thank you. I've already got this on my to do list. I've not used RenderDoc before, but I've heard it's a good tool to have in my toolkit. I haven't used it yet because the issue I have been encountering has sometimes taken days to appear, and I also wanted to see if anyone on the forums might be able to identify or narrow down the cause from the videos I've posted.
     
  13. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    I've read through Post-processing: propagating Not a Number or Infinite values in the unity documentation, there's quite a bit of relevant information here that matches the description of what I am experiencing, although I have tested my app for a considerable amount of time with all post-processing disabled, and the black rectangle issue still occurred, therefore I don't think it is post-processing related.

    That aside, I am now following the advice in the above linked webpage, using RenderDoc and some of the in-editor debug tools to further identify the cause. I'll update here as / when I have more information. Any other advice from anyone is more than welcome.

    Also, whether this is relevant, when running my app in the editor, I get 1 warning in the console (but no errors) - "Calling Deallocate on pointer, that can not be deallocated by allocator ALLOC_TEMP_THREAD". This occurs when starting to play the app, and occasionally when stopping the app or loading another scene. Could this be related?
     
    Last edited: Jun 9, 2021
  14. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    An update on my testing since my previous post...

    Using Renderdoc I've identified that NaNs are indeed causing the black rectangle issue I'm experiencing. Using 'Stop NaNs' on the camera does not prevent the issue from occurring. Removing different features from my app and then testing shows that the sky and fog volume is the root cause of the problem.
     
  15. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    hmm, another dumb question :) but you never know

    do you have correctly set up the HDRP volumes?

    meaning, the visual environment if set to an option (like hdr) should also have the hdr override included in the volume.

    then the exposure override, how is set up? what options do you have there? is it fixed?

    finally in "Project Settings" then "HDRP Default Settings" did you made any change to the infinite list of options available?

    best way to check if there are unwanted changes is to create a new hdrp project, open your project and the new project side by side and check those those settings one by one, see if anything is different

    now that I think about it this may be related to the exposure as the image will get darker or brighter automatically. best to set it up to fixed and play with the numbers
     
  16. simonkendrew

    simonkendrew

    Joined:
    Aug 31, 2017
    Posts:
    33
    Thanks for this advice. I will certainly check this. My solution at the moment is to remove the sky and fog volume altogether, and adjust lighting and post processing to compensate.