In the following steps, this tutorial will show you how to use the Reflect plug-in with Spatial Audio in Unity. You will need a Reflect plug-in license to generate SoundBanks, but you can still try it out when connected to Wwise Authoring.
A. Wwise Project
We need to update our Wwise project with an Auxiliary Bus with the Reflect plug-in and Acoustic Textures.
- Import the factory assets to get access to an Auxiliary Bus preset and factory Acoustic Textures.
- Navigate to Project > Import Factory Assets...
- Choose Reflect and Acoustic Textures and press OK.
- Acoustic Textures are located in the Virtual Acoustics folder in the ShareSets tab of the Project Explorer view.
Factory Reflect Acoustic Textures in the Project Explorer ShareSets tab
- (Optional) You can add custom Acoustic Textures in the Virtual Acoustics folder under Default Work Unit.
- Add an Auxiliary Bus for early reflections.
- Right-click on the Master Audio Bus, navigate to New Child > Presets and select Early Reflection Auxiliary Bus.
- Modify the Sound added in Preparation for the Spatial Audio Tutorials
- In the General Settings tab, add the newly created Auxiliary Bus with Reflect in the Early Reflections box.
Specify the Reflect Auxiliary Bus in the General Settings tab of the Sound Property Editor
- Save your project.
B. Unity Project
You can simulate early reflections on surfaces with the AkSurfaceReflector component. One way is to add the surface reflector component to an existing mesh of the game. If the shape is too complex, too many triangles will be sent to the Spatial Audio API and this could slow down your game. In this case, you may add a different mesh in the AkSurfaceReflector component itself; a collision mesh, for example. Another way to add reflective surfaces is to create a new GameObject. In the scene provided by the Wwise Unity Demo Scene, new objects were used for surface reflectors. Since the rooms are cube shaped, we used cubes with no mesh renderer.
- Create a cube: GameObject > 3D Object > Cube
- Remove the Mesh Renderer component
- Check the Is Trigger in the Box Collider component
- add an AkSurfaceReflector component.
- The mesh parameter can be left to None if the mesh from a MeshFilter component is to be used. If not, the wanted mesh can be added here.
- In the Acoustic Textures array, choose an acoustic texture for each submesh (there is only one submesh for the cube) or leave it at None to have an unfiltered reflection.
- In the Transmission Loss Values array, you can set the transmission loss value of the surfaces of each submesh. These will be used to filter the sound going through the mesh. Refer to the D. Transmission section for further details.
- You can enable diffraction with the Enable Diffraction checkbox. More details in the C. Diffraction section.
- Lastly, you can set an associated room that can be left to None for now. More details in the E. Associate rooms to Surface Reflectors (Optimization) section.
AkSurfaceReflector component
- The order of reflection is set in the AkWwiseInitializationSettings, under Spatial Audio Settings
- By default, the reflection Order is set to 1. You can set it up to 4.
Spatial Audio Init Settings
- If you want to see reflections paths drawn into the scene, you can add the AkSpatialAudioDebugDraw component to an emitter.
- Tick the reflections orders you want to be drawn.
AkSpatialAudioDebugDraw component
C. Verify your Setup
- In the Wwise Picker: Windows > Wwise Picker
- Generate SoundBanks
Wwise Picker
- Start the game and play one of the emitters.
- Connect the game in Wwise and go to the Profiler Layout. You should see a similar graph:
Voice Graph with Reflect Effect
- Double click on the highlighted Wwise Reflect under the Auxiliary Bus node in the graph to open the Reflect Effect Editor. When playing the sound, you should see the current reflections in the graph and the list. When there are two textures under the Texture(s) column, the reflection is a second order one.
- Here you can modify the attenuation curves of the reflections.
- If you don't see any reflections, make sure Max Distance is high enough compared to the reflection distance between the emitter and the listener.
Reflect Effect Editor View
- Navigate to the Game Object Profiler Layout (shortcut F12)
- If not done already, make sure you enable Reflection Paths and Reflection Image Sources in the Game Object 3D Viewer Settings.
Game Object 3D Viewer Settings for Reflect
- In the Game Object 3D Viewer, you should see surface reflectors and reflection paths between playing emitters and the spatial audio listener.
Game Object 3D Viewer
| Note: | If you can't see any geometry in the Game Object 3D viewer, you may need to increase the Monitor Queue Pool Size in the Initialization Settings. Refer to the following page Adjusting Wwise Initialization Settings. |
| Note: | Note that with a cube shaped surface reflector around the building, it is not possible to get any reflection paths from the emitters inside the building when the listener is outside, or vice versa, even if the emitters are playing. This is because the opening of the building is part of the reflective surface. This can be fixed by either only using the building's mesh as a surface reflector or by placing a portal around the opening. More on portals in the Rooms and Portals Tutorial. |
- See also
-