It’s been a while but I’ve come back to CityEngine and have been experimenting with Occlusion queries, basically it tests to see whether a shape lies inside, overlaps or touches geometry of another shape.

I’m finding it a little tricky to get my head around, most things in CityEngine are assessed very quickly and dynamically, but not this occlusion thing.

Here’s a video which may explain it better, basically as one shape is moved the rule assesses when it is touching another shape, expect it doesn’t always work first time….


For those interested here is the CGA code (yes I have looked at this as a way of analysing shapes/buildings that are affected by flooding.  Somewhat topical in the UK this week I think:


attr flood_height = 10
attr building_height = 10

attr buildingColor = "#ffffff"
attr floodColor = "#0000ff"
attr waterOpacity = 0.5
	comp(f){top :water}

	comp(f){side :wall}

	case touches(inter):	color(floodColor) x
	else : set(material.opacity, waterOpacity) color(floodColor) x		

	case touches(inter):	color("#ff0000") x
	else : color(buildingColor) x

Suggestions and improvements would be welcome!