Once again I have a number of procedural building changes that are too small for their own blog post. I'm working on stop signs, which is a larger topic, but they're not done yet. This post will list the various additions I've made to building interiors and exteriors.
Fires
I showed off the spark particle effects that were added for broken TVs and basement lights in a previous post. When I reviewed that video, it made me think that all of those sparks landing on the rug should set it on fire. So this is what I implemented. Now a spark landing on a rug while it's still hot and glowing has a chance of starting a small fire. I haven't worked out how to handle large fires that spread to the rest of the building, so for now the fires will go out after a few seconds. They do, however, leave lasting burn marks on the rug.
Fires also serve a minor gameplay purpose. In the (unlikely) event the player starts a fire and then walks through it in game mode, they take some small amount of burn damage. This provides a minor distraction from other gameplay tasks and forces the player to pay more attention in rooms with broken lights. Other animals such as rats and cockroaches have updated logic that attempts to avoid the fires. I haven't yet updated the building AI and zombie logic to avoid fires. I feel that zombies should be able to walk through small fires to get to the player.
Here's a short video showing fires created from sparks in the same room as the earlier sparks video.
Attic Vents
I wrote about 3DWorld's interior-exterior geometry in a previous post. This is where "room" objects can be added to building exteriors and will be lit from the sun and moon outdoor lighting rather than interior room lights. I used this a few weeks ago to add window frames and window sills. Now that I have this system in place, I can use it for more exterior detail objects.
One object I'm missing is exhaust vents that pass through the attic and its roof. I added these for furnaces, water heaters, and stove hoods. These are simple pipes that are split into two sections with the lower section inside the attic using interior lighting, and the upper section on the roof using exterior lighting. The vent sections inside the attic also participate in player collision detection and act as blockers for attic object placement. Anything I can do to increase attic clutter improves the realism of the scene.
Here is what these look like from both inside and outside the building.
House attic with a vent from the furnace on the left and another larger vent from the stove hood two floors below on the right. |
The same two vents protruding through the roof with end caps that use sky/sun/moon lighting. |
I may add more details in the future if I get around to it. Maybe I can make some of them have rotating blades like a fan? I might also add vents for the various plumbing fixtures such as sinks and toilets. I'm not sure exactly what needs a vent. My real life house has something like eight different vents on the roof of various sizes, and the roofs of my procedural buildings don't seem to have enough of them.
Parking Garage Sprinklers
I added large vertical fire suppression/sprinkler pipes to office building parking garages over a year ago. Then a few months ago I added smaller horizontal pipes that lead away from the main water pipe across the roof of each parking garage level. I finally got back to working on this sprinkler system by adding secondary horizontal lines that extend from these first lines. These pipes are placed relatively close together in a grid pattern that attempts to cover all reachable areas of the parking garage.
The placement system must check for intersections with objects such as stairs, elevators, and support pillars. I allow sprinkler pipes to pass through parking garage separator walls in a similar way to water, gas, and sewage pipes. I hung these lower than most other pipes so that they touch the bottoms of the ceiling support beams and stay out of the way of many other ceiling objects. They're placed after other types of pipes, so I need to check for pipe intersections as well. I wrote some code that is able to place partial sprinkler pipe sections in incrementally shorter lengths when the full pipe fails to be placed. In some situations, sprinkler pipes can clip through ceiling lights. I fixed this by a combination of moving the lights to the side and shortening the pipes. I would say that about 75% of the total pipe length can be added on average, which is good enough for now.
Next came the sprinklers themselves. I added upward pointing vertical sprinklers at regular intervals along the smallest diameter (last placed) horizontal pipes. Once again, I had to check for overlaps with other objects near the ceiling and omit the sprinklers in those cases. I also shortened pipes to remove extra segments that had no sprinklers or other connecting pipe sections. Short pipes that don't end at walls are attached to the ceiling with small metal loop hangers/brackets.
All sprinkler pipes are drawn as red cylinders with brass fittings, connectors, and end caps. The bright red color makes them stand out and adds contrast to the otherwise gray parking areas. Sprinklers are formed from three cylinders of different lengths, radii, and colors. I considered using real 3D models for each one, but I'm worried that too many will be visible in large parking garages and this will hurt the framerate. In some cases nearly 100 sprinklers can be seen in the player's view.
Here are two screenshots of a parking garage with pipes and sprinklers. The first is without cars, while the second is with cars and indirect lighting enabled.
Parking garage with a network of red pipes and sprinklers attached to the ceiling. |
The same parking garage as above, this time with cars and indirect lighting enabled. I feel it's easier to see the pipes with this lighting. |
Newsracks
This one was suggested by my mother. I've added newsracks along the sidewalks of some city streets. They come in four different shapes/styles and a number of different colors taken from reference images of real newsracks. These are all drawn with geometry generated from code, mostly cubes of different sizes. I added a fake newspaper image I found online to the transparent doors of each one. As usual, newsracks are collisions objects that block the player and participate in pedestrian path finding. At some point I may decide to make these interactive so that they player can open them up and take a newspaper. Maybe the player will need to find coins in a building to do so.
Here are two example images, again without and with cars.
An example city sidewalk with newsracks of various sizes and colors along the edge of the road. |
More "The Fake News" newsracks, this time with cars enabled. |
Rooftop Water Towers
A few weeks ago I did a Google search for other people's procedural buildings to see if any of them inspired me to do something new. One YouTube video showed buildings with rooftop water tower models. That seemed like something easy to add to 3DWorld's buildings that would increase the variety of their roof areas and improve city skylines. Water towers are relatively simple to model out of cylinders and cones for the tower and pipes, plus cubes for the support structure. So I decided to generate the geometry rather than using an existing 3D model from somewhere online. I used a metal plate texture for their exteriors and pipes.
Water towers are placed on some buildings above a certain height and a minimum rooftop area. These are skipped for buildings that already have helipads, skylights, antennas, or other previously placed objects. Water towers are placed before smaller objects such as AC units, signs, and roof access doors, so these objects must check for existing water towers before being placed. Each water tower is also connected to the network of water pipes in the basement, if present.
I may as well continue the trend with two images of the water tower and different sun positions. I added a vertical pipe under the tower in the second image. That Ferris wheel in the background is a great landmark for navigation!
Initial metal water tower 3D model created from a texture cylinder, a cone, and five cubes. |
The same water tower viewed with a different sun position and a metal cylindrical pipe added to the bottom to carry water. |
Pool Decks
At this point I had both in-ground and above ground swimming pools in the back yards of some houses in my residential neighborhoods. The above ground pools had ladders, but the in-ground pools were simply surrounded by grass. This isn't realistic. All of the in-ground pools I've seen, including the one in my own back yard, have decks around them. So I placed a randomly selected concrete or wooden deck on the ground between the pool and the house. In rare occasions there was some other object between the pool and house, so the deck is omitted in that case. I added some additional random variation that extends the deck to the length of either the house, the pool, or both rather than only inserting it between the shared edges of the two objects. Sometimes the deck will line up with the back yard fence, which I think is a nice touch. This was a minor change that was easy to add.
As expected, two images of concrete and wood pool decks. I think I need to add more details around these pools to make them look interesting.
Simple concrete pool deck placed between the house and a rectangular in-ground swimming pool, enclosed by a fence. |
Another swimming pool with a long wooden deck connecting it to the house. |
House Balconies
Some of the other procedural building posts and videos I looked at included balconies in their residential buildings. I decided to use the exterior geometry system yet again to add balconies to upper floor rooms of some houses. There are a variety of different balcony styles with wood slats, metal railings, and 45-degree rotated railings, possibly with metal trim of different colors.
Next, I added potted plants to some balconies. These initially didn't work well because the plant leaves aren't drawn as they're on the wrong side of the transparent windows. It took me awhile to rearrange the transparent and alpha mask drawing code to make this work properly. I plan to add small tables and chairs to balconies, but I haven't gotten around to doing that yet.
Balconies are somewhat incomplete at this point and have some issues. First, they're not actually connected to the houses with a door, so the player can't walk out on them. Adding this type of door appears to be complex and difficult. I have the same problem with fire escapes. It may require significant changes to the building creation control flow because currently the balconies (and fire escapes) are added after the doors and windows.
Second, the lighting and shadows aren't quite right. Since balconies are between the exterior and interior, they should have interior light shining through the windows onto them. At this point they don't. Balconies receive shadows from the house but don't self shadow because room objects don't contribute to the sun and moon shadow pass. This also means they don't shadow the rest of the house or the ground below them. I don't have a good fix for this, so I'm hoping the player doesn't notice. I actually didn't notice the lack of shadows at first.
I'll add several screenshots this time since balconies come in so many varieties. I also changed some settings and fixed a few things (like the missing plant leaves) in the process of taking these.
A house with a small balcony with white metal railings and an empty flower pot. The edge (non-corner) railings are rotated 45 degrees just to show I can add shapes other than axis aligned cubes! |
Balcony with wooden slat sides and black metal railing and edges. |
A longer railing along the side of a house, this time with a black metal railing and bars. This one has two "empty" flower pots. |
A balcony with wooden sides and a brown railing, with two flower pots. These ones have actual plants because I fixed the alpha mask material drawing to work outdoors. |
I should probably add vertical posts to support the corners of some of the larger balconies. That means I do have to figure out how to enable collision detection for what are supposed to be indoor room objects that happen to be placed outside the house. The lack of shadows may also be more obvious when I add the posts. I'll have to experiment with this later.
I think this post is long enough now. The next post will probably be on the topic of stop signs.
I seem to recall you implemented spreading fires at some point. In forests perhaps? If not, maybe the rug could smolder for a bit longer?
ReplyDeleteThe question of which plumbing fixtures need a vent is both simple and complicated. The simple answer is, every plumbing fixture needs a vent. The complicated part is that the vents can be combined, and often are. Practically speaking, each wall/room with plumbing fixtures gets its own plumbing vent, though buildings are often designed to minimize the number of "wet walls" and thereby the amount of plumbing.
Good to see some sprinkler heads on your fire protection system! Just FYI, it's more common for them to be head-down, but head-up as you have is acceptable, depending on application, building code, and aesthetic preference.
Ahh, newsracks! Now I see where the zombies are coming from.
Cool water towers! I think you already have air-conditioning rooftop units being generated? I would expect most buildings to have most of these features at the same time. Maybe you can use some of the cubicle code to place multiples on the roof so they don't intersect? Also, many buildings have parapets (walls) on the roof for safety and aesthetics.
Now that you have underwater effects in the basements... do you think you could make the pools usable? Maybe all the pools in the city are connected by tunnels as well? Think about it.
Cool balconies! And, if you need some more variety of potted plants, I've got you covered:
https://skfb.ly/opS6O
https://skfb.ly/opS6n
https://skfb.ly/opS6X
Yes, I had forest and grass fires. That uses a different system which interacts with the vegetation. This works because vegetation is formed from many small triangles that can be individually turned black or turned transparent to remove them. Buildings are more difficult because their walls, ceilings, and floors are big flat quads. Decals can be added though.
DeleteMy reference image for parking garage sprinklers was head up. I'll change them to be a random mix of head up and head down.
Some buildings have rooftop AC units, most of the ones with flat roofs. Houses have their AC units on the ground. It's a good idea to add an array of AC units, that should be pretty easy. Some buildings already have rooftop walls, but not the round ones like in that screenshot.
Yes, I was thinking of using my water rendering for swimming pools. I was actually going to add indoor pools first since it's easier. Outdoor pools requires making my water system work with outdoor lighting. Outdoor pools also require removing the terrain at the pool opening, which could be tricky.
Thanks, I'll take a look at your potted plant models.