Material Shape Attributes

The material shape attributes control the shading, texturing and export of the shape's geometry. CityEngine supports ten texture channels with a fixed semantic.

All of these attributes can be changed using the set or setMaterial operations. You can use the print operation to output the value of a certain material attribute, eg. print(material.color.r).

Syntax

Attribute Description
string material.name
The name of the material.
string material.shader
The shader name.
Default is "CityEngineShader". Setting it to "CityEnginePBRShader" signals that the physically-based rendering attributes should be used, see below.
float material.color.{r|g|b}
Diffuse color (non-linear sRGB). Individual access to each color component. Default is white. More details.
string material.color.rgb
Diffuse color. Access to the complete color as hex-formatted string, eg. RED = "#ff0000". Default is "#ffffff". More details.
float material.ambient.{r|g|b}
Ambient color (non-linear sRGB). Individual access to each color component. Default is black.
float material.specular.{r|g|b}
Specular color (non-linear sRGB). Individual access to each color component. Default is black.
float material.emissive.{r|g|b}

Emissive color (non-linear sRGB). Individual access to each color component. Default is black.

float material.opacity
Opacity factor. 1 is fully opaque, 0 is fully transparent. Default is 1.
float material.reflectivity
Reflectivity factor. 0 is no reflection, 1 is full reflection (of the Reflection Map set in the Scene light and panorama settings). Note that reflection depends on the specular color: the default black color means no reflection!
float material.shininess
Phong specular exponent in the range [0, 128]. Default is 1.
float material.bumpValue

Controls the bump scaling factor (if material.bumpmap is set). Default is 1.

float material.metallic

Controls the metallic factor (if material.metallicmap is set). 0 is a dielectric material, 1 is a metallic material. Default is 0.

float material.roughness

Controls the roughness factor (if material.roughnessmap is set). 0 is a completely smooth material, 1 is a completely rough material. Default is 1.

bool material.doubleSided

Controls if the material is supposed to be seen from both sides of a polygon. If set to false the material is supposed to only be seen from the side the normal points to. Default is true.

string material.colormap
string material.bumpmap
string material.dirtmap
string material.specularmap
string material.opacitymap
string material.normalmap
string material.emissivemap
string material.occlusionmap
string material.roughnessmap
string material.metallicmap
Texture file paths for the texture channels. More details.
float material.{colormap|...|metallicmap}.s{u|v}
Per-channel texture scaling factors.
float material.{colormap|...|metallicmap}.t{u|v}
Per-channel texture translation factors.
float material.{colormap|...|metallicmap}.rw
Per-channel texture rotation factors. The texture is rotated around the w-axis (w is the cross product of u and v).
string material.opacitymap.mode
Controls how the opacitymap is combined with the colormap. Valid values are "blend", "mask" and "opaque". Default is "blend".
float material.opacitymap.cutoff
When material.opacitymap.mode is set to "mask", the material.opacitymap.cutoff attribute specifies the cutoff threshold. If the alpha value is greater than or equal to the cutoff value then it is rendered as fully opaque, otherwise it is rendered as fully transparent. This attribute is ignored for other modes than "mask". Default is 0.5.

PBR Material Attributes

Some material attributes are designed to be exclusively used for physically-based rendering (PBR) shaders. These are:

If the shader name is set to "CityEnginePBRShader", the CityEngine viewport and encoders which support PBR materials use those attributes as well as the attributes.

Here is how the CGA material attributes correspond to the GLTF material specification, which is based on Physically-Based Rendering (PBR).

CGA material attributes GLTF material specification
material.color.{r|g|b} pbrMetallicRoughness.baseColorFactor, RGB components
material.opacity pbrMetallicRoughness.baseColorFactor, A component
material.colormap pbrMetallicRoughness.baseColorTexture, RGB channels
material.opacitymap pbrMetallicRoughness.baseColorTexture, A channel
material.metallic pbrMetallicRoughness.metallicFactor
material.roughness pbrMetallicRoughness.roughnessFactor
material.metallicmap, B channel pbrMetallicRoughness.metallicRoughnessTexture, B channel
material.roughnessmap, G channel pbrMetallicRoughness.metallicRoughnessTexture, G channel
material.normalmap normalTexture
material.occlusionmap, R channel occlusionTexture, R channel
material.emissivemap emissiveTexture, RGB channels
material.emissive.{r|g|b} emissiveFactor, RGB components
material.opacitymap.mode alphaMode
material.opacitymap.cutoff alphaCutoff

Rendering, Import, and Export

For asset & generated model preview, importing and exporting the generated models, the material attributes need to be mapped to and from the respective format. The following table shows what format implements which feature. Please note that this table only lists the formats relevant for CGA, not general CityEngine.

Basic Material Attributes

Extensions name shader color colormap dirtmap
Display Asset Preview / 3D Viewport (1) (2) (2) (2)
Import Khronos Collada .dae/.kml/.kmz (3) (3)
Autodesk DWG .dwg
Autodesk FBX .fbx
Khronos glTF .gltf/.glb
buildingSMART IFC .ifc
Wavefront OBJ .obj
Universal Scene Description (USD) .usda/.usdc/.usdz
Export Alembic .abc
Khronos Collada .dae/.kml/.kmz (3) (3)
Autodesk DWG .dwg
Autodesk FBX .fbx
Esri FileGDB .gdb
Khronos glTF .gltf/.glb
buildingSMART IFC .ifc
Wavefront OBJ .obj
Scene Layer Package (SLPK) .slpk
Unreal Datasmith .udatasmith
Universal Scene Description (USD) .usdc/.usdz (4) (5)
Vue .vob
  1. For the CityEngine viewport, the shader name is used to switch between standard and PBR rendering, see the PBR Material Attributes section above.
  2. In the CityEngine viewport, the colormap and dirtmap values are multiplied with the (diffuse) color.
  3. The official COLLADA standard does not support a diffuse solid color and a diffuse texture at the same time.
  4. The USD exporter always creates an USDPreviewSurface shader. If the shader name is set to PBR, the PBR attributes will be exported as well (see PBR Material Attributes above).
  5. If a map is present the corresponding scalar value is ignored.

Advanced Material Attributes

opacity opacitymap opacitymap.mode opacitymap.cutoff normalmap doubleSided
Display Viewport
Import Collada (7)
DWG
FBX
glTF
IFC
OBJ
USD
Export Alembic
Collada
DWG
FBX
FileGDB
glTF
IFC
OBJ
SLPK
Unreal
USD (5)
Vue
  1. If a map is present the corresponding scalar value is ignored.
  2. Collada does not support the "doubleSided" parameter directly. The importer only sets it to false if the Collada file was written by "SketchUp" with the "two-sided" export option enabled (= all faces are duplicated).

Legacy Material Attributes

ambient specular specularmap reflectivity shininess bumpValue bumpMap
Display Viewport
Import Collada
DWG
FBX
glTF
IFC
OBJ
USD
Export Alembic
Collada
DWG
FBX
FileGDB
glTF
IFC
OBJ
SLPK
Unreal
USD
Vue

Physically-Based Rendering Material Attributes

emissive emissivemap metallic metallicmap roughness roughnessmap occlusionmap
Display Viewport
Import Collada
DWG
FBX
glTF
IFC
OBJ
USD
Export Alembic
Collada
DWG
FBX
FileGDB
glTF
IFC
OBJ
SLPK
Unreal
USD (5) (5)
Vue
  1. If a map is present the corresponding scalar value is ignored.

Map Transform Material Attributes

map.tu/.tv map.su/.sv map.rw
Display Viewport
Import Collada
DWG
FBX
glTF (6) (6) (6)
IFC
OBJ
USD
Export Alembic
Collada
DWG
FBX
FileGDB
glTF (6) (6) (6)
IFC
OBJ
SLPK
Unreal
USD
Vue
  1. Transforms are read and written using the KHR_texture_transform extension.

Related

Example

 
attr wallC       = "#FFFFFF"
attr wallTexture = "facade/walls/wall.c.09.tif"
attr dirtTexture = "dirtmaps/dirtmap.16.tif"
...
Wall --> 
    primitiveCube() color(wallC)
    set(material.colormap, wallTexture) projectUV(0)
    set(material.dirtmap, dirtTexture) projectUV(2)

Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.