Jump to content

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

Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...