UVAtlas icon indicating copy to clipboard operation
UVAtlas copied to clipboard

Internal error: Closed surface not correctly partitioned

Open Silverlan opened this issue 6 years ago • 7 comments

When trying to call DirectX::UVAtlasCreate with a specific mesh, it consistently fails with a Closed surface not correctly partitioned error. I have uploaded an example project (including the data for the mesh in question) to replicate the issue here: test_uvatlas.zip The mesh is rather large, so UVAtlasComputeIMTFromTexture takes a few minutes to complete.

It works fine with other, simpler meshes.

Edit: I've tried it with another large mesh and got the same error. I have no idea what to look for, otherwise I'd try to narrow it down. Also, DirectX::UVAtlasComputeIMTFromTexture can take a few hours to complete, I'm not sure if that's normal.

Silverlan avatar Sep 26 '19 15:09 Silverlan

There are a number of these warnings before the failure:

Try to clean the non-manifold mesh, generated by partition

The DirectXMesh Clean and Validate methods are very useful for conditioning the mesh before you attempt to use UVAtlas.

https://github.com/microsoft/DirectXMesh/wiki/DirectXMesh#mesh-cleanup-and-validation

walbourn avatar May 30 '21 20:05 walbourn

There are a number of these warnings before the failure:

Try to clean the non-manifold mesh, generated by partition

The DirectXMesh Clean and Validate methods are very useful for conditioning the mesh before you attempt to use UVAtlas.

https://github.com/microsoft/DirectXMesh/wiki/DirectXMesh#mesh-cleanup-and-validation

@walbourn Hi Chuck,

I checked the codes and found that the UVAtlasTool already called the DirectXMesh Clean and Validate methods before calling the UVAtlasCreate, but for some meshes, I still got the "closed surface not correctly partitioned" error.

Does this mean there could be some non-manifold meshes that couldn't be fixed by the DirectXMesh Clean and Validate methods, and UVAtlasCreate would fail on those meshes?

Thanks!

chaohuang avatar Nov 08 '21 01:11 chaohuang

Right. meshconvert only calls Clean if you use -c, but uvatlas always calls it.

Do you get any warnings from Validate (which is called before Clean) or just from UVAtlas?

walbourn avatar Nov 08 '21 04:11 walbourn

Right. meshconvert only calls Clean if you use -c, but uvatlas always calls it.

Do you get any warnings from Validate (which is called before Clean) or just from UVAtlas?

Yes, I got warnings from Validate saying "bowties found" and "vertex dups". But I thought Clean would take care of those issues. I also got those warnings when processing others meshes, but UVAtlasTool worked fine on those meshes.

chaohuang avatar Nov 08 '21 04:11 chaohuang

Try hacking up your local copy of uvatlas to do the Validate again after the Clean. It seems like it's not fixing all the issues...

walbourn avatar Nov 08 '21 18:11 walbourn

Try hacking up your local copy of uvatlas to do the Validate again after the Clean. It seems like it's not fixing all the issues...

I put another Validate after Clean, and the message returned from the 2nd Validate is empty. I also test the Validate method with all available VALIDATE_FLAGS, and the results are the same: the Validate before Clean reports "bowties found" warning, and the one after Clean doesn't report anything.

chaohuang avatar Nov 08 '21 19:11 chaohuang

OK, so the Clean worked but there's some degenerate case in your model that's tripping up UVAtlas...

walbourn avatar Nov 08 '21 20:11 walbourn