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 shape operation. You can use the print operation to output the value of a certain material attribute, eg. print(material.colormap.r).
Attribute | Description |
---|---|
string material.name | The name of the material. |
string material.shader |
|
float material.color.{r|g|b} | Diffuse color. Individual access to each color component. Default is white. See material.color attribute. |
string material.color.rgb | Diffuse color. Access to the complete color as hex-formatted string, eg. RED = "#ff0000". See material.color attribute. |
float material.ambient.{r|g|b} | Ambient color. Individual access to each color component. Default is black. |
float material.specular.{r|g|b} | Specular color. Individual access to each color component. Default is black. |
float material.emissive{r|g|b} | Emissive color. 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 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]. |
float material.bumpValue | Controls the bump scaling factor (if material.bumpmap is set). |
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. |
string material.colormap | Texture file paths for the texture channels. See material.map attribute. |
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 | |
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". |
PBR material attributes
Some material attributes are designed to be exclusively used for physically-based rendering shaders. These are:
- material.emissivemap
- material.occlusionmap
- material.roughnessmap
- material.metallicmap
- material.emissive
- material.metallic
- material.roughness
If the shader name is set to "CityEnginePBRShader", encoders which support PBR materials use those attributes as well as the
- material.color
- material.colormap
- material.opacity
- material.opacitymap
- material.normalmap
attributes.
Rendering and export
For rendering in the CityEngine preview and for exporting the generated models, the material attributes need to be mapped to the respective format. The following table shows what format implements which feature.
Material Attribute | Asset Preview | Import | Export | |||||||||||||
Khronos Collada | Wavefront OBJ | Autodesk FBX | Khronos glTF | Khronos Collada | Autodesk FBX | Wavefront OBJ | SceneLayer Package (i3s) | Alembic | CityEngine WebScene | Unreal Datasmith | Khronos glTF | RenderMan | Vue | FileGDB | ||
.dae/.kml/.kmz | .obj | .fbx | .gltf/.bin/.glb | .dae/.kml/.kmz | .fbx | .obj | .slpk | .abc | .3ws | .udatasmith | .gltf/.bin/.glb | .rib | .vob | .gdb | ||
name | N | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | Y | Y | Y | N |
shader | N | N | N | N | N | N | N | N | N | Y | N | Y | N | Y | N | N |
color | Y2 | Y1 | Y | Y | Y | Y1 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
ambient | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | N | Y | N | N |
specular | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | N |
emissive | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
opacity | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
reflectivity | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | N |
shininess | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | N |
bumpValue | Y | Y | Y | N | N | Y | N | Y | N | Y | N | Y | N | Y | Y | N |
metallic | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
roughness | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
colormap | Y2 | Y1 | Y | Y | Y | Y1 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
bumpmap | Y | Y | Y | Y | N | Y | Y | Y | N | Y | N | Y | N | Y | Y | N |
dirtmap | Y2 | Y | N | Y | N | Y | Y | N | N | Y | N | Y | N | Y | Y | N |
specularmap | Y | Y | Y | Y | N | Y | Y | Y | N | Y | N | Y | N | Y | Y | N |
opacitymap | Y | Y | Y | Y | Y | Y | Y | Y | Y3 | Y | Y3 | Y | Y | Y | Y | N |
opacitymap.mode | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
normalmap | Y | Y | N | Y | Y | Y | Y | N | N | Y | N | Y | Y | Y | N | N |
emissivemap | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
occlusionmap | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
roughnessmap | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
metallicmap | N | N | N | N | Y | N | N | N | N | Y | N | Y | Y | N | N | N |
map.tu/.tv | Y | Y | N | Y | N | Y | Y | N | N | Y | N | N | N | Y | Y | N |
map.su/.sv | Y | Y | Y | Y | N | Y | Y | N | N | Y | N | N | N | Y | Y | N |
map.rw | Y | Y | N | Y | N | Y | Y | N | N | Y | N | N | N | Y | N | N |
Remarks
- 1 The official COLLADA standard does not support a diffuse solid color and a diffuse texture at the same time.
- 2 In the CityEngine Viewport, the colormap and dirtmap values are multiplied with the (diffuse) color.
- 3 The opacitymap attribute is exported if it is pointing to the same image as the colormap attribute and if the image has an alpha channel.
Related
Examples
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)