Search Unity

Mesh error when baking lights

Discussion in 'Global Illumination' started by sd_trent, Feb 19, 2021.

  1. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    Hey guys,

    I get these errors about once a second when I try to bake my lights and the bake never finishes.

    Line 215 in Verify - Geometry geom c4fab7362f4dc00cea6f77d7ddf7f9cb: Index 45 has value 41 that reads non-finite value nan in channel 4, element 0

    Line 229 in Verify - Geometry geom c4fab7362f4dc00cea6f77d7ddf7f9cb: 18 components out of 3030 total are non-finite

    Line 215 in Verify - Geometry geom dee631821ad753ec9d9551c1fc86df9d: Index 41 has value 170 that reads non-finite value nan in channel 4, element 1

    Line 229 in Verify - Geometry geom dee631821ad753ec9d9551c1fc86df9d: 4 components out of 450 total are non-finite

    [PathTracer] Failed to add geometry for mesh 'pb_Mesh-30610'; mesh contains non-finite values.


    Any ideas what's going on here? I tried to google these errors but nothing came up. The issue started for me on 2020.2.4f1 and continues on 2020.2.5f. I'm using the Universal Render Pipeline 10.3.1 with Pro Builder meshes (4.5.0). I'm running MacOS 11.2.1

    Any help/leads on how to resolve this would be greatly appreciated!
     
  2. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    I actually just found out what the problem was. I had some broken pro builder prefabs in my scene that needed to be updated after I had changed the material on it.
     
    kristijonas_unity likes this.
  3. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    I'm getting the same thing now after trying to bake the lighting.

    I suspected ProBuilder's causes problems in a different section in Unity and I've reached a point where I don't really need it anymore so I decided to completely remove it from my project.
    That's actually helped my other issue but this "non-finite values" issue still persists.

    After doing some testings I realize this issue disappear after unticking "Contribute Global Illumination" under Lighting in the MeshRenderer component as shown below.
    Regardless of having a reflection\light probes in the scene.. whenever "Contribute Global Illumination" is ticked, I get those errors when trying to bake.

    BTW That mesh was generated using Dreamteck's Splines 2 asset, baked and then saved as a unity asset file.
    Then I composed a new prefab out of it and also using it as the mesh collider.

    Edit: The issue still persists when simply dragging the asset file to the scene, so it's not related to it being a part of a prefab or a mesh collider.

    upload_2021-4-14_12-42-6.png
     
    bhoffman67 likes this.
  4. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
  5. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    On which version this issue is fixed? I'm using LTS
     
  6. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    If you are asking about the bug discussed in the thread I linked, backports should have landed for 2019.4, 2020.3 and 2021.1 by now.
     
  7. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    Cool thanks I'll upgrade to 2020.3.8 when it'll be released
     
  8. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    Hey guys, I ran into this problem again on Unity 2020.3.8f1 and Pro Builder 5.0.3. I tried the "reimport all" option but that didn't help. Is there a way to search Unity to find what the problematic pro builder meshes are?

    For example can I search for this geometry in the inspector?
    "Line 215 in Verify - Geometry geom 412f49a43edc2d1fbb4385d3a9a33e00: Index 6 has value 8 that reads non-finite value inf in channel 4, element 0"

    If not, how else can I debug this?
    Thanks.
     

    Attached Files:

    bhoffman67 likes this.
  9. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Hey there. Backports for the fix in question should have landed for 2020.3 by now, so this is slightly concerning. Which of the lightmappers are you using (GPU/CPU), and does the issue occur with both?
     
  10. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    Hey thanks for getting back to me. I'm running Unity 2020.3.10f1 now and the issue still persists. I tried using both Progressive GPU and CPU. The only difference is that GPU only gives 1 error:
    [PathTracer] Failed to add geometry for mesh 'pb_Mesh-459464'; mesh contains non-finite values.

    It still fails however. All my other scenes bake just fine with CPU and use the same probuilder prefabs, so I'm really not sure why this one scene refuses to bake. Any tips/advice as to how I can debug this? If I have to manually inspect every probuilder object its going to be a nightmare, is there a way to isolate the ones that are causing the issue? Thanks.
     
  11. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    You might be able to find the problematic mesh with an editor script, I'm thinking something like this:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public class FindMesh : MonoBehaviour
    5. {
    6.     [MenuItem("Window/FindProblemMesh")]
    7.     private static void FindProblemMesh()
    8.     {
    9.         string meshName = "pb_Mesh-459464";
    10.  
    11.         var filters = FindObjectsOfType<MeshFilter>();
    12.         foreach (var filter in filters)
    13.         {
    14.             if (meshName == filter.sharedMesh.name)
    15.             {
    16.                 EditorGUIUtility.PingObject(filter.gameObject);
    17.                 break;
    18.             }
    19.         }
    20.     }
    21. }
    22.  
    If you manage to find it, please do post it and/or file a bug report with it included.
     
  12. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    Hi Pema,

    Thanks for the script. However, I couldn't get it to work. After plugging in the name of the affected mesh on line 9 and trying to open the FindProblemMesh window I get this error:
    NullReferenceException: Object reference not set to an instance of an object
    FindMesh.FindProblemMesh () (at Assets/Scripts/Utils/FindMesh.cs:14)

    Seems like its suggesting that the mesh name I gave it doesn't exist for some reason.
     
  13. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    I'm getting this issue with a file imported from Sketchup when trying to bake lightmaps

    "[PathTracer] Failed to add geometry for mesh 'Mesh StairStep'; mesh contains non-finite values."

    Sometimes if I edit the mesh a little it will fix itself and other times not. Sometimes I change one mesh and then it says another mesh (which was previously not a problem) is now a problem.

    Using progressive GPU and CPU in 2020.3.13 and 2020.3.14 (and 2020.3.12).


    Edit: I may have fixed it by adding a different material in sketchup to the meshes which were having problems. I don't know why that would fix this but it's baking...
     
    Last edited: Jul 20, 2021
  14. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    This is wrong though, it happens in 2021.1 and all 2021.2 betas
     
  15. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Hmm, I see. It might be that the backported fixes only addressed a subset of all issues that cause this behavior, or that it somehow regressed again. Probably the former. I'll try having another look at the relevant cases later this week, but until then, if you (or others in this thread) are still having issues, the best thing you can do is open another bug report.
     
  16. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Sorry it took me a while to see this message. I hope you solved your issues. It looks like the script I posted is missing some null-checks. If you still need, try it with line 14 changed from:
    Code (CSharp):
    1. if (meshName == filter.sharedMesh.name)
    To
    Code (CSharp):
    1. if (meshName == filter?.sharedMesh?.name)
     
    HoshimiyaSio likes this.
  17. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    We have some users getting these errors on meshes made in Sabre CSG. 2020.3.14f1

    "[PathTracer] Failed to add geometry for mesh "; mesh contains non-finite values."

    Is there a bug report already started for this?
     
  18. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Any update on this?
     
  19. swantonb

    swantonb

    Joined:
    Apr 10, 2018
    Posts:
    172
    2021.2.0b3 bakes fine. 0b4 doesnt, 0b5 didnt test yet, 0b6 will be testing very soon after it installs and let you know
     
  20. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Just to be clear, are you just getting the error messages, or is the bake somehow halting / stalling / causing a crash?

    I took a look at related bug cases and weren't able to repro them on the latest 2020.3 LTS. As far as I can see, there aren't any currently open cases related to this; they've all been resolved. If you are still having an issue and have a way to reproduce it, I suggest filing a bug report.

    Sorry for taking a while to get around to this :)
     
  21. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229

    It will completely halt the lightmap bake. It makes it seem like it's still going, but then it will bake forever. It will not go away until all faces of the mesh in question have a material/better UV(?).

    Where can I file the report/Is there already a ticket open for this that I can add to? I can probably include a model that will trigger the error.
     
    bhoffman67 likes this.
  22. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Just use the bug reporter built into the editor. It's in the top bar (Help -> Report a Bug). If QA finds it to be a duplicate of an open issue, the cases will be linked to eachother.
     
  23. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Okay I've reported it with a small project replicating it, issue: 1356776. The folder submission is recursive right?
     
    Last edited: Aug 10, 2021
    Pema-Malling likes this.
  24. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    I believe so. The project is also included automatically, IIRC :)
     
  25. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Good to know! Still occurs in 2020.3.16f1 unfortunately.
     
  26. sd_trent

    sd_trent

    Joined:
    Jul 1, 2017
    Posts:
    37
    Hi Pema-Malling,
    Unfortunately the only solution that worked for me was restoring the project from a previous backup. The only thing that I can think of that seemed to cause the issue in the first place was updating pro builder to 4.5.0. I wish I had more info on what caused this problem. Hopefully you guys can get it resolved. Thanks!
     
  27. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    Hello everyone,
    I just got the exact same problem in Unity 2020.3.17f1 with ProBuilder 4.5.2.
    After checking, I saw that ProBuilder was updated to 5.0.3. Should I try the updated version first, or just file a bug report @Pema-Malling ?
     
  28. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Any reproducible may be helpful, even if it turns out to be a duplicate issue. If it isn't too much hassle for you, I'd suggest filing a bug report with whatever means of reproducing you have currently.
     
  29. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    I submitted a bug report and project for it already that reproduces it 100%
     
  30. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    I submitted mine now: Case 1365591
     
    KEngelstoft likes this.
  31. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Customer QA is looking into this issue.
     
    memanishvili likes this.
  32. Donse10

    Donse10

    Joined:
    May 23, 2019
    Posts:
    2
    Hello, I had this issue too. The solution I found for my probuilder mesh (once I found which one threw the error) was to use the probuilder tool "UV Editor".
    First, I selected all the faces of the mesh using "ctrl+a", and then I opened the uv editor. Next, in the actions panel I pressed the button "Reset UVs".
    Finally, I just had to select the object again (in the editor) and use the probuilder tool "Lightmap UVs" to re-generate the UV2 (I guess?). Then, the ligthmap baked without any errors.
     
    kristijonas_unity likes this.
  33. joe_crawley

    joe_crawley

    Joined:
    Nov 22, 2020
    Posts:
    2
    I had this issue in Unity 2019.4.31f1, after updating probuilder to current version, I have sent off a bug report: IN-7501

    @Pema-Malling I tried your code to find the object the mesh was part of but nothing happened when I clicked "Find porblem mesh"