Open hybridherbst opened 1 year ago
I'm getting this as well. Any thoughts on how to get around this? I get actual hashes though instead of 0s. Disabling models imported from GLTFast resolves this
Hi,
I cannot reproduce it, unfortunately. Do you mind giving me more details on your setup and steps to reproduce?
Example:
glTFast version?
Unity Editor version [e.g. 2021.2.1f1]
Render Pipeline and version [e.g. Universal Render Pipeline 12.0]
Platform: [e.g. Editor, Windows Player, iOS]
Device: [e.g. iPhone6]
GPU?
OS: [e.g. iOS8.1]
For WebGL: Browser [e.g. stock browser, safari]
I get a bunch of warnings like this though:
'p.038': Invalid Mesh was removed from light baking input due to failure code: 'Failed creating Mesh'.
or:
'p.3188': Instance using invalid Mesh was removed from light baking input. This instance will not be lit by or affect baked lighting.
Also this:
There are 24 objects in the Scene with overlapping UV's. Please see the details list below or use the 'UV Overlap' visualisation mode in the Scene View or Lightmaps in Lighting Settings for more information.
- s.2809_Thicken: 480 texels
- s.2844: 79 texels
- s.2842: 74 texels
- s.2850: 74 texels
- s.2841: 69 texels
- FussWurzel: 32 texels
- s.2851: 31 texels
- s.2834: 24 texels
- s.2814: 22 texels
- s.2811: 20 texels
- p.2865: 18 texels
- s.2830: 16 texels
- s.2824: 12 texels
- s.2853: 12 texels
- s.2837: 11 texels
- s.2828: 10 texels
- s.2825: 10 texels
- s.2831: 8 texels
- s.2827: 8 texels
- s.2829: 8 texels
- s.2833: 6 texels
- s.2835: 6 texels
- p.2866: 4 texels
- s.2836: 3 texels
Please see this webpage for more information about objects with overlapping UVs:
https://docs.unity3d.com/Manual/ProgressiveLightmapper-UVOverlap.html
Might be totally unrelated though.
For me specifically, I'm on 2022.3.27f1 Platform/target: windows URP Ooooolldd version of gltfast: 4.6.0 Hoping to upgrade soon.
I fixed the problem for me at least. 3DSMax is messing up it's GLTF export. It was creating a bunch of empty UV channels. Color data was getting put on UV1 while UV0 remained empty (or some of it looked like literal garbage? Not sure)
I wrote a small script to remove all empty UV0 channels, move UV1 to UV0, and delete UV1. After this. Lightbaking worked!
@EliCDavis Once you found time to upgrade, would you be willing to certify it resolves the problem (without the need to run your fixing script)? That would allow me to close the issue.
Thanks.
Idk when I'll be able to upgrade, so I created an empty unity project and tried it, and it still fails
OS: Windows 11 Build Target: Windows, Mac, Linux Unity: 2022.3.27f1 Universal RP: 14.0.11 GLTFast: 6.7.1
there are some warning in the import, not sure if that could help out
Awesome, I must have missed a step because now I can reproduce it properly.
For some reason the Generate Lightmap UVs setting only calculates lightmap UVs if the original mesh does not already have a second UV set. That's confusing and arguably a bug. I'll change that behavior with a hint in the tool tip that this will replace an existing secondary UV set.
The sample files @hybridherbst provided come with secondary UVs that seem to be unfit for lightmapping (occupy no area or overlap), so I assume they trigger some light baking issues.
Unfortunately actually recalculating the UVs ultimately results in the same error, as the freshly calcuated UVs also have overlaps:
I think this is because the topology is not very clean and vertices are not connected all over the place.
The only safe way to ensure baking will work is to have proper lightmap UVs setup.
The next best solution would be to clean up your meshes, so that the UV recalculation does not produce garbage.
And I'd also recommend filing issues via Unity bug reporter directly in case the UV calculation does stupid thing (which it arguably does).
As @hybridherbst mentioned, the same meshes work fine when imported via FBX, so there's more to it.
Thanks
Well, glTFast calclated lightmap UVs with garbage parameters 🤦
edit: False negative...It used defaults all along.
Using proper defaults improves the UVs, but does not prevent the error. There's still discrepancy with FBX's output :/
I believe I made a bug report in the past about meshes exploding during UV generation in Unity, not sure if that's related.
Relevant UnityGLTF issues:
Describe the bug This is most likely a Unity bug, not a glTFast bug, but I've only ever seen it happen on glTFast-imported meshes. The same mesh as FBX or imported with UnityGltf works fine.
Unity bug report is here: IN-31231 - [Lightmaps] "Failed to find geometry with hash" logged for imported meshes when attempting to bake lighting
Files Assets.zip
To Reproduce Steps to reproduce the behavior:
Failed to find geometry with hash 0000000000000
logged thousands of timesScreenshots
Desktop (please complete the following information):
additionally (if significant for the bug):
Additional context IN-31231 - [Lightmaps] "Failed to find geometry with hash" logged for imported meshes when attempting to bake lighting