Accessing UV Islands
Accessing UV Islands
Hi,
Is there someway to get a list of UV islands through any scripting/complied language in XSI?
We can select islands easily from the UV editor UI but I don't know why this feature is not exposed to the SDK
Thanks!
Is there someway to get a list of UV islands through any scripting/complied language in XSI?
We can select islands easily from the UV editor UI but I don't know why this feature is not exposed to the SDK
Thanks!
Re: Accessing UV Islands
Hi Homam,
I think the texture editor might just be looking for polygons that are connected by their uv's each time. It should be a quick lookup, maybe it's using a UV->polygon lookup table, then it's even faster.
I've got this compound which initializes an attribute per node that you can read to get a polygon island id. (Set the checkmark to use its 'uv' mode)
I think the texture editor might just be looking for polygons that are connected by their uv's each time. It should be a quick lookup, maybe it's using a UV->polygon lookup table, then it's even faster.
I've got this compound which initializes an attribute per node that you can read to get a polygon island id. (Set the checkmark to use its 'uv' mode)
- Attachments
-
- Initialize Islands.xsicompound
- (50.4 KiB) Downloaded 153 times
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
Thanks rray! your ICE compound does the trick.
Re: Accessing UV Islands
Good to hear it works with that
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
Sorry, how do I use this compound ?
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Accessing UV Islands
It sets an Attribute NodeIslandID,
you can use it to detect the island of a sample/node like this
you can use it to detect the island of a sample/node like this
Code: Select all
var selected_samples = Selection(0);
var selected_samples_coll = selected_samples.SubComponent.ComponentCollection;
var selected_obj = selected_samples.SubComponent.Parent3DObject;
var ICEAttr = selected_obj.ActivePrimitive.Geometry.GetICEAttributeFromName("NodeIslandID");
var ICEAttr_array = new VBArray( ICEAttr.DataArray ).toArray();
var oldAlwaysEvaluated = ICEAttr.AlwaysEvaluated;
ICEAttr.AlwaysEvaluated = true; // forces evaluation of attribute
for(i=0; i<selected_samples_coll.Count; i++)
logmessage("Selected Sample "+selected_samples_coll(i).Index+" is on island "+ ICEAttr_array[selected_samples_coll(i).Index]);
ICEAttr.AlwaysEvaluated = oldAlwaysEvaluated;
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
Thanks for the code !
I've found my problem.
The XSI Man I was using as a test has it's Texture Projection named 'UV' so the compound was red and didn't give me the results I expected.
I was using a recursive function to get islands, but it was pretty slow. Your ICE solution seems to be the solution. With this I may be able to reproduce a tool I wrote in Maya to check the distance between islands to avoid bleeding when using mipmapping. I wish I was more "fluent" in ICE...
Thanks again
I've found my problem.
The XSI Man I was using as a test has it's Texture Projection named 'UV' so the compound was red and didn't give me the results I expected.
I was using a recursive function to get islands, but it was pretty slow. Your ICE solution seems to be the solution. With this I may be able to reproduce a tool I wrote in Maya to check the distance between islands to avoid bleeding when using mipmapping. I wish I was more "fluent" in ICE...
Thanks again
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Accessing UV Islands
You're welcome! Yes would've been useful to have a "get main UV" node in ICE for the main UV instead of having to select a specific one by name.
If it's applied in scripting there's at least a chance to set it inside the compound.
If it's applied in scripting there's at least a chance to set it inside the compound.
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
I'm using your compound and it works perfect ! Can i use it in my plugin (mTextureEditor) ?
I wanted to use it for UV borders too, but it doesn't work well for that when the UV island are overlapped and folded in the middle like a XSI man head, sadly.
I guess I'll have to script something because I have no idea how to do it in ICE
I wanted to use it for UV borders too, but it doesn't work well for that when the UV island are overlapped and folded in the middle like a XSI man head, sadly.
I guess I'll have to script something because I have no idea how to do it in ICE
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Accessing UV Islands
Great! Feel free to use it!
About uv mode, the compound would have to check each edge if its neighbor uv polygons are on the same side of the edge.
It's tricky however finding the exact meaning of "same side" (considering weird formed polygons)
Do you think checking the uv polygon centers is enough?
About uv mode, the compound would have to check each edge if its neighbor uv polygons are on the same side of the edge.
It's tricky however finding the exact meaning of "same side" (considering weird formed polygons)
Do you think checking the uv polygon centers is enough?
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
I wouldn't mind if it doesn't support bad geometry or broken UVs. I was thinking in taking just one point of the neighbour polygon uv coordinates and triangulate with the edge, but centers would probably be better.
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Accessing UV Islands
Center turned out to be not so great because the polygon center can easily move on the other side of the edge if it's a 4+ sided polygon. I think testing 2 points very close to the edge and check if they're inside the 2 uv polygons is better
I'll try to put together a new compound tonight.
(The house shaped part in the bottom right became it's own island because the center of the polyon above it is below the roof...)
I'll try to put together a new compound tonight.
(The house shaped part in the bottom right became it's own island because the center of the polyon above it is below the roof...)
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
There's a new tolerance settings that can deal with little errors in the uvs:
- Attachments
-
- Initialize Islands.2.0.xsicompound
- This ones test for folds using the other method. Should be fine for most cases.
- (239.08 KiB) Downloaded 151 times
-
- RandomColorByUVIsland.xsicompound
- can be used to check islands
- (17.53 KiB) Downloaded 147 times
softimage resources section updated Jan 5th 2024
Re: Accessing UV Islands
awesome I’ll try it as soon as I can ! thanks !
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Who is online
Users browsing this forum: No registered users and 68 guests