Posts

Showing posts with the label CGA

[070] How to Split Procedural Windows and Facades in CityEngine

Image
Continuing from the last session, we will keep splitting facade 0. Below is an image to use as a reference for the measurements. figure 1 Among the code we wrote last time, the part corresponding to the ground floor is as follows. Front_f_Ground_f_wall --> split(x){~1 : X. | 13 : Front_f_Ground_f_wall_door | ~1 : X.} # ↑ The section where the door is located Now we will subdivide Front_f_Ground_f_wall_door. It looks like it is arranged as 'two windows - door - two windows'. Then let's split it up. Front_f_Ground_f_wall_door --> split(x){~4.5 : color(0,0,1) FFGWD_window | ~5 : FFGWD_door | ~4.5 : color(0,0,1) FFGWD_window} #In case the window sizes might change, I split everything using approximate values. figure 4 The blue area where the windows are located is where two windows go, so we split it once more. FFGWD_window --> split(x){'0.5 : FFGWD_window_final | '0.5 : FFGW...

[067] How to Control Insert Modes for External 3D Models

Image
Since I have some time, I'll go ahead and write the rest. This is the last usage of i(). It requires three parameters in total. We covered two of the parameters earlier, and the new parameter this time is insertMode. figure 1 https://doc.arcgis.com/en/cityengine/latest/cga/cga-i.htm It is divided into three types in total: alignSizeAndPosition is the default. It is the same as i(filePath). keepSizeAndPositoin keeps the size of the original source, but because it reflects the model's position at the time of export as is, there are cases where it ends up outside the scope. keepSizeAlignPosition keeps the original source size but places it at the bottom center of the scope plane. It's not difficult, right? Just choose the insertMode that suits the situation. Next is an example. figure 2 This imports a truck file. Let's compare the results for each mode. figure 3 figure 4 The diff...

[066] How to Fix Up-Axis Alignment for Imported 3D Assets

Image
I'm taking a short break to post again today. This is the second lesson on i(), covering the form that takes two parameters. Sometimes, when you load a file exported from a 3D program into CityEngine, the direction of the height axis is different, so the object ends up placed all wrong. This is because the direction of the height axis differs from program to program. (Programs can be divided into those that use the right-hand rule and those that use the left-hand rule.) If it's a source you made yourself, you can simply export it with the y-axis pointing up, but with files made by other people, you often need to change the direction. In that case, you can place it correctly by changing the second parameter, upAxesOfGeometry. I created a square pyramid in a program like the one shown below. figure 1 If you look at the axis directions of this program, the x-axis is the same as in CityEngine, but the height axis is the z-axis...

[063] How to Apply Multiple UV Sets and Maps in CityEngine

Image
Learn how to layer multiple UV sets in Esri CityEngine using the set() command and material map attributes to overcome texture overlay issues. This tutorial explains the limitations of using the texture() command when handling multiple UV sets on a single object in Esri CityEngine and demonstrates how to properly assign multiple texture channels like colormap and dirtmap using set() and projectUV(). We already covered the 10 uv-sets in the last lesson. Each has a unique index number, and each unique index has its designated texture attributes. figure 1 : https://doc.arcgis.com/en/cityengine/latest/cga/cga-texturing-essential-knowledge.htm As seen above, a total of 10 uv-sets from 0 to 9 each have their own unique texture attributes. So let's apply a colormap and a dirtmap using setupProjection(), texture(), and projectUV() learned in the previous lesson. Lot --> setupProjection(2,scope.xz...

[062] How to Apply and Project UV Textures in CityEngine - texture(), projectUV()

Image
Learn the texture() and projectUV() commands to accurately apply 2D image maps onto 2D polygons and 3D architectural models in Esri CityEngine. This tutorial covers the complete step-by-step workflow for procedural texturing in Esri CityEngine CGA. Learn how to map texture file paths with texture() and map UV projection coordinates using projectUV(), complete with code examples, 3D volume extrusions, and scope orientation considerations. Understanding these three commands—setupProjection(), texture(), and projectUV()—is essential for procedural texturing in CityEngine. Last time, we looked at setupProjection(), which prepares space for textures. Today, we'll cover the remaining two commands required to apply textures: texture() and projectUV(). Let's start with the texture() command. Figure 1 https://doc.arcgis.com/en/cityengine/latest/cga/cga-texture.htm The texture() command simply specifi...

[061] How to Set Up Texture Projections in Esri CityEngine - setupProjection()

Image
Learn the setupProjection() command to define UV sets, mapping axes, and texture dimensions in Esri CityEngine CGA. Texturing in Esri CityEngine relies on a structured three-step workflow using CGA commands. This tutorial explains the first essential step, setupProjection(), covering map types (uvSet), mapping axes, texture scale, offsets, and corner wrapping behavior for procedural 3D models. Recommended Audience: GIS professionals, 3D urban planners, and CGA developers looking to master texture projection parameters in CityEngine. Starting today, we'll begin learning how to apply textures to create more realistic materials. If you're already using CityEngine, you're probably familiar with at least one or two 2D or 3D graphics applications. Texture mapping is generally much more intuitive in traditional 3D modeling software. Texturing in CityEngine requires a solid understanding of several con...

[060] CityEngine CGA color() Command Exercises for split.index and Conditional Rules

Image
Understand procedural color mapping in Esri CityEngine using practical CGA exercises to control dynamic gradients and complex shape divisions. This tutorial provides hands-on practice for the CityEngine color() command. You will learn how to write rule scripts to generate progressive color transitions on repeating splits and analyze existing logic arrays to trace complex coordinate color distributions. Today, we will practice several exercises using the color() command. Let's do two exercises: one where we write code by looking at an image, and another where we predict the result by looking at a piece of code. What You Practiced Using color() with RGB values Working with split.index Building procedural color gradients Tracing nested split logic Using conditional branches in CGA Exercise 1: Create a Procedural Color Gradient First, look at the image below and try coding it yourself. ...

[058-059] Applying Colors and Shape Attributes in CityEngine CGA

Image
Learn the color() and set() commands in Esri CityEngine to apply materials and control dynamic shape attributes programmatically. This comprehensive CGA scripting tutorial covers the dual approaches to rendering materials in Esri CityEngine. You will learn how to apply simple colors using hexadecimal values and RGB arrays, modify shape properties dynamically with the set() command, and implement the @Hidden annotation to keep programmatically overridden attributes from causing interface conflicts in the Inspector UI. So far, we have covered the most basic commands that define shape geometries: comp, split, extrude, and scope. Applying Colors in CityEngine CGA Starting today, we will look at commands for applying materials to shapes. First, we will examine the color command, which applies a simple color to a shape. Below is the reference for the color command. figure 1 : CGA color Command Reference ( https...

[056-057] Understanding alignScopeToGeometryBBox() in CityEngine CGA

Image
Learn how procedural scope re-alignment and external 3D model positioning work in CityEngine using alignScopeToGeometryBBox(). In this comprehensive guide, we dive deep into the mechanics of the alignScopeToGeometryBBox() command. Learn how it computes bounding boxes on specified projection planes using local geometry axes instead of world coordinates, and discover how to properly align imported external 3D models (OBJ) for flawless urban simulations. Part 1: Reorienting the Scope with Basic Geometry Today, we wrap up our multi-part series on scope alignment by focusing on the final and highly versatile command: alignScopeToGeometryBBox() . How alignScopeToGeometryBBox() Works At first glance, since this command automatically calculates and configures the scope as long as you specify a projection plane, it might seem like a simpler or more automated version of alignScopeToAxes() . However, the command actually follows t...