Adding color to building faces?

923
4
08-22-2018 08:06 AM
DanielChantlos1
Occasional Contributor

Hi,  I would like to know if it is possible to simply add colors to faces of buildings using RGB values.

I have been using Sketchup to add colors to faces of buildings, but it takes time to convert to a new file format for use in CityEngine. There has to be an easy way of doing this in CityEngine, right?

0 Kudos
4 Replies
LR
by
Occasional Contributor III

You'll have to do it with CGA.

color(R,G,B) (range 0-1)

or

color("#RRGGBB") (00-FF)

You can also make an attribute, which lets you pick a color in the inspector:

Define after the CGA version:

@Color

attr myColor="#FF0000"

and then.. color(myColor)

0 Kudos
DanielChantlos1
Occasional Contributor

I am very new to CityEngine.

If I had a simple 6 face prism, what would the steps be to apply different colors to each face?

0 Kudos
BenLeslie1
Occasional Contributor III

Use comp(f) to separate the prism into its component faces and then set each face to a different colour

Prism-->
comp(f){top:Red | bottom:Green | front:Blue | back:Yellow | left:Magenta | right:Cyan}

Red-->color(1,0,0)
Green-->color(0,1,0)
etc....
0 Kudos
LR
by
Occasional Contributor III

You can also use the face index, like ... {0: Red | 1: Green | ... I had a face labeling script somewhere but can't find it atm.

0 Kudos