CaptainAhoy Posted May 5, 2016 Share Posted May 5, 2016 Hi, I am scattering a bunch of torus on a grid and the total number shown is 110 primitives. I want to create a bunch of groups so that I can assign materials to those specific groups. Right now, I can manually create groups in my material node ( group : 1-20, 21-40 ) and so on.. I was wondering if there is a way of doing : "create one group out of 40% of the total objects" .. this was it will randomly select some objects and create a group for them. I hope i was clear in explaining. Thanks~ ~N Quote Link to comment Share on other sites More sharing options...
f1480187 Posted May 6, 2016 Share Posted May 6, 2016 Group SOP can do it out of the box. select_part.hipnc Quote Link to comment Share on other sites More sharing options...
manx151089 Posted May 6, 2016 Share Posted May 6, 2016 You can also use connectivity to create primitive attribute and partition to create the group. Quote Link to comment Share on other sites More sharing options...
CaptainAhoy Posted May 6, 2016 Author Share Posted May 6, 2016 16 hours ago, f1480187 said: Group SOP can do it out of the box. select_part.hipnc Thanks for the file! I am, however, unable to create multiple groups. In the first group, it says "Select 20 of 100" but if i create another group underneath it and say "Select 30 of 100" it combines both the groups. I am trying to assign different materials to different groups of primitives. Quote Link to comment Share on other sites More sharing options...
mestela Posted May 7, 2016 Share Posted May 7, 2016 (edited) You could have a primitive attribute between 0 and 3, and use the attribute group syntax to assign materials. eg, the first slot would use the group @materialid=0, the second @materialid=1, etc. An advantage of doing it this way is you can create that attribute using a point wrangle, and use a ramp to easily adjust the distribution. Here I'm generating a random number between 0 and 1 per torus, remapping it with a ramp, then multiplying it by 4 and converting to an integer. With that setup, and a material sop setup as mentioned earlier, if all the torii have a materialid of 0 (ie, the ramp is flat and at the bottom of the graph), they all get the first material (which here is red). if they're between 0.25 and 0.5, they get the second material, 0.5>0.75 the third... If you add more points in the graph, you can make just 2 materials be assigned evenly, or weighted 80% towards 1, or have all 4 materials in various distributions. Channel ramps are awesome. material_distribution.hipnc Edited May 7, 2016 by mestela Quote Link to comment Share on other sites More sharing options...
CaptainAhoy Posted May 7, 2016 Author Share Posted May 7, 2016 2 hours ago, mestela said: You could have a primitive attribute between 0 and 3, and use the attribute group syntax to assign materials. eg, the first slot would use the group @materialid=0, the second @materialid=1, etc. An advantage of doing it this way is you can create that attribute using a point wrangle, and use a ramp to easily adjust the distribution. Here I'm generating a random number between 0 and 1 per torus, remapping it with a ramp, then multiplying it by 4 and converting to an integer. With that setup, and a material sop setup as mentioned earlier, if all the torii have a materialid of 0 (ie, the ramp is flat and at the bottom of the graph), they all get the first material (which here is red). if they're between 0.25 and 0.5, they get the second material, 0.5>0.75 the third... If you add more points in the graph, you can make just 2 materials be assigned evenly, or weighted 80% towards 1, or have all 4 materials in various distributions. Channel ramps are awesome. material_distribution.hipnc holy whoah! This helps a lot! Thanks so much! Quote Link to comment Share on other sites More sharing options...
f1480187 Posted May 7, 2016 Share Posted May 7, 2016 You could also subtract existing groups in the Combine tab of the Group SOP from new selection. Or use Split and Merge SOPs. select_part2.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.