+ Reply to Thread
Results 1 to 4 of 4

Thread: Roofs stored as 3D SHP file

  1. #1
    Goran Vuksic
    Join Date
    Sep 2011
    Posts
    2
    Points
    0
    Answers Provided
    0


    0

    Question Roofs stored as 3D SHP file

    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:
    Code:
    attr elevation = map_01(brightness, 0.0, 100.0) + elevationDelta
    attr DEM = elevation
    After applying following CGA rule:
    Code:
    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).
    Code:
    attr visinaPrizemlja = 5
    attr visinaKata = 3
    +
    Code:
    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
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	pic01.png‎
Views:	47
Size:	167.0 KB
ID:	13441   Click image for larger version

Name:	pic02.png‎
Views:	65
Size:	175.5 KB
ID:	13442   Click image for larger version

Name:	pic03.png‎
Views:	54
Size:	217.7 KB
ID:	13443   Click image for larger version

Name:	pic04.png‎
Views:	54
Size:	224.0 KB
ID:	13444  

  2. #2
    Dan Smith
    Join Date
    Oct 2011
    Posts
    20
    Points
    0
    Answers Provided
    0


    0

    Default Re: Roofs stored as 3D SHP file

    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:

    Code:
    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/444...Horizontal-Lot
    Last edited by D_L_Smith; 04-15-2012 at 09:47 PM.

  3. #3
    Matthias Buehler

    Join Date
    Oct 2011
    Posts
    1,676
    Points
    438
    Answers Provided
    140


    0

    Default Re: Roofs stored as 3D SHP file

    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.
    _________________

    CityEngine Machinist

    * YOUTUBE CHANNEL : www.youtube.com/channel/UCNS4TLgToEDQiH9pi06ofOA
    * tutorial videos : http://forums.arcgis.com/threads/648...URCES-FAQ-HELP
    * Please use the rating buttons on the right side !

  4. #4
    Goran Vuksic
    Join Date
    Sep 2011
    Posts
    2
    Points
    0
    Answers Provided
    0


    0

    Default Re: Roofs stored as 3D SHP file

    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):
    Code:
    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!
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	pic05.png‎
Views:	53
Size:	216.7 KB
ID:	13620  

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts