[061] How to Set Up Texture Projections in Esri CityEngine - setupProjection()
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 concepts. Surprisingly, it is not easy.
In CityEngine, textures are applied through three main steps.
1. Define a texture projection that fits the purpose of the texture to be used,
2. Specify the texture, and
3. Connect the texture to the slot designated for that purpose.
These three steps are performed using the setupProjection(), texture(), and projectUV() commands.
In simple terms,
setupProjection() defines how the texture will be projected, such as determining the Map type of the texture (diffuse, bump, etc.), its size, and which coordinate system to use for mapping,
texture() selects the texture file, and
projectUV() applies the texture using the projection defined by setupProjection().
The method is slightly different when using multiple uvSets, but
since it is important right now to understand the basic method of applying textures, we will learn just the concepts for now.
We will look into how to handle multiple uvSets once we finish the basic method.
Today we'll look at the first command, setupProjection().
The reference documentation can seem overwhelming at first.
The command accepts up to seven parameters, which means there are quite a few things to keep track of.
To briefly explain the parameters:
They are UV Set, mapping coordinate system (axisSelector), texture size (textureWidth, textureHeight), texture offset (widthOffset, heightOffset), and whether to wrap around corners (uwFactor).
Let's start with the map type (uvSet).
CityEngine has a total of 10 map types, each with its own unique number, and that number must be entered into uvSet.
CityEngine supports the following ten texture map types.
If you have experience with 3D graphics, these are basic concepts you likely know, so I will not explain each one.
As shown above, a total of 10 map types can be used.
The mapping coordinate system (axes-selector) determines from which direction the texture will be applied. It decides whether to base it on the scope axes or the world coordinate system. Since this was already covered in coordinate systems, it is not difficult.
Map size (textureWidth, textureHeight) sets the texture size in real-world units used in your CityEngine scene.
The size can also be specified using the flexible size operator (~) and ratio (') learned when covering split().
Map offset (widthOffset, heightOffset) determines how far to move the map from the origin of the mapping coordinate system.
Corner wrapping (uwFactor) determines whether to apply the texture vertically on a single face or wrap it around corners. Values greater than 1 allow the texture to wrap around corners while gradually reducing its scale.
Understanding only setupProjection() isn't enough to apply textures effectively. I will explain the remaining two before constructing code to explain further.
That's it for this lesson.
As a side note,
There are some limitations on texture support when exporting models to other software.
The availability of textures based on file conversion can be checked in detail at the link below.
https://doc.arcgis.com/en/cityengine/latest/cga/cga-material-attribute.htm
- Learn previous workflow in [060] CityEngine CGA color() Command Exercises for split.index and Conditional Rules
- Continue learning with [062] How to Apply and Project UV Textures in CityEngine - texture(), projectUV()
Comments
Post a Comment
Feel free to leave a comment if you have any questions about Global Mapper or CityEngine. I will get back to you with a sincere response as soon as possible. (Please note that all comments are moderated and manually approved to maintain a high-quality community. Promotional or spam content will not be published.)