English

How To: Apply color to shapes in CityEngine

Summary

Color can be applied to shapes in CityEngine by creating a rule file and using the color operation along with the appropriate RGB value or hexadecimal value.

Procedure

In this example, the color red is applied to a 'lot' shape. These steps assume a CityEngine project is open with lot shapes in the Viewport window.

  1. Right-click the rules folder in the Navigator window. Select New > CGA Rule File.
    [O-Image]
  2. Add the following code to the rule file if RGB values are going to be used.

    • Lot --> color(255,0,0)

    Add the following code to the rule file if hexadecimal values are going to be used.

    • Lot --> color("#FF0000")
  3. Save the rule file (File > Save).
  4. Apply the rule to the shape by dragging the rule file from the Navigator window onto the shape in the Viewport window.
    [O-Image]
  5. Experiment with different colors until the desired result is received. Save the rule file after changes are made and select the "Update Seed and Generate Models" button
    [O-Image]
    to see the color updated in the shape.
    Code:
    Common Hexadecimal Values

    Aqua = "#00FFFF"
    Blue = "#0000FF"
    Black = "#000000"
    ForestGreen = "#228B22"
    Gray = "#808080"
    Green = "#008000"
    Lime Green = "#00FF00"
    Red = "#FF0000"
    Yellow = "#FFFF00"
    White = "#FFFFFF"

    Code:
    Common RGB Values

    Aqua = 0, 255, 255
    Blue = 0, 0, 255
    Black = 0, 0, 0
    Forest Green = 34, 139, 34
    Gray = 128, 128, 128
    Green = 0, 128, 0
    Lime Green = 0, 255, 0
    Red = 255, 0, 0
    Yellow = 255, 255, 0
    White = 255, 255, 255

Related Information