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, make sure diffraction and transmission are enabled.
      Enable Diffraction and Transmission in the Positioning tab of the Sound Property Editor
  3. By default, diffraction will be filtered by obstruction, and transmission loss will be filtered by occlusion. 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 Curve Type
      X Y X Y
      Obstruction Volume 0 0 100 -3 Linear
      Obstruction LPF 0 0 100 60 Linear
      Occlusion Volume 0 0 100 -12 Sine (Constant Power Fade In)
      Occlusion LPF 0 0 100 75 Sine (Constant Power Fade Out)
    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 blocked by the "room's walls". You can set a transmission loss value to them (see /ref pg_obs_occ). Otherwise, you need to add portals to have direct sound propagation from desired openings. In the SpatialAudioTutorial scene, there are two openings where we could put 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 and connect to Wwise.
    1. Press the button in one of the rooms to hear the reverb.
      1. The voice graph should look like this:
        Voice Graph with Rooms
    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.
      1. In the Unity Scene window, you should see paths indicating the sound coming from the portals. The percentage of diffraction applied to the sound is displayed at the point of diffraction.
        Top view of diffraction paths through a portal
    3. Open the Game Object Profiler layout of the Authoring (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
    4. In the Game Object 3D Viewer, you should see:
      1. a visualization of the rooms and portals.
      2. diffraction paths from the emitter to the listener going through portals. A diffraction percentage is shown at each edge. Notice the apparition of a virtual source in green showing where the sound is actually coming from.
      3. transmission paths going through room walls with the percentage of transmission loss.
      4. Icons in the form of a house showing the wet sound of the room. In the image, there is one coming out of portals and one representing the sound going through the walls of the room.
      5. Each emitter/listener shows their respective room under their name. The listener is not in a room, so it is 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
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. We call this Room Coupling.

  1. Open the a room's Auxiliary Bus Property Editor and make sure Use game-defined auxiliary sends is checked in the General Settings tab. This sends the room's reverb to other reverbs in the scene.
  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.
    Room Coupling in the Voice 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.

See also

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
See also

Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise