mkazhdan / TextureSignalProcessing

Gradient-Domain Processing within a Texture Atlas
69 stars 13 forks source link

node covered by 2 triangles exception #11

Closed maorp closed 3 years ago

maorp commented 3 years ago

hi, I'm getting: [EXCEPTION] InitializeGridChartsActiveNodes: Node ( 662 , 344 ) covered by two triangles: 6567 6536 checked the 2 specific triangles UV coords and they look ok - they are not mapped to the same area. just to make sure - do the ids in the exception relate to the original input face indices? I'm attaching data. thanks for any help. test1104_orig.zip

mkazhdan commented 3 years ago

I believe that the problem is that both triangles share vertex 22821. However, they are not in the same chart. That is, they cannot be connected through a sequence of shared edges. (Specifically, the two nodes corresponding to the triangles in the dual graph are not connected.)

maorp commented 3 years ago

thanks for the quick response! checked verts for faces 6567 and 6536, i get different indices from you, they share an edge and it happens when InitializeGridChartsActiveNodes process the same chart (as identified internally in the function before in buildAtlasMesh) verts 6567: 17398 24459 10427 verts 6536: 10427 15403 17398 how do you debug the mesh manifoldness and charting? do you have a tool i can use?

mkazhdan commented 3 years ago

Can you confirm that? I'm reading Mesh.ply and am getting: triangle[6567] = ( 24458 , 11445 , 22821 ) triangle[6536] = ( 22821 , 28398 , 22535 )

Though visualizing the connected components is tricky, you can try opening the file Mesh.ply in MeshLab and then selecting Filters -> Selection -> Conditional Face Selection and then specifying (fi == 6536) || (fi==6567) That should highlight two triangles on the upper/outer left leg. You can see that they share a vertex, but it does look like there is something funny going on there.

maorp commented 3 years ago

had a weird bug reading the mesh... anyway the mesh needs repairing. does it have to be watertight? thanks for the help and for the amazing algo.

mkazhdan commented 3 years ago

That's a good question. I think the method will work work if the mesh is not water-tight. However, it is not explicitly enforcing either Dirichlet or Neumann boundary conditions.

maorp commented 3 years ago

I'm checking with a high poly mesh without bad faces and get another exception: Hierarchy structure = 3.6620 Hierarchy prolongation and restriction = 3.2210 Boundary coefficient initialization = 0.9870 Hierarchy construction = 7.8710 [EXCEPTION] LoopVertices: Non-simple loop, node 61297773248511

seems to happen when accumulating one of the charts boundary attached data. mask.zip

maorp commented 3 years ago

oh i saw the closed issue with an explanation on non loop. ill go thru it.

mkazhdan commented 3 years ago

While I got this message via email, I cannot seem to find it on GitHub.

Has it been resolved?

-- Misha

From: maorp @.> Sent: Monday, April 19, 2021 5:12 AM To: mkazhdan/TextureSignalProcessing @.> Cc: mkazhdan @.>; Comment @.> Subject: Re: [mkazhdan/TextureSignalProcessing] node covered by 2 triangles exception (#11)

Hi, checked the problematic chart, I cant see any non simple loop (triangles that meet at one vertex). plotted the atlas in wireframe and checked manually the boundary for badness. here is a zoom on the first chart (first large connected comp from above, "shoe sole"), it happens immediately on the first. attached the data again. https://user-images.githubusercontent.com/11231999/115211097-e98b5e00-a107-11eb-8cdd-87a14cec8464.png https://user-images.githubusercontent.com/11231999/115211107-ec864e80-a107-11eb-9555-030aa0ed0b5f.png mask.zip https://github.com/mkazhdan/TextureSignalProcessing/files/6334704/mask.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mkazhdan/TextureSignalProcessing/issues/11#issuecomment-822308788 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACS5ZZPPAXAMDKN6LQX2R23TJPXURANCNFSM423T5OAA . https://github.com/notifications/beacon/ACS5ZZLMUZNCEO6TDGNDFE3TJPXURA5CNFSM423T5OAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGEBW7NA.gif

maorp commented 3 years ago

yes. had problems with my old atlas (charts with holes). moved to use UVAtlas and now it works. I have another interesting issue, but maybe its because I'm doing something hacky... my mask has only 3 values - essentially all charts are the same source (white value) with some black holes for occluded areas and gray for the background. I get strong gradients on some seams. see the hand. test210421_orig.zip attached data if you want to take a look. sometimes playing with the interpolation value (set to 1000) helps in this seam but blends bad color into other areas. image

maorp commented 3 years ago

Hi, to clarify a bit the previous comment - I'm essentially trying to do only inpainting. is there another, less hacky way to do it?

maorp commented 3 years ago

Hi, update - I tried also with a correct composite and with multi option (just to check my hack mask is not the problem) and still i get strong gradients on seams. attached data, composite and multi. masks.zip texels00to08.zip texels09to15.zip Mesh210421.zip image with seams visualized: image

mkazhdan commented 3 years ago

I see. You're right, there definitely should not be a gradient along the seam. Let me try to look into it.

mkazhdan commented 3 years ago

boundary Mesh210421.zip The problem is that the mesh you are providing is not water-tight. As a visualization, I have included an image of your mesh, with boundary edges turned on. As you can see the different charts correspond to different disconnected components of the mesh. As a result, there is no stitching across the chart boundaries. To fix this, you need to merge the patches along the seams. (Since texture coordinates are stored with faces, not vertices, this will not affect the texture-mapping. You can do this, for example, by opening your mesh in MeshLab, select Filters -> Cleaning and Repairing -> Merge Close vertices, and specifying a very small percent threshold. (I believe I used 0.01%.) I have attached the result I got out of MeshLab. When I ran with that, there was no longer a seam. (Though I did have to use the --jitter parameter to avoid the problem with a singular matrix.)

maorp commented 3 years ago

Great! looks like UVAtlasTool duplicates vertices on the chart boundaries. Thank you very much for taking the time to debug it. It works now even with the hacky mask.