randomize copy with transform pieces

   1460   2   0
User Avatar
Member
8 posts
Joined: Nov. 2017
Offline
Hello
my first time posting in this forum
would like to know if the transform pieces node allows u to assign random object to points

Attached is my tree

any help will be appreciated

thanks

Attachments:
Screenshot 2021-05-30 134834.png (308.0 KB)

User Avatar
Member
52 posts
Joined: June 2016
Offline
You have several ways to randomize instances :

1) first, you can use an Instance node with your points cloud. Add a s@instance attribute on point with an attribute randomize for example, and put the instances you want, but they must be Objects (like "/obj/geo1")

2) you can use the node "instance" inside a geometry node, and use the s@instancepath attribute.
It can be a path on your disk OR a "op:/obj/geopath/" value.




3) you can merge your packed models with a merge node, but first, add a unique integer attribute (like "variant").
then "attribute randomize" this variant attribute onto your pcloud
finally, you create a "for loop" on each point and check if the "variant" attribute of your model "bank" (the merge node) correspond to the "variant" attribute of the incoming point in the loop, then you delete all models that don't match the attribute and keep only the good instance. Then distribute the instances with a "copy to point" node. You can do this with a wrangle node inside where 1st input is the "merge" node and second input is the incoming point of the "for loop"

int variant_pt = point(1, "variant", 0);
int variant_model = i@variant;

if (variant_model != variant_pt)
{
     removepoint(0, @ptnum, 1);
}

Attachments:
instances.JPG (39.6 KB)

User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
There's also Attribute from Pieces.

https://www.sidefx.com/docs/houdini/nodes/sop/attribfrompieces.html [www.sidefx.com]

Transform pieces only moves the pieces. The copies/instances must be created first. The copy sop can move and create in one step, but it's also possible to create the copies and then move with transform pieces afterwards.
Edited by jsmack - June 5, 2021 03:56:26
  • Quick Links