3 Replies Latest reply on Apr 17, 2012 10:34 PM by geonetadmin

    Roofs stored as 3D SHP file

    goran.vuksicgdi-net-esridist
      Hi all

      I'm still pretty new with CityEngine and CGA so have been basically copy-pasting tutorial CGA rules on my data.
      Everything works fine while I'm using SHP that is storing footprint polygons.

      But... Things are getting 'strange' when input data represents 3D roof polygons and is stored in SHP file Z (as shown in PIC01.PNG). In addition it has roof's MinZ and MaxZ height values stored as attributes.

      Second input data (not shown in pictures) is height map with following attributes:
      attr elevation = map_01(brightness, 0.0, 100.0) + elevationDelta
      attr DEM = elevation


      After applying following CGA rule:
      attr DEM = 10 // attr DEM=elevation
      attr height = 10
      attr red = "#ff0000"
      attr blue = "#0000ff"
      attr yellow = "#ffff00"
      
      Lot --> extrude(world.y, DEM+height) Building // attr height has negative values stored
                                                                   //thus '-' operation
      
      Building -->      
                  comp(f) { 
                        vertical : color(yellow) Front | 
                        aslant : color(blue) RoofA | 
                        horizontal : color(red) RoofB
                  }

      Result is shown in PIC02.PNG with problem circled with red color. Is there any simple solution for this?



      Things are of course getting worse after applying 'complex' CGA rule that includes splitting building into floors and texturing (PIC03.PNG).
      attr visinaPrizemlja = 5
      attr visinaKata = 3

      +
      Front -->
                  setupProjection(0, scope.xy, 1.5, 1, 1) 
                  setupProjection(2, scope.xy, 1, 1)
                  split(y){ visinaPrizemlja : Prizemlje 
                  | {~visinaKata : Kat}* }
                  projectUV(0)

      Extra NOTE: Prizemlje [ground floor] and Kat [floor] are mirrored.



      Last problem is shown in PIC04.PNG;
      CGA rule is set to put random textures on roofs. Since my roof is 'made of' 2 SHP polygons 2 different textures are applied on 1 roof.


      Any kind of help is much appreciated.

      Thanks in advance,
      Goran
        • Re: Roofs stored as 3D SHP file
          geonetadmin
          Original User: D_L_Smith

          Hey,

          The first few issues are a result of the way the the roof objects have been extruded from the start. What you need to do is correct for the initial slope of the roof, see the following:

          
          Roof_Shape -->
             alignScopeToAxes(y)
             Roof_Aligned(scope.sy)
          
          Roof_Aligned(RoofHeight) -->
             alignScopeToAxes(y)
             extrude(world.y, -100)
             split(y) { RoofHeight : Roof_Cavity | ~1 : NIL }
          
          Roof_Cavity -->
             comp(f) { bottom : Roof_Footprint | side : Roof_Side | top : Roof_Top}
          
          Roof_Footprint -->
             extrude(world.y, buildingHeight)
             Building_Mass
          
          Building_Mass -->
             alignScopeToGeometry(yUp, world.lowest, longest)
             Building_Mass_Aligned
          
          


          This should give you a clean platform to work from from which you can apply you more the complex cga rules - Also remembering that the scope has been corrected on the  Building_Mass_Aligned object so scope.y is now facing up.

          It is basically applying one of the solutions Matthias provided in this thread:  http://forums.arcgis.com/threads/44418-Vertical-Extrusion-on-Non-Horizontal-Lot
          • Re: Roofs stored as 3D SHP file
            MBuehler-esristaff
            Hi ..

            working down from the roof form is possible, but really not recommended.

            the main issue is that since you'd be working on individual roof polygons, you'll create separate volumes for each shape which cannot be re-combined or synchronized.

            thus, the best is to come from the footprint-side.

            we'll work on better roof operations to you can create more realistic roof forms faster. though it's not yet defined when yet.
            • Re: Roofs stored as 3D SHP file
              geonetadmin
              Original User: vukscha77

              Hi!

              Thank you both for your replies and provided solutions/workarounds/information.

              @Dan
              In the end I combined code you provided with code from your link (VolumeStrategies):
              attr height = 20
              attr groundFloorHeight = 5.5
              attr upperFloorHeight = 3.5
              attr nFloors = 7
              attr roofHeight = 10
              
              attr heightDEM = 20
              
              
              Roof_Shape -->
                 alignScopeToAxes(y)
                 Roof_Aligned(scope.sy)
              
              Roof_Aligned(roofHeight) -->
               alignScopeToAxes(y)
               extrude(world.y, -100)
               split(y) {heightDEM: BuildingVolume | ~1 : NIL }
               color(0, 0, 255)
               
              BuildingVolume -->
               comp(f) { 0 : NIL | side : SlopedFacade }
              
              
              SlopedFacade -->
               alignScopeToAxes(y)
               split(y) {groundFloorHeight : FloorVolume("groundFloor") | ~1 : split(y) {~ upperFloorHeight : UpperFloorVolume(split.index) }* }
               
              UpperFloorVolume(index) -->
               case index == split.total - 1 :
               # top floor
                FloorVolume("top")
               else:
                FloorVolume("upperFloor")
              
              FloorVolume(floorType) -->
               case floorType == "groundFloor" :
                color(1,0,0)
                X.  
               case floorType == "upperFloor" :
                X.
               else:
               # top floor
                color(0,0,1)
                X.


              Result shown in PIC05.


              @Matthias
              Guess I will need to find some kind of workaround for my input data then. Maybe Multipatch SHP created from 3D roofs - terrain difference.

              Will get back with new findings.

              Thank you both again!