Randomly choose between mutliple source objects for Greeble
2045 5 1- Damn_daniel
- Member
- 4 posts
- Joined: Sept. 2019
- Offline
Hi!
I'm trying to make a greeble tool, but I can't proceed on because I can't instantiate the different source objects to the subdivided grid that I have. I have created six variations of a grid, which I have called GreebleObjects, which I want to be placed randomly on the grid. The problem is in the delete under the object merge, instead of obeying the expression inside the delete group to choose only one Greebleobject, they all appear at once. Could someone tell me what's going wrong?
I attached the .hip file
Thanks!
I'm trying to make a greeble tool, but I can't proceed on because I can't instantiate the different source objects to the subdivided grid that I have. I have created six variations of a grid, which I have called GreebleObjects, which I want to be placed randomly on the grid. The problem is in the delete under the object merge, instead of obeying the expression inside the delete group to choose only one Greebleobject, they all appear at once. Could someone tell me what's going wrong?
I attached the .hip file
Thanks!
- Enivob
- Member
- 2529 posts
- Joined: June 2008
- Offline
What about something like this….
Construct a string attribute that randomly programs the ObjectMerge.
Construct a random part for each primitive using VEX.
Reference the attribute using the hScript prims function.
Construct a string attribute that randomly programs the ObjectMerge.
Construct a random part for each primitive using VEX.
int index = int(fit01(rand(@primnum+ch("seed")),1,7)); s@obj_path = sprintf("/obj/GreebleObjects/grid%d",index);
Reference the attribute using the hScript prims function.
`prims("../foreach_begin1/",0,"obj_path")`
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- Damn_daniel
- Member
- 4 posts
- Joined: Sept. 2019
- Offline
- mestela
- Member
- 1737 posts
- Joined: May 2006
- Online
An alternative way is to make use of copytopoints and its new ability to support variants; if the incoming points have a @variant attribute, it looks for the matching @variant on the shapes to copy, and only copies that geometry onto the point.
I've attached 2 setups, one which inserts a variant workflow onto your existing setup which is a little hacky, and another one using copytopoints and some labs tools to make setup a little easier. Added a few things into that second setup to add random rotation and stuff, and it support 3d shapes (try swapping the grid for the sphere or box at the top of the network).
I've attached 2 setups, one which inserts a variant workflow onto your existing setup which is a little hacky, and another one using copytopoints and some labs tools to make setup a little easier. Added a few things into that second setup to add random rotation and stuff, and it support 3d shapes (try swapping the grid for the sphere or box at the top of the network).
- Damn_daniel
- Member
- 4 posts
- Joined: Sept. 2019
- Offline
Thank u Mestela! I like it because it seems simpler than using vex, but the @variant attribute doesn't work for me, it appears a warning on the attributecreate where you create the @variant that says “Unexpected integer precision”. Maybe this attribute can not be run in Houdini 17.5. Also I get some problems with the lab tools beacause of the version.I attach a screen capture of the error of the second set up (greeble_me2).
I would like to know how could I do the same thing but without having to use the @variant attribute?
I would like to know how could I do the same thing but without having to use the @variant attribute?
- jsmack
- Member
- 7737 posts
- Joined: Sept. 2011
- Offline
Damn_daniel
Thank u Mestela! I like it because it seems simpler than using vex, but the @variant attribute doesn't work for me, it appears a warning on the attributecreate where you create the @variant that says “Unexpected integer precision”. Maybe this attribute can not be run in Houdini 17.5. Also I get some problems with the lab tools beacause of the version.I attach a screen capture of the error of the second set up (greeble_me2).
I would like to know how could I do the same thing but without having to use the @variant attribute?
Copy to pieces only uses the variant attribute in 18.
-
- Quick Links