[063] How to Apply Multiple UV Sets and Maps in CityEngine
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.
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,'1,'1,0,0,1)
texture("images/back_image.jpg")
projectUV(2)
setupProjection(0,scope.xz,5,5,0,0,1)
texture("images/texture.jpg")
projectUV(0)
X.
texture.jpg to uv-set 0,
and back_image.jpg to uv-set 2
were applied.
The expected result was
that texture.jpg should be overlaid on top of back_image.jpg as shown above.
However, the result was.....
As shown in Figure 6, the expected overlay completely fails. Only the texture intended for UV Set 2 (back_image.jpg) is rendered on the screen, while texture.jpg assigned to UV Set 0 disappears entirely.
This issue occurs because the texture() command cannot target specific UV sets—it continuously overrides the single material.colormap channel. When multiple texture() commands and projectUV() indices conflict, only one layer survives while the other texture binding breaks completely.
Therefore, when working with multiple UV sets on a single object, you should avoid using texture() and instead use the set() command to explicitly specify material map attributes (e.g., material.colormap, material.dirtmap).
If you rewrite the above code using set(), it becomes as follows.
Lot -->
primitiveSphere
setupProjection(0,scope.xz,5,5,0,0,1)
setupProjection(4,scope.xz,'1,'1,0,0,1)
set(material.colormap,"images/texture.jpg")
set(material.dirtmap,"images/back_image.jpg")
projectUV(0)
projectUV(2)
X.
The result is
Yes.. we got the desired result.
Just by looking at the code, you can tell how to use it.
1. Set up the slots using setupProjection.
2. In set(), specify the material.map attribute shown below and write the corresponding texture path.
3. Finally, execute projectUV() to apply that texture, and that's it.
This way, you can apply multiple uv-sets.
Since you only need to change the code, it's not very difficult.
There is one downside,
Although all uv-sets can be applied in CityEngine, only color.map, dirtmap, and opacitymap can be previewed in real-time on screen. As for the rest... whether they can be considered visible is questionable.
Exporting is another matter entirely.
Check the following link to see which uv-sets are imported/exported depending on the format.
https://doc.arcgis.com/en/cityengine/latest/cga/cga-material-attribute.htm
That's all for today.
- Learn previous workflow in [062] How to Apply and Project UV Textures in CityEngine
- Continue learning with [064] How to Transform UV Coordinates in CityEngine CGA
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.)