4 Replies Latest reply on Apr 17, 2012 8:03 AM by MBuehler-esristaff

    Texture projection - keeping textures vertically orientated

    whitenorthstar
      [ATTACH=CONFIG]13544[/ATTACH]

      Howdy - I'm hoping you can help.  At the moment, I'm figuring out how to keep a texture vertically aligned, but projected flat onto a face.  Normally, the rules I've put together below work fine, but (from what I read) it seems that faces without a horizontal edge at the bottom... give problems to the texture rotation.  As you'll see from the photo, upside down triangles* are the issue, so the texture is projected flat (good) but rotated a bit skewed (which is bad) on that face (... it seems to be aligned with an edge).

      It is clear that you have solved this in the NYC 2259 example, but there is a lot of wizardry that I don't quite understand.  Is there a more simple way to do this?

      Thank you!  :D

      * It may be obvious to some, but for those who are puzzled, the triangles are caused by an imported shape that is formed from two pyramids, one inverted into the other.  Those faces don't LOOK triangular, but the rest of the face is inside the structure so it is actually an upside down triangle

      [ATTACH=CONFIG]13535[/ATTACH]

      ################################ # FILES import flatroof      : "flatroof.cga"   ################################ # ATTRIBUTES attr LOD = 2 attr finalBuildingHeight = 100 attr floorH = rand(5,6) attr tileW  = rand(2.2,3.7)  ################################ # FUNCTIONS getWallATex    = "facades/facade1_color.png" getFloorHeight(h)   = case h >= floorH  : h/rint(h/floorH)  else : scope.sy/ceil(scope.sy/floorH+0.0001) getTileWidth(w)   = case w >= tileW  : w/rint(w/tileW)  else : scope.sx/ceil(scope.sx/tileW+0.0001)     ################################ # RULES Lot -->  Footprint   Footprint -->  s('0.9,'1,'0.9)   center(xz)   alignScopeToAxes(y)   s('1,0,'1)  Mass  Mass -->  extrude(finalBuildingHeight)  Shapes  Shapes -->  10%:   i( "volumes/cube_slanted_edges2.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/cyl24_ver_bevel.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/cyl8_ver.obj" )   comp(f){ side : Facade | horizontal : Roof }   10%:   i( "volumes/o_shape.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/prism1.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/cube_taper_steps1.obj" )   comp(f){ side : Facade | horizontal : Roof }  10%:   i( "volumes/u_shape.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/cube_translated2.obj" )   comp(f){ side : Facade | horizontal : Roof }     10%:   i( "volumes/cube_slanted_faces1.obj" )   comp(f){ side : Facade | horizontal : Roof }     else:   NIL  Roof -->   GetToItLater.   Facade -->     alignScopeToGeometry(zUp, auto)    texture(getWallATex)     setupProjection(0, scope.xy, 16*getTileWidth(scope.sx), 16*getFloorHeight(scope.sy), 1)     projectUV(0) # colormap texture projection