PDA

View Full Version : display uv map border


jschieck
10-19-2010, 05:46 PM
trying to find out a way to ALWAYS get just the uv border edges for an object. obviously:

PolySelectConvert 4;
polySelectBorderShell 1;
PolySelectConvert 20;

works most of the time, but if two edges share uv's it'll also select the edge in the middle. also tried finding the shortest distance between uv's, but `ls -sl -fl` returns them in numerical order not in an order around the border, which also occasionally messes things up.

was looking for how maya displays the map border edges in the viewport with polyOptions -displayMapBorder somewhere in the API but couldn't find it. any idea where i can get access to that data?

ewerybody
10-20-2010, 11:26 AM
PolySelectConvert 4;
polySelectBorderShell 1;
PolySelectConvert 20;Thats a really tough problem you got there! :D
I tryed a few approaches but it all didn't yield a rock solid solution. I'm curious if someone else has some ideas.

First I didn't know what you mean with "if two edges share uv's". Then I realised you mean at a 1 edge wide area. When 2 border UVs are connected through an edge that is not at the border.

But what do you need the edges for anyway? Edges are 3D data. UVs are 2D.

jschieck
10-20-2010, 03:16 PM
yea at first I was thinking, "man this will be simple!" but then it turned into many failed approaches because of low poly game models having many areas that are 1 edge wide.

trying to simply grab all the seams and harden edges for baking normal maps right now, but it's bugged me for awhile.

r4inm4ker
10-20-2010, 04:10 PM
I think this will do the trick, taken from one of my scripts:


{
string $currSelected[] = `ls -sl -o`;
string $temp[] = `ls ($currSelected[0]+".map
")`;
select $temp;


polySelectBorderShell 1;
PolySelectConvert 20;

string $potentialEdges[]=`filterExpand -ex 1 -sm 32`;

string $removedEdges[];

for($eachEdge in $potentialEdges)
{
string $uvs[] =`polyListComponentConversion -fe -tuv $eachEdge`;
$uvs = `ls -fl $uvs`;
if(size($uvs)<=2)
$removedEdges[size($removedEdges)] = $eachEdge;
}
select -d $removedEdges;

}

jschieck
10-20-2010, 05:45 PM
oooo very nice man! :applause:

ewerybody
10-20-2010, 06:30 PM
so you assume that if the converted UVs from each edge are <= 2 it would have to be a false one?

hmm I'm afraid no. that doesn't do it :/
the mystery keeps unsolved :D

jschieck
10-20-2010, 07:40 PM
works fine for me in the tests that I've done so far. what kind of case wouldn't it work with?

ewerybody
10-20-2010, 10:16 PM
At first I actually had the opposite problem: I couldn't find a case where it would work! But now I did it again with a proper mapped 3D Model and I have to say: Yes! this is quite feasible at a closed mesh: If every edge on the mesh shares 2 faces a UV-border edge MUST have 4 UVs.

But just create a plane (any divisions), run the script: everything is deselected. Or create a bridge 1 edge wide at any model...

But this brings me to the simple idea: We just have to substract the 3D border edges from the ones we would want to deselect!

I've set this up freshly and seems it solves all my cases as well:bounce::{
string $sel[] = `ls -sl`;

// find 3d borders edges:
select `polyListComponentConversion -te`;
polySelectConstraint -type 0x8000 -m 2 -w 1;
polySelectConstraint -m 0 -w 0;
string $borderEdges[] = `ls -fl -sl`;

// get border uvs :
select `polyListComponentConversion -tuv $sel`;
polySelectBorderShell 1;

// get edges and find enclosed ones
string $edges[] = ls("-fl",`polyListComponentConversion -in -fuv -te`);
string $deselEdges[];
int $num;
for ($edge in $edges)
if (size(ls("-fl",`polyListComponentConversion -fe -tuv $edge`)) == 2)
$deselEdges[$num++] = $edge;

// now subtract the 3d border edges from the found ones
$deselEdges = stringArrayRemove($borderEdges,$deselEdges);
$edges = stringArrayRemove($deselEdges,$edges);

select $edges;
}

but on another topic: You just posted the snipped from r4inm4ker completely unchanged and technically uncommented over at your blog. Ok.. I mean you probably publish your stuff as well freely. Thats cool. But wouldn't a 'via' link or mentioning be nice?
I'm not the software patent guy. And its just a snippet. But it doesn't hurt to tell where you gut stuff from. .. but ok I don't know if you asked him already ;]

jschieck
10-20-2010, 10:56 PM
ah i see the the problem u were having. good stuff. by no means did i mean to steal it, just thought i'd share it. i'll throw up a link to the thread haha :P

r4inm4ker
10-21-2010, 01:01 AM
At first I actually had the opposite problem: I couldn't find a case where it would work! But now I did it again with a proper mapped 3D Model and I have to say: Yes! this is quite feasible at a closed mesh: If every edge on the mesh shares 2 faces a UV-border edge MUST have 4 UVs.

But just create a plane (any divisions), run the script: everything is deselected. Or create a bridge 1 edge wide at any model...


well,actually the purpose of the codes I posted above is to find UV seams (uv borders that are not border edge). To find edge borders, I used this:


polySelectConstraint -mode 3 -type 0x8000 -where 1;
string $selectedEdge[] = `ls -sl`;
polySelectConstraint -disable;


ah i see the the problem u were having. good stuff. by no means did i mean to steal it, just thought i'd share it. i'll throw up a link to the thread haha :P

A link to this thread is enough, I guess :).

CGTalk Moderation
10-21-2010, 01:01 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.