Random texures to building not tiles?

816
5
08-18-2014 01:22 AM
KennethLindhardt
Occasional Contributor

Hi,

I would like to get a set of random textures to my buildings. All my building will get an attribute, so I know what kind of material I need to assign to each building. I would like to assign my rule to multiply buildings, and choose a random material texture inside my texture folders. Let’s say I got an brick building, it should randomly choose from 5 different brick textures. If I use a random search inside my brick folder, it will assign random textures to my tiles inside 1 building. If my folder contains 2 textures 1 yellow brick and 1 red brick, one building will contain both textures. That is not what I would like of course. How do I create my rule, so it would take random textures for each building and not each tile?

0 Kudos
5 Replies
KennethLindhardt
Occasional Contributor

Got it,

using the case Materiale == "Bric" : listRandom(fileSearch("assets/Textures/Brick/*.png"))

instead of fileRandom, will assign only one picture to the building.

0 Kudos
DavidWasserman
Occasional Contributor III

Yeah, you have to be careful in general about how the rules are being called. That seems it will do the trick.

David Wasserman, AICP
0 Kudos
KennethLindhardt
Occasional Contributor

Thanks for your reply. It seems so 😉 I'm happy about it!

0 Kudos
MatthiasBuehler
Occasional Contributor III

hey !

also, you can do this:

const myTex = fileRandom(..)

This will make sure that myTex is always the same texture, no matter where called in the code.

Ok ?

Matt

KennethLindhardt
Occasional Contributor

Tanks for the info.

At this point what I did, is doing the job perfectly. Also when I split my gable roofs vertically, the vertical texture are the same as the one given for my facades. 

0 Kudos