I'm back to working on building interiors. I wanted to add more wear and damage to buildings, in particular the maze-like extended basement hallways. They're currently somewhat plain with no objects on the floor, and only rows of doors to either side, with an occasional picture on the wall or rug on the floor. It's too easy to get lost because there are no real landmarks, since every hallway looks similar. The cracks and water damage I added a while back applies uniformly to each room.
I've added more localized damage: missing ceiling tiles, broken lights, trash on the floor, mushrooms, graffiti, and holes in walls. I'll go into more detail on each of these topics below, listed in the order in which I added them.
Missing Ceiling Tiles
My first change was to cut out some areas of basement ceilings to add missing acoustic tiles. Any hallway that's selected to have missing tiles gets an additional rectangular space above the ceiling. This is only legal for underground rooms that have sufficient space between the bottom of the ceiling and the terrain or buildings above. Multiple tiles can be removed per hallway, and they end up as randomly placed and rotated rectangular objects on the floor that the player can pick up and add to their inventory.
The space above the ceiling is filled with pipes, ducts, wires, and spider webs. These are only placed in locations where they're visible through the openings. The pipes and ducts aren't actually connected to anything yet. I added hanging electrical wires to the corners of some tiles. Sometimes missing tiles are adjacent to ceiling lights, so I had to add metal support brackets to the lights to keep them from floating in space if their surrounding tiles are removed. The walls inside the ceiling space are textured with concrete and have per-vertex lighting where the brightness varies based on the distance to the nearest opening. This makes the space lit above the opening while extending into darkness. I added a brown frame around the edges of each opening to give it some thickness and fill the gaps next to the walls.
Surprisingly, the most difficult step was aligning the texture to tile exactly to the width and length of the hallway in a way where I could calculate the exact coordinates of individual tiles. This required varying the length and width of a tile's texture coordinates to match the room dimensions, and then recording enough info about this to reconstruct the grid in the part of the code that places objects. The ceiling itself is drawn by the "building interior" system, while the tiles and holes themselves are drawn by the "room object" system, using different drawing code.
![]() |
| Extended basement hallway with a missing ceiling tile, showing pipes and a round duct in the ceiling and a hanging wire by the doorway. |
The player, people, zombies, and rats can all walk over any ceiling tiles on the floor. Spiders will avoid them as their legs will clip through, and they will also avoid the openings in the ceiling. I haven't written the code for spiders to use these spaces yet. Technically, the area is outside the building.
![]() |
| Hallway with ceiling tiles that fell onto the floor, exposing pipes and a rectangular duct. This person will walk over the tiles. |
Tiles placed on the floor are added within a small distance from their previous spot on the ceiling and in a random orientation. They're constrained to avoid the path of doors and stairs. Hallways don't have any other objects on the floors that must be avoided. This is helpful because I don't actually have a list of colliders for each room, since they're added in an earlier step than the ceiling tiles.
![]() |
| Another hallway with missing ceiling tiles and stairs at the far end. |
Broken Ceiling Lights
There are two new types of broken ceiling lights found in extended basements. The first is a light that's missing the outer plastic cover and has the inner fluorescent tubes visible. These are emissive when the light is on. I added reflectors to the sides that function as mirrors using the cube map reflections added in an earlier post. This doesn't work all that well though, since the reflections are centered on the camera. This often means the lights reflect the texture of the floor under the player. That's why the reflectors look like concrete in the image below.
The second addition is a light that's fallen down and is hanging vertically by one end. These lights are rotated by 90 degrees and have a horizontal spotlight pattern that produces bright walls on one side and dark hallways on the other.
I originally wanted to make these colliders for the player, building people, and zombies. The player can easily walk around them. It's annoying to have to do so, but I usually find myself walking around them even if they don't have collision enabled. The problem is that the person/zombie AI path finding may not be able to navigate around these hanging lights in narrow hallways. I had to add sufficient clearance to the path finding to prevent 3D models from clipping through objects in any animation frame. The primary goal of gameplay is that each room can be navigated by the AI as they chase the player. It's no fund if a zombie can't follow you down a hallway. So for now I'm not making these lights collidable, and people may clip through them when walking.
![]() |
| This ceiling light has fallen down and is hanging by one end. The light emitted is now horizontal rather than vertical, leaving a dark hallway behind it. |
Mushrooms
Ah, mushrooms. These can be found in extended basements with wetness > 50%. I originally added these as decorations placed in groups of 2-3 along walls and in corners of rooms. Later I decided the player should be able to pick and eat them, and they would serve a gameplay purpose. The effects must be generally positive to encourage the player to walk around picking them up. But I also wanted to add a negative effect so that they're not too overpowered, considering how many mushrooms can be found in some areas.
I had a lot of fun writing postprocessing effect shaders for when the player was drunk a few years ago. I already had a wavy image shader, a blur shader, and a double vision shader. The problem with double vision is that it only happens when the player is extremely drunk, which is rare considering the sparse placement of alcoholic drinks and the fact that you can't drink the bottles found on store shelves. So I reused the double vision shader for one species of mushrooms. This is implemented as an effect that lasts for 10 seconds and then slowly fades away. It's stackable, so eating multiple mushrooms in a short period of time will extend the effect's duration.
But one effect is no fun. I need more variety. I added two more mushroom types with different stats, and two new shader effects. Now I have:
- White Mushroom: +25% health, 10s of double vision
- Red Mushroom: +25% drunk/high (damage reduction), 10s of psycho color effects
- Red with White Spots Mushroom: 30s of invincibility, -25% health, 30s of floating/moving colored spots
All of these effects are very disorienting and distracting. What's great is that they stack/accumulate as well, so you can have two or all three active at once. And to encourage this, I added the 25% health loss for spotted mushrooms so that the player is more likely to eat a white mushroom at the same time to gain back the health. All three shaders were fun to create, a nice break from generating building geometry. The double vision and color changing shaders look very good to me. The floating dots shader was more of an experiment with GPU based particle simulation, and consists of 40 brightly colored emissive circles that float across the screen in random directions and speed, with randomly varying size/intensity and color.
![]() |
| Extended basement room with small white mushrooms against the wall and in the corner. The picture on the left is one of my shader generated procedural art images. |
I would like to add that the framed picture on the left is one of the shader-based images I added a few months ago. I found several interesting shader effects, including various types of fractals and noise, and render these to images that are then used as pictures placed on room walls. Each picture uses a random time or position offset so that each one is unique.
Mushrooms are placed non-uniformly across rooms. Most rooms have none, but some rooms have quite a few. In fact you can sometimes find a single room that has all three mushroom types. Here is such a room.
![]() |
| A bathroom with all three mushroom types: red with white spots in the front left, red in the back center, and white in the back right corner. The picture on the right is another shader effect. |
Here are some screenshots of the three shader effects. The first effect is double vision.
![]() |
| Double Vision: Makes is very difficult to pick up and interact with objects. |
Then we have the newer color changing shader effect. Input colors are mapped to bright reds, blues, and greens. If you think this image is bad, imagine what it's like when the colors are constantly moving!
![]() |
| Trippy Colors: This is done by applying a nonlinear equation to the RGB color values to get a very different set of RGB values out, plus it varies with time. Very disorienting. |
And finally we have the random colored dots shader. This is supposed to simulate some sort of hallucinations or spots in the player's vision. These are constantly moving and changing, which makes them very distracting to gameplay. At least the player is invincible during this time. Eating too many of these mushrooms in a short period of time will lead to death.
![]() |
| Floating Dots: 2D screen space particle simulation with bright circles that move and change size/color. Maybe not as bad as the other effects, but still distracting. |
And here's a video showing all of these in action. The screenshots aren't enough to show just how difficult it is to play the game with these effects active. I even got lost in the basement in the video.
Graffiti
I've been wanting to add graffiti to 3DWorld's buildings for a while now. My daughter recently had a school art project where she had to draw graffiti, and I think that's what finally pushed me to add it to my buildings. I initially started by looking for free textures I could use, but I couldn't find any really good ones. Most of them weren't alpha masked and were difficult to separate the paint from the background wall image. Many of them had art or letters clipped, or other non-graffiti objects. It's not enough to select a few of these images. I probably need at least ten to avoid being too repetitive.
So instead I did what I always do, and turned to procedural generation. But how? I couldn't find any good approaches described online. There was an Unreal Engine graffiti plugin, but it looked too complex to include in 3DWorld and required a variety of input art assets such as a custom character font. I have no experience with graffiti and can't even read the text in many of the reference images. That doesn't help.
I eventually gave up trying to do something complex and went with a simple set of random overlapping lines with varying thickness in a rectangular area. This is very similar to how I implemented spray paint, and it even uses the same rendering system. The only big difference is that it's formed from lines rather than dots, which means I can get more color with fewer vertices. But it still looks very close to something the player can create with the spray paint can.
![]() |
| Extended basement hallway with graffiti on the walls, both sides. |
These graffiti "blobs" are placed at random locations along hallway walls. They're applied over vents, outlets, and light switches. I limited them to hallways because there aren't any other objects blocking the walls. For example, it definitely looks wrong to have graffiti on the wall behind a machine in a machine room. I still sometimes see pictures hanging over graffiti, but I guess we can assume someone put them up to cover it.
I originally had a check that each new graffiti region had no overlaps with any previously placed graffiti. Then I realized that overlapping multiple colors actually looked better. Each stroke is applied over the previous stroke and alpha blended on top of it for a natural looking spray paint effect. I changed the code so that it sometimes places new graffiti at the same location as the previous graffiti using a different color. The screenshot below shows what this looks like.
![]() |
| A second hallway with more graffiti, this time with overlapping colors. Also, more missing ceiling tiles. |
I know, it's not the greatest result. These aren't real letters or symbols. It somewhat reminds me of those paint lines added to roads and sidewalks to mark where the pipes are before digging. However, it does make each hallway feel more unique. I'm sure it also helps the player find their way through these hallway mazes. "Turn right at the orange and white paint blob."
Holes/Gaps in Walls
This was the last effect I added. Holes in walls are a great complement to holes in ceilings. I originally wanted to cut larger numbers of irregular circular holes in extended basement walls, but I couldn't find a visually pleasing and efficient way to do this. It's not so easy to subtract 3D geometry, and the building interior system doesn't currently support alpha blending, alpha testing, or masking of walls/ceilings/floors. The best solution I could find was to remove entire rectangular sections of walls (and trim) and then add parts of them back in to create a final large and irregular "hole". I cut at most one hole into random walls that are at least a minimum length and not adjacent to neighboring rooms.
Wall gaps are visual effects only. They function just like regular walls for blocking the player, building AI, animals, balls, etc. Only cockroaches can pass through them.
I drew a plywood surface on the back side of the wall and added vertical wooden studs about every 16 inches horizontally, plus an extra 2x4 along the top and bottom to cover the ceiling and floor gaps. Then I added a number of pipes and Romex wire cables in multiple colors that cross through the studs from left to right at various heights. This combination should model a realistic wall interior.
I wanted to have rough, broken edges on the plaster, so I extended the edges toward the center using points randomly displaced both horizontally and vertically. These are textured to match the walls to either side with no visible seam. The edges of the front face (the sheet rock) are also drawn as thin quads. Each edge has unique procedural geometry for a more natural look. The only limitation is that cracks drawn on the wall with a special shader aren't added to these extended triangles because it uses a different control flow and different shader settings.
![]() |
| Extended basement hallway with many cracks and missing sections of wall on both sides. Conduits/pipes and wires are visible through the holes. |
I think the wet basement shader effect looks pretty good on these wall cutouts. The increased specular component interacts well with the normal maps on the wooden studs to make them appear slimy. Should there be plaster/stucco triangle fragments on the floor as well?
![]() |
| Broken section of wall with a wet shader effect applied to it. |
Some walls have that pink fiberglass insulation inside them. I'm reusing my "cotton candy" texture from house attics. Here's the post, but I don't seem to have an image with that insulation in it. This is actually a cloud texture where I've changed the sky color from blue to pink and kept the clouds as white. It's not the greatest and has no normal map, but it seems to do the job.
![]() |
| Missing wall with pink fiberglass insulation visible through the hole. |
The wood in the previous screenshots was dark and rough. I experimented with a few other lighter wood textures with more fine details until I found one that I liked. This is shown below. It's still not the typical light lumber texture with darker knots in the wood. The problem with that texture is the repeating pattern of the knots that looks artificial when tiled over all wood elements.
![]() |
| Missing plaster section with a lighter wood texture. Also, more mushrooms. |
Is this lighter texture better than the darker one? It makes the wood look more fresh, but that's not exactly the look I'm going for. As a compromise, I set 50% of buildings to use each of the two textures.
What else can I add? Maybe some of these walls should allow the player to walk through them and connect to other rooms or caves. That would certainly be interesting. I'll have to consider caves for my next post topic.
















No comments:
Post a Comment