Building texture

466
3
Jump to solution
10-30-2012 12:45 AM
Thu_GiangDang
New Contributor
Hi,

I am trying to add random texture to the my buildings by using the code provided in the tutorial with minor changes. When I assign the rule to the building polygons and generate, the result was mixed: some buildings has texture applied to them, while other remain blank (white). In some case, only one or two sides of the building have texture, but the rest is blank. Please view screenshot as below:


And here's my rule file code:
const randomFacadeTexture = fileRandom("data/facade_textures/f*.tif") attr floorheight = rand(4,5)  actualFloorHeight =   case scope.sy >= floorheight : scope.sy/rint(scope.sy/floorheight)  else : scope.sy   actualTileWidth =   case scope.sx >= 2 : scope.sx/rint(scope.sx/4)  else : scope.sx  Lot -->  extrude(HEIGHT)  comp(f){front: Facade | side: Facade | top: Roof }  Building.  Facade -->  setupProjection(0, scope.xy, 8*actualTileWidth, 8* actualFloorHeight)  texture(randomFacadeTexture)  projectUV(0)


My building layer has 9000+ polygon. I wonder if that is a problem if the number of polygon/faces is too large.

Thank you for your time!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor II
Hi !


In the Lot rule, you have a copy of the shape defined with 'Building'.

Try deleting this line and check how this works out.

Let me know..

M.

View solution in original post

0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor II
Hi !


In the Lot rule, you have a copy of the shape defined with 'Building'.

Try deleting this line and check how this works out.

Let me know..

M.
0 Kudos
Thu_GiangDang
New Contributor
Thank you!! It works like magic! What is the reason behind this?
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Haha, no magic at all.

Lot -->
    A.

copies the shape of Lot to A.

Lot -->
    B.

copies to B, logically.

If you write
Lot -->
    A.
    B.

the shape coming from Lot is copied to A. and duplicated to B. So there's 2 copies of on top of each other.

test this with

Lot -->
    alignScopeToAxes(y)
    A.
    t(0,10,0)
    B.


Please watch all Tutorial videos, find them here:
http://forums.arcgis.com/threads/64843-CityEngine-Collection-RESOURCES-FAQ-HELP

Especially, the CGA basics are explained, see tuto 6.

Matt
0 Kudos