CinnamonMetal Posted January 22, 2021 Share Posted January 22, 2021 (edited) I'm promoting the vertex uv attribute to each their own detail attribute using an attribute promote; except now I want to fit the values from these two detail attributes. Therefore I'm running the following code in a detail wrangler; although I'm not getting the result which I want ? vector newUV = fit(1,@min_u,@max_v,0.0,1.0); Edited January 22, 2021 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 22, 2021 Share Posted January 22, 2021 maybe check your params usually it's old_min, old_max, new_min,new_max but your 1st 2 params are BOTH max AND they're different (ie. one is u and one is v), maybe the max_u should really be min_v so min_v,max_v,0.0,1.0 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted January 22, 2021 Author Share Posted January 22, 2021 I corrected the parameters which I posted in my original post. Although the fit() function has five arguments; the first argument is what I don't know if what I'm entering is correct ? Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 22, 2021 Share Posted January 22, 2021 (edited) 18 minutes ago, CinnamonMetal said: I corrected the parameters which I posted in my original post. Although the fit() function has five arguments; the first argument is what I don't know if what I'm entering is correct ? oh sorry for the confusion, when i said first 2 i meant your min_u and max_v. Now that the actual 1st param is mentioned, i think that should be your "variable" (ie. the THING you are trying to remap) So don't think it should be the literal 1 but should be your @myattrib... float fit(float value, float omin, float omax, float nmin, float nmax) <vector> fit(<vector>value, <vector>omin, <vector>omax, <vector>nmin, <vector>nmax) (note in your case, you need to feed it new vectors, not 0.0 and 1.0) Edited January 22, 2021 by Noobini Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted January 22, 2021 Author Share Posted January 22, 2021 I don't have a vector variable for the first parameter; only two detail attributes which I split and promoted from the vertex attribute uv. I tried the @P attribute but that won't have any effect on vertices; only attempted because it's a vector. Quote Link to comment Share on other sites More sharing options...
Noobini Posted January 23, 2021 Share Posted January 23, 2021 5 hours ago, CinnamonMetal said: I don't have a vector variable for the first parameter; only two detail attributes which I split and promoted from the vertex attribute uv. I tried the @P attribute but that won't have any effect on vertices; only attempted because it's a vector. here, take a grid, uv it normally so all vertices fit into 0-1 space, seen by the red circles. These vectors range from {0,0,0.5} to {1,1.0.5} dunno why the last component is 0.5, not an expert. then remap these vectors to say...double it v@uv = fit(@uv,{0,0,0.5},{1,1,0.5},{0,0,0.5},{2,2,0.5}); as you can see with the templated white lines Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 23, 2021 Share Posted January 23, 2021 Hi Christopher, you can maximize UV islands or the entire coordinate set by temporarily transferring the UV coordinates to world space where they can be fitted and transformed more easily. uv_maximize.hipnc Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 23, 2021 Share Posted January 23, 2021 (edited) However, if the world space route has no advantages for your project, you can also keep the transformation work within vertex attributes entirely. maximize_vertex_attributes.hipnc Edited January 23, 2021 by konstantin magnus Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted January 23, 2021 Author Share Posted January 23, 2021 (edited) When promoting uv from vertex to point as P, my mesh becomes completely tangled after the vertex split; as your example @konstantin magnus ? It would be because the UV are outside of the 0-1 ? v@bbox_min = getbbox_min(0); v@bbox_max = getbbox_max(0); f@fituv = (float)fit(@uv,@bbox_min[0],@bbox_max[0],0,1); f@fituv = (float)fit(@uv,@bbox_min[1],@bbox_max[1],0,1); f@fituv = (float)fit(@uv,@bbox_min[2],@bbox_max[2],0,1); The above is getting me the bounding box for all three values for the min/max but how can I set them so that the UV fit within the 0-1 range. The above was what I had planned. Edited January 23, 2021 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted January 25, 2021 Author Share Posted January 25, 2021 Is it not possible to have a UV layout sop after the file; then get the island attribute and use that in a forEach sop and then move each island to a different udim using a transform sop within the foreach sop ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.