Render analysis
renderPipeline() computes visibility-style metrics by rendering one or more geometry layers from sampled viewpoints and aggregating what each viewpoint can see.
This is the part of autk-compute to use for metrics such as:
- sky exposure
- park and water visibility
- object-to-object visibility
- facade or window view quality
- semantic scene composition from many viewpoints
Minimal example
import { AutkComputeEngine } from '@urban-toolkit/autk-compute';
const compute = new AutkComputeEngine();
const result = await compute.renderPipeline({
layers: [{ id: 'buildings', collection: buildings, type: 'buildings' }],
viewpoints: { collection: roads, sampling: { directions: 1 } },
aggregation: { type: 'classes', includeBackground: true, backgroundLayerType: 'sky' },
});For the centroid strategy used here, the returned collection is a copy of the viewpoints collection enriched with values under properties.compute.render. The building-windows strategy returns a derived window-point collection instead.
Sky exposure on roads
This example follows the existing gallery pattern. Roads act as viewpoints, buildings act as occluders, and the transparent background is counted as sky.
Core inputs
| Input | Description |
|---|---|
layers | The scene layers to render from each sampled viewpoint |
viewpoints | The collection used to derive camera origins and receive results |
aggregation | How rendered pixels are reduced back onto each viewpoint |
camera | Optional field of view and clipping settings |
tileSize | Render resolution per sample; must be a multiple of 8 |
Aggregation modes
Class aggregation
Use class aggregation when you want to know how much of each semantic layer type is visible from a viewpoint.
aggregation: {
type: 'classes',
includeBackground: true,
backgroundLayerType: 'sky',
}Typical outputs include:
- sky view factor
- visible share of parks
- visible share of water
- visible share of buildings or roads
The values are written under:
feature.properties.compute.render.classesObject aggregation
Use object aggregation when you need which individual objects are visible, not just which class they belong to.
aggregation: { type: 'objects' }For this mode, it is usually helpful to define objectIdProperty on each render layer so visibility can be mapped back to stable feature identifiers.
The values are written under:
feature.properties.compute.render.objectsThis is the right mode for building-to-building visibility or selected-object analysis.
Viewpoints and sampling
viewpoints defines both the source features and the strategy used to generate camera samples.
Centroid strategy
The default strategy uses the feature centroid as the view origin.
viewpoints: {
collection: roads,
strategy: { type: 'centroid' },
sampling: { directions: 8 },
}Building-windows strategy
For facade- or apartment-style analysis, the pipeline can derive window viewpoints from building geometry.
viewpoints: {
collection: buildings,
strategy: { type: 'building-windows', floors: 10 },
}This strategy is used by the gallery view-score example to evaluate visibility from many windows on a selected building. It returns one derived point feature per window, not one result feature per original building. Each point has a window ID and metadata such as sourceFeatureIndex, geometryIndex, and floorIndex in its properties.
Use sourceFeatureIndex to associate a window with buildings.features[sourceFeatureIndex], and geometryIndex to identify its original building component. Aggregate the window metrics yourself if you need a single score per building. Do not pass window feature indices directly as building selection indices.
Window cameras are oriented from the facade layout; the centroid strategy's sampling controls are not applied to building-windows.
Sampling controls
| Option | Meaning |
|---|---|
directions | Number of horizontal directions sampled per viewpoint |
azimuthOffsetDeg | Starting azimuth for the first direction |
pitchDeg | Shared vertical pitch applied to all directions |
Camera controls
The render pipeline also supports optional camera controls:
camera: {
fov: 90,
clip: { near: 1, far: 5000 },
}These settings are useful when tuning visibility scale, occlusion depth, or analysis resolution.
Output shape
With centroid, the render pipeline returns a copy of the source viewpoints collection. With building-windows, it returns the derived window-point collection. In both cases, computed metrics live inside properties.compute.render; the input collection is not mutated.
feature.properties.compute.renderDepending on the aggregation mode, you will typically read either:
feature.properties.compute.render.classesor:
feature.properties.compute.render.objectsTypical workflows
- roads → sample visible sky or buildings
- points → sample visible class composition around sensors
- buildings → sample visibility from centroids
- buildings with
building-windows→ evaluate facade or apartment views
For end-to-end examples that combine compute, database updates, and map rendering, continue to Patterns.