I've added quite a few smaller features to 3DWorld's procedural cities, in particular to residential neighborhoods. I'll list all of the different types of objects that have recently been added and show at least one representative screenshot of each one. The last two posts were more on the technical side, with few images. This post will contain many images.
City Objects
First we have the objects added to cities with commercial buildings. Parks were looking too empty since they previously only contained trees, benches, and maybe a flag. Now parks can have one or two winding paved paths crossing through them. These can be treated as either pedestrian or bike paths. (There are no bikes on these paths yet, but there are now static bikes - see below.) The placement algorithm will avoid adding objects such as trees that are too close to paths. People walking through the park don't yet use these paths. Now that I'm thinking of it, maybe I can modify the grid-based pedestrian path finding algorithm of the previous post to assign lower cost to grid cells over park paths.
I also added fountains to some parks. There are currently three 3D models to randomly choose from, but more models can be added to the config file at a later time.
City park with two wavy crossing paved paths and a fountain in the lower left corner. |
Fountains can be found inside city blocks as well. They're placed anywhere that has enough open space and is far enough away from buildings. Birds can land on the tops of fountains. Maybe I should add benches or other items around the fountains?
Close-up of one of the three new fountains added to cities. Some are in parks, and others are on the concrete areas between buildings. This fountain has a pigeon on it. |
I've added traffic cone objects that can be placed on the ground within cities. They can be used with either commercial cities or residential neighborhoods. These aren't 3D models but are instead formed from simple truncated cones and rectangles for their bases. Traffic cones can be placed anywhere, but initially I only put them in semicircles around the curved roads at the corners of cities. In the future I might add construction areas or closed roads where traffic cones can be used.
Traffic cones are now added to some areas of the city, currently only at the ends of road bends. |
Residential Objects
There have been quite a few new additions to residential areas. Most of these are new types of 3D models that have been added, though I've also experimented with trees and plants.
First we have bicycles. These use a single model that's always painted red. Bikes are placed leaning against the exterior walls of houses and sometimes along front yard fences. The only placement rules are that they can't intersect previously placed objects and can't block doors. The same rules apply to the other object types shown later. Bicycles are not yet interactive; maybe some day the player can ride them.
Bicycles can be found leaning against some houses and fences. |
I've added small potted plants around the exterior of houses and fences. There are three 3D models to choose from, one type of flower and two types of leafy plants. I'm reusing the same models that I placed on tables inside buildings. Since they're small and low-polygon, they're cheap and can be placed almost anywhere, so I can add several per house.
Oh, I almost forgot to mention that I added downspouts connected to the gutters of houses. You can see two of these in the image below. The small concrete slabs at the base of exterior doors are new as well.
Small potted plants of three varieties have been added around houses and fences. |
The next type of vegetation I've added are smaller pine trees placed near houses. I already have deciduous and palm trees added to residential yards and pine trees in parks, but these add a bit more greenery.
I originally wanted to add bushes, but I couldn't quite get them working. The first problem was that trees are instanced all around the world with only 100 unique tree models for performance reasons. If I created bushes specifically for houses, that would have either increased the memory usage of trees or reduced the number of unique trees placed in the rest of the scene. The second problem was that there's little control over the shape of the tree, and sometimes a stray branch clipped through the exterior wall of the house. Pine trees use much simpler models (32 branch quads vs. thousands of leaves) and have a well controlled shape, which avoids both problems.
Small pine trees have been placed around the exterior of houses in residential neighborhoods. |
Now it's time to add more sources of outdoor fun and exercise for the city residents. Some back yards have swimming pools. Most of the yards without a pool now have either swing sets or trampolines. These objects have fewer placement restrictions and can be added in situations where pools can't. For example, they can be added to smaller yards that can't easily be fenced in. The only real requirement is that they be in the "back" yard, which really only means they can't be placed between the front of the house and the street.
Here's a swing set placed in a back yard by a balcony. Extra padding has been accounted for in the placement to make sure there's enough space to swing. They're not currently interactive or animated though. I would love to have the seats swing back and forth when pushed by the player, but none of the free 3D swing set models I found have this sort of animation. Birds can land and take off from swing sets. If you look closely, you can see a dark gray bird on the center of the top bar in the screenshot below.
And finally we have trampolines. I was only able to find one usable free model with the vertical bars and net, which is similar in style to the trampoline in my own yard. This one has good geometry, though that net has a high vertex count and over 100K triangles. The one downside is that the materials are very dark and have no bright colors for contrast. I believe the normals are wrong on the dark blue ring, which is why it doesn't appear to be properly lit from the sun.
Trampoline placed in the yard next to a house. |
Adding all of these new 3D models comes with a performance cost. Some of them have high vertex/triangle counts. Some of them have many individual materials, which leads to a large number of draw calls that hurt performance. I had to add more aggressive LOD and material distance culling to recover some of the framerate. For example, meshes with very small triangles such as the net in the trampoline above are only drawn when close to the player. I applied the same approach to indoor objects such as couches, chairs, and lamps. However, all of these objects together are a fraction of the triangle count that's drawn when people and cars are enabled, as those models are far more detailed.
What else should I add? If you have any suggestions, leave them as a comment.