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 shape operation. You can use the print operation to output the value of a certain material attribute, eg. print(material.colormap.r).

Syntax

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 PBR material attributes.

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". Default is "#ffffff". 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]. 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.

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".

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:

  • material.emissivemap
  • material.occlusionmap
  • material.roughnessmap
  • material.metallicmap
  • material.emissive
  • material.metallic
  • material.roughness

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

  • material.color
  • material.colormap
  • material.normalmap
  • material.opacity
  • material.opacitymap
  • material.opacitymap.mode
  • material.opacitymap.cutoff

attributes.

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

CGA material attributesGLTF 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

material.emissive

emissiveFactor

material.opacitymap.mode

alphaMode

material.opacitymap.cutoff

alphaCutoff

Rendering and export

For asset and generated model preview, importing and for exporting the generated models, the material attributes need to be mapped to and from the respective format. The following tables show what format implements which feature.

Note:

This tables only list the formats relevant for CGA, not general CityEngine.

Material Attribute

Asset Preview / 3D Viewport

Import

Export

Khronos Collada DAE

Wavefront OBJ

Autodesk FBX

Khronos glTF

Khronos Collada DAE

Autodesk FBX

Wavefront OBJ

SceneLayer Package (i3s)

Alembic ABC

CityEngine WebScene 3ws

Unreal Datasmith

Khronos glTF

RenderMan RIB

Vue

VOB

FileGDB

Universal Scene Description USD

.dae/.kml/.kmz

.obj

.fbx

.gltf/.bin/.glb

.dae/.kml/.kmz

.fbx

.obj

.slpk

.abc

.3ws

.udatasmith

.gltf/.bin/.glb

.rib

.vob

.gdb

.usdc

name

N

Y

Y

Y

Y

Y

Y

Y

N

Y

N

Y

Y

Y

Y

N

Y

shader

Y 4

N

N

N

N

N

N

N

N

Y

N

Y

N

Y

N

N

Y 5

color

Y 2

Y 1

Y

Y

Y

Y 1

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y 6

ambient

Y

Y

Y

Y

N

Y

Y

Y

Y

Y

Y

Y

N

Y

N

N

N

specular

Y

Y

Y

Y

N

Y

Y

Y

N

Y

Y

Y

N

Y

Y

N

N

emissive

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y

opacity

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y 6

reflectivity

Y

Y

N

Y

N

Y

Y

N

N

Y

Y

Y

N

Y

Y

N

N

shininess

Y

Y

Y

Y

N

Y

Y

Y

N

Y

Y

Y

N

Y

Y

N

N

bumpValue

Y

Y

Y

N

N

Y

N

Y

N

Y

N

Y

N

Y

Y

N

N

metallic

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y 6

roughness

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y 6

colormap

Y 2

Y 1

Y

Y

Y

Y 1

Y

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

N

dirtmap

Y 2

Y

N

Y

N

Y

Y

N

N

Y

N

Y

N

Y

Y

N

N

specularmap

Y

Y

Y

Y

N

Y

Y

Y

N

Y

N

Y

N

Y

Y

N

N

opacitymap

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y 3

Y

Y

Y

Y

N

Y

opacitymap.mode

Y

N

N

N

Y

N

N

N

N

Y

N

Y

Y

N

N

N

Y

opacitymap.cutoff

Y

N

N

N

Y

N

N

N

N

N

N

N

Y

N

N

N

Y

normalmap

Y

Y

N

Y

Y

Y

Y

N

Y

Y

N

Y

Y

Y

N

N

Y

emissivemap

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y

occlusionmap

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y

roughnessmap

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y

metallicmap

Y

N

N

N

Y

N

N

N

Y

Y

N

Y

Y

N

N

N

Y

map.tu/.tv

Y

Y

N

Y

N

Y

Y

N

N

Y

N

N

N

Y

Y

N

N

map.su/.sv

Y

Y

Y

Y

N

Y

Y

N

N

Y

N

N

N

Y

Y

N

N

map.rw

Y

Y

N

Y

N

Y

Y

N

N

Y

N

N

N

Y

N

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.
  • 4 For the Viewport, the shader name is used to switch between standard and PBR rendering, see the PBR Material Attributes section above.
  • 5 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).
  • 6 If a map is present the corresponding scalar value is ignored.

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)

In this topic