3D sounds in building - adopt room shape?

Ray tracing/casting is a demanding process, so if you just want to switch between states of “how to sound”, I suggest the following which I use often and also implemented in proprietary game engines with success.

Organization

  1. Group all sources to “outdoors” and “indoors” groups.
  2. Route those groups to different filters, one for each group.
  3. In your room prefabs (or model groups) include a collision box.
  4. Put a tag on each collision box depending on how much its structure blocks the sound transmission to the other side of the wall.

Logic

  1. Each time the listener (player) enters or exits a room, a trigger will be send to switch on or off the corresponding filter.
  2. Depending on the tag of each collision box, different presets loads on the corresponding filter, to simulate none/light/medium/heavy/complete occlusion. That way you also simulate from fences and lights walls, to heavy forts and caves.

Some more ideas

  • You can find more clever ways to route sources to groups or switch between presets, depending on the way the audio engine functions and how you setup your game mechanisms.
  • You can setup different reverb processing with the same logic and omit the Unity reverb zones altogether, to achieve similar simulation for the reverb, which is better in my opinion.
  • Using different reverbs in groups can also allow for sounds to feature the reverb that belongs to where they are located. For example, you are out of a cathedral and another character is in the cathedral, so you hear his voice with the cathedral’s reverb and muffled from the cathedral walls. But that depends on how you designed your system and of course maybe your game simulation does not need it at, so it adds no value.

The secret here is your game’s metadata, how you tag things in your level, so that you can create rules that follow specific logic according to tags. Indoor/outdoor, light/medium/heavy, nature/closet/room/hall/unreal, etc. All those can be tags of your level assets, building, models, etc., and then you use that to build switching mechanisms that boost immersion.