Jump to content
Sign in to follow this  
netherknight

controlling random colors per bunch.

Recommended Posts

Hi, I'm running into a little issue where I'm trying to randomize colors over bunches of lines. 

Basically what I'm doing is making a small bunch of lines, say 6 close to each other. Then I copy that bunch over a distance around 500 times. (See attached file) 
After I divide all the lines into 3 groups with group by expression and I assign a different color to each group. 

However this splits up All the lines created, what I want is to randomize by initial bunch so each bundle of 6 lines has a mix of the three colors. 

What happens now that I want to avoid is the possibility of 1 "Bunch" being 99% one color which can happen working with this many lines. Doing the group split before copying and transforming will give me the exact same randomization thus giving you a repeating pattern. 

How would I best go about this?  

Randomized bunching issue.hip

Share this post


Link to post
Share on other sites

Hi Thomas,

  • Use cylinder columns.
  • Give your copies a copynum attribute.
  • Within each bundle sort primitive numbers randomly.
  • Assign primitive colors by their new primitive number divided by the total number of primitives.
f@id = @primnum / float(@numprim -1);
v@Cd = chramp('color', f@id);

Three colors on six tubes each

Three colors on numberous tubes each

Four colors on numberous tubes each

bundles.hipnc

Edited by konstantin magnus

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×