Recreating Unreal's Ambient Zone Feature in Unity

#1

Hey there,

I really like the FMOD integration features in Unreal. Therefore I was wondering if it is possible to bring Ambient Zones with a custom script to Unity.

The Masterplan

Recreating the “Ambient Zone” feature of Unreal’s “Audio Volume” for Unity.

What are Ambient Zones

With Ambient Zones it is possible to change the soundscape for a certain area. Based on the player’s position, the FMOD event emitters inside and outside the box are modified in volume and frequency.

There are several settings available to modify the sounds.

When is this useful

  • If the player enters a small house and the outside ambience should be lowered and muffled
  • If the player is outside a club and we want to hear the muffled music from inside. As soon as the player enters the club, the music gets louder and clearer
  • Almost any small environment changes like a small forest on a hillside, an open cave in the mountains etc.

How it works

Within FMOD all the events that should be affected by the Ambient Zone must have set “Ambient | 1” as a “User Property”. For the LPF there needs to be a “Lowpass” effect inserted on the event’s master track. And that’s it. Everything else is done within Unreal using the Ambient Zone’s settings. Unreal somehow calculates itself whether the sound source is inside or outside the box and marks them therefore interior and exterior.

What needs to be done

I don’t know if it is even possible to set this up in Unity, but the basic idea is this:

When the game starts, Unity gets a list of all events with the User Property set to “Ambient | 1”. Afterwards the world position of these events is calculated and divide into 2 groups: Interior and Exterior of the box. When entering or exiting the box, a trigger will send the values set in the inspector to FMOD and drive parameters for the corresponding events.

Wait a second, can’t this all be done using snapshots?

Yes, absolutely. Whenever the player enters a certain area, there could be a trigger which is connected to a snapshot setting the volumes and filters. However, depending on the complexity of the map, there can be dozens of such areas. As snapshots only apply to groups and returns, this could easily end up in a routing chaos.

The Ambient Zone will do a lot of this work just for us.

So what now?

Well, I just wanted to know if any of the required steps described above is even possible. Like getting a list of events with a certain user property or arrange them in groups (not mixer groups) based on their position within the game.

1 Like

#2

First of all, great write up! Super easy to read and understand.

You can see the way we have done this in the UE4 integration, specifically the FMODAudioComponent.
It uses the values from the Ambient Zone Settings to calculate values and apply them to parameters on the event. One parameter for controlling the LPF and the other for volume. The calculations for these values have been taken from the UE4 ActiveSound.cpp.

You would likely need to create a system that tells you what zone the listener and the Event are in, so you can set the filter and volume parameters accordingly.

This is definitely something that is doable, although may require a bit of work to set up initially. UE4 has a few built in features specifically designed for this which makes it looks so easy. At least by making this yourself, you can make it as simple or as complicated as you like.

Adding something like isn’t currently something that we have on our roadmap but I will add this as a task to investigate further.

0 Likes