About CityEngine Blog


CityEngine is a great tool that is able to create large scale models, mainly of cityscapes, quickly, and with the ability to make adjustments based on a rule file in a procedural manner.

I hope to show you some of the work I have done with CityEngine creating a variety of models across a range of projects. I have mainly used the software for planning applications but have learnt a great deal of the potential for other applications.

I want to concentrate on the writing of rule files which is the core use of CityEngine. Without rule files no 3D content can be generated and this is very important to understand. I will also strive to bring news and updates regarding CityEngine as well.

I hope you find what I share useful and please feel free to share and contribute your thoughts and experience.


Sunday, 15 September 2013

CityEngine Starter Project 6 - Additional building detail and completing the scene


Additional building detail

A number of successors had now been created that I could use to continue to add detail to the facade and roof of the commercial buildings. First up was to continue working the ground floor of the building to achieve the 'retail' style frontage.

The LargeWindow successor was split into a number of parts that would create a window and a frame. The split I used to do this adds another level of complexity where a y split is carried out within an x split. This makes the code more efficient and reduces the need to write needlessly long rule files:

LargeWindow -->
     split(x){0.25 : SolidWall | ~5 : split(y){0.50 : SolidWall | ~1 : LargeWindow1 | 0.25 : SolidWall} | 0.25 : SolidWall}

LargeWindow1 is now subject to a -0.4m translation in the z direction. This moves the LargeWindow1 successor into the building creating a window that is inset compared to the Wall and SolidWall successors:

LargeWindow1 -->
     t(0,0,-0.4)


The Window from the upper floors and the Entrance successors were also subject to similar types of splits and translations:

Window -->
     split(x){0.2 : SolidWall | ~2.5 : split(y){0.2 : SolidWall | ~1 : Window1 | 0.2 : SolidWall} | 0.2 : SolidWall}            

Window1 -->
     t(0,0,-0.2)
Entrance -->
     split(x){0.2 : SolidWall | ~2.5 : split(y){~1 : Entrance1 | 0.35 : SolidWall} | 0.2 : SolidWall}
    
Entrance1 -->
     t(0,0,-0.4)

The final stage of the facade creation was fairly critical. As all windows and the entrance had been translated by -0.4m this left a gap between the wall. To fill this space a 'solid' block needed to be created so that it would appear that the building has frames around both:

SolidWall -->
     extrude(0.4)
     t(0,-0.4,0)  

The last addition to the building was the inclusion of a roof. A Comp(f) operation was used to select the top face of the TopFloor successor. This was extruded by 0.15m to create a solid roof base and another comp(f) operation was used to again select the top, whilst keeping the other faces (RoofKeeper). A setback operation with a value of 0.4m to all edges and a final extrude operation to the edge created a simple raised edge roof:

TopFloor -->
     comp(f){top : CentreRoof}   
    
CentreRoof -->
     extrude(0.15)
     comp(f){top : CentreRoof1 RoofKeeper | all : RoofKeeper }

CentreRoof1 -->
     setback(0.4){all : CentreRoof2}  
    
CentreRoof2 -->
     extrude(0.4)

The commercial buildings and the code for the starter project was now complete.

Of course I could now go through and add extra code to create different types of zone, additional building detail such as colours and/or textures, add further planning based rules such as height to boundary and density, and add extra randomness to create more varied types of building styles. I however, found this to be a great start and found it really very useful to begin to understand how CityEngine operations can be used together to produce an interesting output.

To complete the scene I applied a slightly modified version of the streets.cga code that the guys at Esri had produced. The scene was exported as a CityEngine Web Scene and can be found on arcgis.com here.

The Web Scene functionality is something that I'll look at in other posts but quickly I'll say that it is an excellent tool to deliver data and I hope that further upgrades will continue. 




No comments:

Post a Comment