Version
menu_open
Wwise Unity Integration Documentation
Rooms and Portals Tutorial

This tutorial will show you how to use Rooms and Portals with Spatial Audio. The following sections detail each step in the tutorial:

Note: This tutorial assumes that you have completed the Preparation for the Spatial Audio Tutorials. However, it does not consider if the Surface Reflectors Tutorial was done; both tutorials are independent. If you did the Surface Reflectors Tutorial and wish to continue with this tutorial, you can do so without changing anything to your scene. If you wish to start anew, and you've done the Surface Reflectors Tutorial, you can still keep the same scene.

A. Wwise Project

For this tutorial, we will need to add Reverb Effects and modify Obstruction curves to hear diffraction through a portal when loosing sight of an emitter.

  1. Add two Auxiliary Busses using the room preset.
    1. Right-click the Master Audio Bus, navigate to New Child > Presets and select Room Auxiliary Bus
    2. Under the Effects tab, choose different effects for each room. For example: Rooms/Room_Medium for the small room and Cathedrals/Medium for the large room.
      Auxiliary Bus Property Editor Effects tab for rooms
  2. Modify the Sound added in Preparation for the Spatial Audio Tutorials
    1. In the Positioning tab, Enable Diffraction by checking the corresponding checkbox.
      Enable Diffraction in the Positioning tab of the Sound Property Editor
  3. Navigate to Project > Project Settings > Obstruction/Occlusion
    1. Change the Obstruction Volume and Obstruction LPF curves to your liking. For example, this is what is used in the Wwise Unity Demo scene project:
      Curve Point 1 Point 2
      X Y X Y
      Obstruction Volume 0 0 100 -3
      Obstruction LPF 0 0 100 60
    2. Here's how the Obstruction Volume curve looks like:
      Obstruction/Occlusion curves in the Wwise Project Settings
  4. Save your project.
  5. In the Unity project, refresh the banks in the Wwise Picker: Windows > Wwise Picker
    1. Generate SoundBanks
      Wwise Picker

B. Rooms

We need to specify where our rooms are in the scene. To do so, we will use the AkRoom component.

  1. In the tutorial scene in Wwise Unity Demo Scene, we added cube meshes representing the interior of each room in the building. If you are coming from the Surface Reflectors Tutorial, you can use the GameObjects with AkSurfaceReflector components.
    1. Add a cube with GameObject > 3D Object > Cube
    2. Remove the Mesh Renderer component.
    3. Check the Is Trigger in the Box Collider component.
    4. Add an AkRoom component.
      1. Pick the corresponding Auxiliary Bus for Reverb Aux Bus.
      2. A warning message will suggest that you add a Rigidbody component to the room. Notice that this will enable interactions between AkRoom components and AkRoomAwareObject components. The next step will help you add those components.
        AkRoom component
  2. Since we are using rooms, we need to make all of our listener and emitters "Room Aware" by adding the AkRoomAwareObject component.
    1. There already was an AkRoomAwareObject component added automatically to the Spatial Audio listener, make sure that component is enabled.
      AkRoomAwareObject component
    2. Like shown in the image above, you may have two warning messages.
      1. The first tells you a Rigidbody component needs to be placed either on the room or the current object. If you didn't add one on the room already, click on Add Rigidbody.
      2. The second warning message is about colliders. Every AkRoomAwareObject need to have a collider to interact with AkRoom components.

C. Portals

When a listener is in a different room than the emitter, the sound is completely occluded. You need to add portals to hear the sound coming from rooms through desired openings. In the Wwise Unity Demo Scene, we need two Portals: one on the opening between the outside area and the small Room and one between both Rooms.

  1. Create two AkRoomPortal components: GameObject > Wwise > Room Portal and place them around the openings.
  2. In the Scene window, a Portal is represented with a yellow ribbon around it indicating its size and the orientation in which it should be placed. The red line shows the separation between front and back areas of the Portal. The front is in the same direction as the local z axis.
    AkRoomPortal in the Scene window
  3. In the AkRoomPortal component:
    1. Open On Start.
    2. Close On Nothing.
    3. Make sure that the Back Room and Front Room display the right AkRoom components.
  4. This is how the AkRoomPortal component of the portal between the small room and outside will look like:
    AkRoomPortal component

D. Verify your Setup

  1. If you want to see the sound propagation paths drawn into the scene, you can add the AkSpatialAudioDebugDraw component to an emitter.
    1. Tick the Draw Diffraction Paths option.
      AkSpatialAudioDebugDraw component
  2. Start the game.
    1. Make sure at least one of the sound in the rooms is playing.
    2. When the listener is in a different room than the emitter, you should see green paths indicating where the sound is coming from through the portal in the Scene window. The percentage of diffraction applied to the sound is displayed at the point of diffraction.
      Top view of diffraction paths through a portal
  3. Connect to Wwise and go to the Game Object Profiler layout (shortcut F12)
    1. If not done already, make sure you enable Diffraction Paths in the Game Object 3D Viewer Settings.
      Game Object 3D Viewer Settings for Portal diffraction paths
    2. In the Game Object 3D Viewer,
      1. you should see diffraction paths coming from the different emitters to the listener through portals. Notice the apparition of a virtual source in green showing where the sound is actually coming from.
      2. You should notice each emitter/listener show their respective rooms. The listener and Button Outside are not in a room, so they are put by default in the "Outdoors" room.
        1. Move the listener to a room and see the room name change under the listener game object in the Game Object 3D Viewer.
          Diffraction paths through a portal in the Game Object 3D Viewer
  4. Press the button in one of the rooms to hear the reverb.
    1. In the small room, the voice graph should look like this:
      Button Small Room Voice Graph with Reverb
    2. Go out of the room and move in and out of sight of the playing emitter that is in a different room to hear the diffraction applied on the sound. You will hear more or less diffraction depending on the angle of the listener vs. the portal.
Note: To add a reverb outside, add a Room around the entire area. Make sure that the Room has a lower priority than the other AkRoom components of your scene.

E. Portals and Reverb

Sound emitted through Portals can also use the reverb from the Room the listener is in.

  1. Open the small room's Auxiliary Bus Property Editor and make sure Use game-defined auxiliary sends is checked in the General Settings tab. This sends the small room's reverb to other reverbs in the scene.
    Auxiliary Bus Property Editor General Settings tab to send room reverb to other reverbs
  2. When playing the small room emitter, and going into the large room, you will see the small room's reverb feeding into the large room's reverb.
    Small Room reverb sending to Large Room's reverb on the Voices Graph
Note:

The Wwise Unity Demo Scene, implements both the Surface Reflectors Tutorial and the Rooms and Portals Tutorial as well as diffraction. Head over to Additional Spatial Audio Features for more information.

F. Room Tones

Sometimes, rooms have a specific ambient sound like the buzzing sound of air conditioning. To recreate this, you can post an event on the Spatial Audio Room game object. When the listener will be in the room, the sound will be positioned at the location of the listener. When in a different room, the listener will hear the room tone from the portals connecting the room to the position of the listener.

  1. In the Wwise project,
    1. Create new Sound SFX for the room tone.
      1. Make sure you enable game-defined aux sends to send the room tone to the room reverb.
    2. Create a play event with the room tone by right-clicking on the Sound SFX, then selecting New Event > Play.
    3. Save your project.
  2. In Unity,
    1. Add this event to the Room Tone Event parameter, of the AkRoom component, of one of your rooms.
      1. Adjust the Aux Send Level to feed some of the sound to the reverb of the room.
      2. You can select how the event will be triggered.
        The AkEvent section of a Spatial Audio Volume with Room enabled.
  3. Generate SoundBanks.
  4. Start the scene and connect to Wwise Authoring.
  5. Verify that you can hear the room tone.
    1. In the Advanced Profiler view, you should see the event being played.
      Advanced Profiler view when the listener is in a room with a room tone
    2. In the 3D Game Object Viewer, you can watch the room game object as you move the listener around.
      1. If the listener is in the room, the room will emit at the position of the listener. You will see the room game object follow the listener game object.
      2. If the listener is in a different room, the room game object will be placed at the portal and a path will be drawn between it and the listener game object.
        Watch the room game object in the Game Object 3D Viewer

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise