Smart city
We’re sharing our experience in implementing an interactive city model. This type of scene is fairly common and has been done in many variations before us, but this project wasn't like reinventing the wheel as several challenging aspects have emerged during development.
So, a live interactive city: dump trucks, sewage trucks, garbage trucks, tankers, and hazardous waste specialists follow predefined routes.
Vehicles move according to a physics engine, which creates a more natural look — this isn’t just movement along lines with spinning wheels. Movement is determined by the force along the route curve, dynamically guiding vehicles along the correct paths, while wheels rotate naturally.
Key technical aspects of the city model: advanced camera handling — three different methods were implemented to prevent camera collisions with objects — using transparency, transforms and morphing.
Trains move, cranes operate, helicopters fly, and simple water rendering and flow are implemented. Functionality for curves representing routes and fluid transfer was developed using cylinder stretching in the vertex shader, complemented by a bloom post-effect highlighting these curves.
Scene toning uses matcaps — an old and effective technique, though without dynamic lighting. In addition, we implemented a Photoshop-like layer system with a couple dozen blending modes: ultimately, you can configure virtually anything visually (if you’re willing to spend about ten hours).
The most interesting part: deploying something like this in mass-market web. We had to carefully design a complex configuration scheme: two rendering modes, automatic short performance tests, with settings based on reference measurements, separate logic for mobile devices, different screen densities and various operating systems.