Jump to content
squardis

search and check for UV's in scene

Recommended Posts

Hi, I have large scene with alot of geometry wher some have UV's and some who doesnt.
I imported the whole scene as one obj file so it thinks it has UV's.

I know there is a way to determine if it has to uv's
I saw in the simple baker that it has a switch that unwraps the model if it doesnt have any:
haspointattrib(0, "uv")||hasvertexattrib(0, "uv")

But this doesnt work. because it has a attribute uv, which is empty on some object.

Is there another way to look for objects that doesnt have uv's? or where the uv attr views none uv's?

thnx

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

One way is to use a for-each loop with connectivity. Make an attribute on your geo that checks the length of the uvs. Promote that attribute to detail twice, where one is set to maximum, and one to minimum. Compare the values, and if they are equal, its likely that there is no uvs.

  • Like 1

Share this post


Link to post
Share on other sites

...or in vertex wrangle:

i@hasuv = 0;
float test = max(uv);
if(test >0)
{@hasuv = 1;}

that should generate and attribute with values 0 for vertices with no uvs and 1 for verts with uvs. if you promote to primitive you can isolate polygons.

Edited by davpe
  • Like 1

Share this post


Link to post
Share on other sites

Thank you both!!
The wrangle is realy easy to read!  It should be:
float test = max(@uv);

Also it gave me by testing it on a unwrapped cube one value on the spreadsheet of 0.
But by promoting it, it luckely disappeared. Hopefully it works on the rest of the stuff now.

uhmmm... damn nope it didnt realy worked as expected...

there are some objects that are just getting deleted who has uv's.

if(test != 0) // did some fix too.. Im almost there :)

float test = abs(length(@uv)); //gives me also some result for uv's that are placed in a negative uv sheet:

i@hasuv = 0;
float test = abs(length(@uv));
if(test > 0)
{@hasuv = 1;}

 

Now Im almost there... How to find overlap procedurally?
Any idea?

 

 

 

 

scene2_uvCleanUp-ViaWrangle.hip

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×