5. Visualizing in 3D
This step changes the urban display from 2D to 3D. Buildings are extruded according to a height attribute, roads have depth, and people are shown as spheres. Lighting changes with the time of day.

Extrude buildings and roads​
The building height is sampled between 10 and 20 meters and used as the depth of its geometry. Roads use a buffered display shape with a depth of 3 meters.
species building {
float height <- rnd(10 #m, 20 #m);
aspect default {
draw shape color: #gray border: #black depth: height;
}
}
species road {
geometry display_shape <- shape + 2.0;
aspect default {
draw display_shape color: #black depth: 3.0;
}
}
Add a 3D aspect for people​
The sphere is drawn three meters above the agent's location so it sits on the ground plane.
species people skills: [moving] {
bool is_infected <- false;
aspect sphere3D {
draw sphere(3) at: {location.x, location.y, location.z + 3} color: is_infected ? #red : #green;
}
}
Configure the 3D display​
The world agent updates is_night from the simulation hour. The display uses that value for the default light, adds ambient light and a ground image, then draws people before semi-transparent buildings.
global {
bool is_night <- true update: current_date.hour < 7 or current_date.hour > 20;
}
display map_3D renderer: 3d {
light #ambient intensity: 20;
light #default intensity: (is_night ? 127 : 255);
picture "../includes/soil.jpg";
species road;
species people aspect: sphere3D;
species building transparency: 0.5;
}
For the full model, including its graph-based movement and chart, see Incremental Model 5.