Archived post by inside_the_mind

Can you not just use a transform2d into a blend with a mask?

If you need them in a grid you can use a stamp points and add an attribute that controls which pattern goes where

Use a layer properties to assign whatever size you want to the stamp points

For anyone interested I submitted and RFE and the initial response was basically what Alex said as far as making segment by connectivity resolution independent. The official response: “`I’m not sure how this could possibly work.
Currently, when ids are collapsed, they will have the segments sorted by their bottom-left-most pixel. This makes for a consistent result cook-to-cook, but cannot possibly remain the same when you change resolution. When you increase resolution you change the shape of islands, that may change the order of the bottom left pixel.
In this case, the green & pink squares swap because the small square is slightly higher than the big square. But at lower resolutions this is not captured and so they tie, so the small square is sorted first. But at 4k, the big square gets the first id as it now is generated a pixel lower than the small square.
Any scheme imaginable will have this sort of tie breaking problem. And this assumes that the change in resolution doesn’t discover new islands that were missing in the low resolution; or join islands that were falsely separated by incomplete lines that now are revealed to not be joined in the high res.
The only solution is to pick an ideal resolution that you determine will author the “official” ids, and copy those into the high resolution segments“` And so I clarified to having a solution that allows the user to create a resolution independent mask that is based upon ID’s. I tried to clarify that this type of workflow is often not reliant on ID numbers as the locations of the masks are unlikely to change and so being able to just select locations where the ID’s reside would be perfectly acceptable and more resolution independent(you can still run into issues if islands are merged at lower resolutions but not at others. But adding an additional location selector would resolve that issue.)

This was the response to that: “`From our developers: The UV Map By ID in “Center” mode will output the center of each of the islands. So one could: a) resample to a fixed canonical size, segment by connectivity and collapse IDs to get the “official” ids. b) UV Map by Id to get the center of each island, layer to points with unqiue values to get a point per island and set its location to the center c) do the segment by connectivity in the high res size, uv map by id to get centers. d) For each segment in c), find the closest segment in b) and copy b’s id number over.
This probably can be made into an asset to make this approachable and deployable. You can still have surprises if the higher resolution causes islands to leak together, however, but it would avoid the re-sorting problem.“`

I felt this was not a great solution and I had already had the idea and started working on a location based solution. What I ended up doing to was basically taking a bunch of positions parms in OCL, looping over them and sampling the ID at that position and then setting any ID that didnt match any of the ID’s that were sampled to -1 and the rest to 1 and then doing a ID to mask with the ID field set to 1 as any ID’s at the selected locations would just be 1. This makes it more resolution independent as the only issue that should arise is if islands are merged at one res and not at a higher res. Simply upresing while selecting positions should totally alleviate this issue

Anyway that’s my ted talk. If you want to not worry about any of that here’s the HDA I built that does all that and also takes an optional point input that allows for some more procedural stuff if you are clever with things

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20264405/19/26/HouMats-ID_Sample_1.0F.hda