[013] How to Use Facade Wizard in Esri CityEngine for Procedural Facades

Subdivide facade images into procedural components to generate automated CGA code.

In this tutorial, you will learn how to leverage the Facade Wizard in Esri CityEngine to transform 2D images into 3D procedural building skins. This tool is particularly effective for modeling high-rise buildings and apartments where repetitive patterns are common, providing a foundational workflow for Digital Twin creation.

    CGA Efficiency and the Facade Wizard

    Define the efficiency of CGA for repetitive building structures.

    The types of building forms that can be created efficiently using CGA are those where the same shapes are simply repeated. While you could create single-family houses or even gas stations, it is most efficient when creating simple, repetitive forms with slight variations, such as high-rise buildings and apartments.

    When working on such forms, you can also use the Facade Wizard. To be honest, you might wonder, "Do I really need this tool?" However, since it is a basic built-in feature, let's take a look at it and also explore why users often end up not using it much.

    Practical Tip: The Facade Wizard is excellent for creating "massing facades" quickly, but for detailed architectural elements, manual CGA coding offers far more control.

    Advantages and Disadvantages of the Facade Wizard

    Evaluate the pros and cons of the tool to determine its suitability for your project.

    Let's first mention the advantages and disadvantages of the Facade Wizard.

    The advantage is that you can obtain a rough draft of the CGA code.

    The disadvantages are:

    • Only vertical and horizontal splits are possible; diagonal splits are not supported.
    • While the CGA code can be saved, the work performed within the Facade Wizard itself cannot be saved. (Once you close the Facade window, it’s over.)
    • The CGA code is generated in a very "raw" state, so an understanding of CGA is required to modify it.
    • The creation process is simple, but looking at the saved code might leave you thinking, "What is this?"
    • It is a feature that has existed for a very long time but is not being improved.

    This is why many experienced users prefer writing CGA manually.

    A Brief History: Node-Based Coding in CityEngine

    Recall the legacy node-based CGA editor and its removal in later versions.

    As a side note, in CityEngine version 2014, CGA coding could also be done using a node-based system, as shown in the image below.

    [img 1 : Capture of Blender's Node Editor for comparison with CityEngine 2014]
    [img 1 : Capture the Visual CGA Editor CityEngine 2014. Thank you Jonas!]

    To be honest, I spent days searching all over Google trying to find a screenshot of this old interface, but absolutely nothing came up. Fortunately, the Esri CityEngine Product Engineer team stumbled upon my previous posts and generously opened up their internal archives to share this precious piece of legacy history with me. Anyway, there was a time when CGA coding was done this way. At the time, this approach reduced typos and made CGA easier to manage. However, due to conflicts between node-based editing and manual coding, the feature was removed starting from the 2015 version. Personally, this was the most disappointing change.

    The Core Concept and Workflow of Facade Wizard

    Explain the top-down subdivision logic and session management.

    Returning to the Facade Wizard, the work process is the same as the basic concept of CGA. You subdivide large masses into smaller ones. Within each mass, you perform simple splits or repetitive splits. One thing to keep in mind is that while "Undo" works during the session, it cannot be reversed once the window is closed. It is best not to close the Facade window until you are completely finished with your session.

    Practical Tip: Always keep a backup of your original facade image, as the Wizard maps logic directly to the texture file path.

    Example: A 3-Story Building Facade

    Describe the dimensions and patterns of the sample building project.

    Next is the facade of the building we will make today. It is 8m wide, 9m high, and 3 stories tall. It is divided into a total of 9 faces:

    • Left: Repetition of a vertical pattern.
    • 1st Floor: All independent patterns.
    • 2nd Floor: Repetition of a horizontal pattern.
    • 3rd Floor: Composed of a single pattern.
    Conceptual diagram of the sample facade showing 3m and 2m markings

    [img 2 : Conceptual diagram of the sample facade]

    You can capture the image to use it. Create a project and put the image into the images folder.

    Navigating the Facade Wizard Interface

    Identify the functions of the primary buttons in the Wizard UI.

    After running CityEngine, select Window - Facade Wizard from the menu bar at the top.

    Menu path to open Facade Wizard in CityEngine

    [img 3 : Opening Facade Wizard]

    The Facade panel will likely appear in the Inspector panel's spot. Since we only need the Facade window today, click the panel and press the Space Bar to make it full screen.

    Let's look at the menu at the top of the Facade panel:

    Facade Wizard toolbar numbered buttons

    [img 4 : Toolbar overview]

    1. Start a new Facade session.
    2. Load an image for facade work.
    3. Save the CGA code.
    4. Initialize/Reset.
    5. Simple horizontal split.
    6. Repetitive horizontal split.
    7. Simple vertical split.
    8. Repetitive vertical split.
    9. Extrude the divided face.
    10. Fit the image to the center of the screen.
    11. Display mode (Wireframe, Solid, Texture, etc.).
    12. Show from the viewpoint when the image was first loaded.

    Setting the Region Width and Loading Textures

    Configure the real-world scale for the facade image in meters.

    When you click the No. 2 button, select the image, and click Open, a window appears asking for the Region Width.

    Set Region Width dialog box

    [img 5 : Entering the width]

    This value refers to the actual width (m) of the building, not pixels. Enter 8 and click OK.

    Successfully loaded facade image

    [img 6 : Loaded Texture]

    The Splitting Process: Strategy and Execution

    Execute the subdivision sequence and utilize snapping features for alignment.

    Please refer to the demonstration videos below.

    Splitting order diagram zones

    [img 7 : Subdivision Zones]

    The larger, major sections were divided using the Single Split tool. When divided this way, the newly split areas are distinguished by a thin, solid blue line.

    Now, let's subdivide each specific part. Pay close attention to how the Repeating Split is used.

    A Repeating Split is indicated by a solid red line. If you hover your mouse inside a divided face using this tool, it automatically calculates and divides the area into equal intervals based on your mouse's position.

    When making a single vertical split on the 1st floor, I snapped it to perfectly align with the vertical split line on the 2nd floor.

    If you hold down the 'Shift' key while moving the mouse, the split line will automatically snap to the nearest existing line.

    As for the 3rd floor, it simply occupies the remaining space left after dividing the other floors, so there is no need to split it separately.

    Building facades are rarely perfectly flat, right? You can also push faces inward or pull them outward to create depth using the extrusion tool.

    Exporting and Analyzing the CGA Code

    Export the CGA code and examine its structural logic and naming conventions.

    Press the save button to export the CGA code to the rules folder.

    Saving the CGA file

    [img 8 : CGA Export]

    Here is the generated CGA logic. Note how the rule names are automatically generated:

    Don’t worry if this looks complex—understanding CGA structure will become easier in upcoming tutorials.

    attr LOD = 2 
    # LOD 0: original texture | LOD 1: flat splits | LOD 2: splits with depth
    #! SIZE 8.0 9.0
    const n = 2
    
    Facade -->
    	case LOD <= 0:
    		texture("/Tutorial-13-FacadeWizard/images/Facade3.gif")
    		alignScopeToGeometry(zUp, 0, world.lowest)
    		setupProjection(0, scope.xy, '1.0000, '1.0000)
    		projectUV(0)
    	else:
    		texture("/Tutorial-13-FacadeWizard/images/Facade3.gif")
    		alignScopeToGeometry(zUp, 0, world.lowest)
    		split(x, noAdjust) { 2.00: Facade__1(0) | ~6.00: Facade__1(1) }
    
    FacadeTrigger(i) -->
    	case LOD <= 0:
    		texture("/Tutorial-13-FacadeWizard/images/Facade3.gif")
    		alignScopeToGeometry(zUp, 0, world.lowest)
    		Facade__1(i)
    	else:
    		Facade__1(i)
    
    Facade__1(i) -->
    	case i == 0: Facade__1_1
    	case i == 1: Facade__1_2
    	else: Facade__1_1
    
    Facade__1_1 -->
    	split(y, noAdjust) { ~4.50: Facade__1_1_1 }*
    
    Facade__1_1_1 -->
    	case LOD <= 1:
    		setupProjection(0, scope.xy, '4.0098, '2.0000) projectUV(0) 
    	else:
    		setupProjection(0, scope.xy, '4.0098, '2.0000) 
    		t(0, 0, -0.4) s('1, '1, 0.4) primitiveCube() projectUV(0) 
    
    Facade__1_2 -->
    	split(y, noAdjust) { ~3.01: Facade__1_2_1 | 2.98: Facade__1_2_2 | ~3.01: Facade__1_2_3 }
    
    # ... (Additional subdivision rules Facade__1_2_x follow same logic)
    

    The code is unpolished. If you need variables, you'll have to track them using the Model Hierarchy. It highlights why understanding CGA syntax is essential.

    Final Application and Precision Issues

    Apply the generated rule to a shape and evaluate the final 3D result.

    Apply the rule to an 8m x 12m rectangle. If a face intended to be two splits becomes three, it’s a sign that you need to manually modify the code. Mouse-based splitting often results in slight shifts in the CGA code.

         Defining Facades with CityEngine Facade Wizard

    In the next tutorial, we will explore how to modify geometry directly and gain more precise control beyond the Facade Wizard.

    Next Post
    Learn How to Control Building Orientation in CityEngine [014] How to Use First Edge & Street Edge Attributes in Esri CityEngine
    Related Posts

    If you have any questions, please leave a comment. Let's solve them together!


    [A Quiet Thought]

    "The machine does not isolate us from the great problems of nature but plunges us more deeply into them."
    — Antoine de Saint-Exupéry, Wind, Sand and Stars
    Continue Learning
    Explore complete tutorial collections for CityEngine and Global Mapper.

    Comments

    Popular posts from this blog

    029] How to Split Polygon Areas with Intersecting Lines in Global Mapper

    [008] How to Understand CGA Rule Structure in CityEngine (Beginner Guide)

    046] How to Create Parallel Offset Lines in Global Mapper