English

FAQ: What are occlusion queries ?

Question

What are occlusion queries ?

Answer

Occlusion queries are queries in CGA code that test whether closed ('watertight') volumes overlap or touch other volumes or are inside of other volumes.

Note:
CGA stands for Computer Generated Architecture, a scripting language specific to Esri CityEngine and used to generate 3D content. See the link to the Basics of Rule-based Modeling in the Related Information section below.

It is important to note that this works only after volumes have been created (for example, after an extrude operation) or inserted (insert builtin cube).

All the volumes that were created are stored internally for the occlusion query calculations until the model generation is finished, though it is important to know that these volumes do not have to persist as shapes in the final model, but can also be split (using the component split operation) into individual shapes, which then represent the final geometry.

Since occlusion queries are computationally-intensive, all related calculations and volumes are only triggered if it is explicitly written in CGA code. It is recommended to use as few queries as possible.

If for example, a volume must be checked to see if it overlaps a street shape, the user must create a volume for the street first, then delete all the shapes except the original street shape.

Code:
attr volumeThickness = 1

Street -->
alignScopeToAxes(y)
t(0,-volumeThickness,0)
extrude (world.y, volumeThickness) # OCCLUSION VOLUME CREATED!
comp(f) {top: StreetShape | all : NIL} # delete other shapes

Note:
For further documentation, please consult the CityEngine manual. See the link to the section on occlusion queries under the CGA Shape Grammar Reference in Related Information below.

Related Information