how to texture random object

462
4
12-18-2012 01:31 PM
anthonymagdelaine
New Contributor
all is in the title,

following this kind of idea, for parcels, garden, roofs, etc...
[ATTACH=CONFIG]20059[/ATTACH]

code used:

fileRandom("folders/images_**.obj")

what else ?
0 Kudos
4 Replies
JoanneO_Brien
Occasional Contributor
are the objects inserted randomly in the rulefile?

I think all you need would be

ObjectTex = fileRandom("folders/images_**.obj")
ObjectTexture -->
 alignScopeToGeometry(zUp,auto)
 setupProjection(0,scope.xy,'1,'1) 
             projectUV(0)
 texture(ObjectTex)


although the number values etc will probably change for you but that's the idea...
0 Kudos
anthonymagdelaine
New Contributor
yes the object are inserted with scatter


but the line you wrote: "texture(ObjectTex)" looks strange

it means i must call the object as texture?
i tested this and finally it searsh for an unknown texture


Tomb1 =  fileRandom("models/Cimetiere/Tomb_**.obj")

TombImport--> set(trim.vertical, false)
    s(0.3,0,0)
    i(Tomb1)
    texture("ObjectTexture")
   
ObjectTexture -->
   alignScopeToGeometry(zUp,auto)
   setupProjection(0,scope.xy,'1,'1) 
           projectUV(0)
   texture(Tomb1)
0 Kudos
anthonymagdelaine
New Contributor
i fund a way to distribute objects randomly without using random system and allowing me to keep textures to the right objects by using probability function

like that :

MiseEnPlace--> case p(0.1) : TombE1Import[Lot.] 
  case p(TombType) : TombComp[Lot.]
  case p(TombType) : Tree[Lot.] 
  case p(TombType) : TombComp2[Lot.]
  else : NIL [Lot.]  
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi !

If each of those objects has it's own textures, just make sure you also have the .mtl file in the same spot as the .obj.

The .mtl file carries the material information such as the texture.

Otherwise, I may have an other useful way to solve your issue.

matt
0 Kudos