cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.
SOLVED!

Random texture origin for FOR – TO – NEXT

jc4d
Expert

Hello,

 

I have a simple block using FOR – TO – NEXT to duplicate it, is there a way to add a random texture origin to each duplicated so there is no visible texture repetitions?

jc4d_0-1677498832649.png

 

Juan.

22 REPLIES 22

Yes, you have to move it along X axis to change.

Using bare SYMB_POS_X as the seed is predictable, it might not look good with repeated objects. The % trick works well when the changes of the dividend are huge relative to the divisor. For a huge dividend you need a huge seed.

There are two ways to work around this:

  • mix up SYMB_POS_X, SYMB_POS_Y, their integer and fractional parts
  • use SYMB_POS_X to get a random number in a huge range which you can use as seed

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Yeah... need an internal origin version of SYMB_POS_X. The material will change as you move the entire object around....Would have thought that multiplying it by a value that changes every loop would work, but apparently not... 

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Lingwisyer
Guru

So, I inserted a text output after the material line with the expression of the the randomised array output, and each iteration through the loop gives a different number and has a different material applied to it, so it does work. It is just for some reason not applying to my prism_cylind or cpism_{2}... I thought maybe group might be affect the interaction, but moving the command to within the group did not change anything...

 

Lingwisyer_0-1681874431927.png

 

 

 

Ling.

 

ps. I put my test text and shapes in a group, and they all became uniform...

pss. Solved.

 

PLACEGROUP CREATEGROUPWITHMATERIAL (Square_Top, 2, 1, mat_array[int(rnd(abs(iDis)) % mat_count) + 1])

 

This does add ALOT of lines though...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!