Determine if there is UV overlap on a single mesh/shell

I am working on a script to evaluate and report if a UV overlaps any other in a mesh. I found some great info on it if I was testing for multiple shells in a single mesh but nothing really helps when comparing each UV within a mesh. I am writing in Python and working in Maya 2014.

thanks,

MO

If you want to check if a UV point is inside another UV shell, you could try something like this:

  1. get all the UV shells
  2. make a dictionary tying each vertex to a particular shell
  3. get all the shells your point is NOT part of…
  4. for each shell , get the UV bounding box with polyEvaluate -bc2
  5. for any shell where your point is inside the bounding box, try the same thing with each UV face
  6. you’ll probably get multiple hits (the bounding boxes are usually bigger than the UV faces)…
  7. for each hit, you’ll need to do a detailed 2d point-in-poly check. You can code this yourself but it’s easier to use a free module like Planar.

I’ve had to do this in the past. I started off using python cmds (it was really really slow), then python API (better but still too slow on large meshes). Eventually another tech artist re-wrote it with c++ and now it is super fast.

Just checking UVs against other shells won’t find overlaps within the shell itself.

You’ll need to do a point inside poly check, but also a check for intersections. I recommend working with a copy of the mesh that has been triangulated.

Any possibility of getting this source code?

[QUOTE=rgkovach123;24006]I’ve had to do this in the past. I started off using python cmds (it was really really slow), then python API (better but still too slow on large meshes). Eventually another tech artist re-wrote it with c++ and now it is super fast.

Just checking UVs against other shells won’t find overlaps within the shell itself.

You’ll need to do a point inside poly check, but also a check for intersections. I recommend working with a copy of the mesh that has been triangulated.[/QUOTE]

MO

Unfortunately I cannot share the source code, but you should be able to find triangle intersection and point inside triangle stuff online.