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 presumes 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 and just remove any AkSurfaceReflector components.

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 under the Master Audio Bus called SmallRoom and LargeRoom. In the Auxiliary Bus Property Editor,
    1. Under the Effects tab, add the Wwise RoomVerb effect. I chose two different factory presets: Rooms/Room_Medium for SmallRoom and Cathedrals/Medium for LargeRoom.
      Auxiliary Bus Property Editor Effects tab for rooms
    2. Under the Positioning tab, enable Listener Relative Routing and select Position + Orientation for the 3D Spatialization. Adding an attenuation on this Auxiliary Bus will customize the attenuation of the sound going through portals.
      Auxiliary Bus Property Editor Positioning tab for Rooms
  2. 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
  3. Save your project.

B. Spatial Audio Emitter

We need to modify the spatial audio emitter to use our newly created reflect aux bus.

  1. Refresh your Wwise project in the Wwise Picker: Windows > Wwise Picker
    1. Generate SoundBanks
      Wwise Picker
  2. Modify the AkSpatialAudioEmitter component of each button.
    1. Apply a gain of 1 for the Room Reverb Aux Bus Gain parameter.
    2. Check Draw Diffraction Paths under Debug Draw.
      AkSpatialAudioEmitter for Rooms and Portals
  3. We will use rooms in the next section, so we need to add a Rigidbody component to our emitter; as explained in the warning message on the AkGameObj component.
    1. Click on Add Rigidbody
      AkGameObj component

C. 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 SmallRoom or LargeRoom Auxiliary Busses for Reverb Aux Bus.
      2. If you added a Rigidbody to your emitters, you don't need one here. If not, click on Add Rigidbody.
        AkRoom component
  2. Start the game, connect to Wwise and go to the Game Object Profiler layout (shortcut F12).
    1. In the Game Object 3D Viewer, you should see each emitter in their respective rooms. The next image is a top view of the scene. The listener and Button Outside are not in a room, so they are put by default in the "Outdoors" room.
      Emitters in their respective rooms and the Listener Outdoors
    2. Move the listener to a room and see the room name change under the listener game object in the Game Object 3D Viewer. In the following image, the listener is in the large room.
      Emitters in their respective rooms and the Listener in the Large Room Interior
  3. 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. When a listener is in a different room than the emitter, the sound is completely occluded. You will need to add portals to hear the sound coming from rooms through desired openings.
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.

D. Portals

Each Room needs a Portal to be connected to another area. 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
  5. Start the game.
    1. In the Scene window, you should see green paths indicating where the sound is coming from through the portal. The percentage of diffraction applied to the sound is displayed at the point of diffraction.
      Top view of diffraction paths through a portal
    2. 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, 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.
        Diffraction paths through a portal in the Game Object 3D Viewer
    3. Move in and out of sight of a 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: At this point, if you change the position of the rooms or multi-edit portals, the front and back rooms will not update, unless you open each individual AkRoomPortal inspector. In a scene with a lot of portals, this is not convenient, so you can use the Portal Baker window we added as an example in this tutorial. Open the window from the menu: Wwise > AkRoomPortal Baker... Click the bake button to update the front and back rooms of all the portals in the scene.

E. Portals and Reverb

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

  1. Open the SmallRoom Auxiliary Bus Property Editor and check Use game-defined auxiliary sends in the General Settings tab. This will send the small Room 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

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