BrandonRiza
July 19, 2018 17:02:07
Hello.
I'm splitting very dense meshes up with an Attribute VOP, re-UVing the resulting mesh sections, then arraying those UVs into UDIM space. I'm outputting both a re-welded single mesh in addition to all of the mesh sections themselves as a sequence of OBJ files. I need to name each OBJ file in that sequence based on what UDIM tile the mesh occupies; such as “Mesh_1001.obj”, “Mesh_2005.obj”, etc. The attached images show the meshes arrayed in UDIM space and the Subnet i'm (currently) using to both control the output amount and name the meshes. I'm not sure how to go about pulling in the UDIM tile data and assigning it to the mesh name. Is this something i'd do in my current Attribute Wrangle? Any pointers would be much appreciated.
Thanks…
tamte
July 19, 2018 17:39:58
1. Attribute Promote you uv attribute from Vertex (or if your uvs are Point from Point) to Primitive level as Average
- uncheck Delete Original
2. in your Prim wrangle do:
int udim = 1001 + int(v@uv.x) + int(v@uv.y)*10;
s@name = sprintf("udim_%d", udim);
3. you can delete prim uv attrib if you don't need it anymore
tamte
July 19, 2018 17:43:11
I guess easier without promoting would be just purely doing this
1. Prim Wrangle:
vector uv = primuv(0, "uv", @primnum, set(0.5, 0.5, 0));
int udim = 1001 + int(uv.x) + int(uv.y)*10;
s@name = sprintf("udim_%d", udim);
jsmack
July 19, 2018 19:59:58
There is also the texprintf() function that lets you skip the udim calculation step.
vector uv = primuv(0, "uv", @primnum, set(0.5, 0.5, 0));
@name = texprintf(uv.x, uv.y, "%s_%(UDIM)d", "udim");
BrandonRiza
July 23, 2018 18:43:22
Thanks for the replies, guys. I appreciate the input.
I've made a sample file and verified that the name attrib is jiving with the number of UDIM tiles (reads 4 unique strings…duping the tiles and feeding them into the merge yields 8…), but how would you guys go about spitting out these four tiles into a sequence of bgeo files?
1001.bgeo
1002.bgeo
1003.bgeo
1004.bgeo
Cheers, and thanks.
tamte
July 24, 2018 00:36:07
you can for example loop over the name attrib and use File SOP in Write mode to write each iteration to separate file
or as in this example, create filename attrib based on udim and use that directly as a path for each file in a loop
BrandonRiza
Aug. 1, 2018 13:41:13
Thanks for your input, guys!