Wwise SDK 2024.1.0
|
The geometry passed to Wwise Spatial Audio may be used to simulate diffraction and transmission of sound. As such, it can completely replace your game engine's raycasting methods for computing obstruction.
When an emitter is hidden from a listener by an object, Spatial Audio computes paths along its edges and, if some are found, computes the diffraction coefficient resulting from the sound bending around these edges. The apparent angle of incidence of the emitter is modified accordingly, and the diffraction value is sent to Wwise where you may control how it ultimately affects the sound. Typically, diffraction results in low-pass filtering.
Additionally, Spatial Audio computes sound paths going through geometry. Sound transmitting though an obstacle has a transmission loss coefficient applied to it, resulting from the surface properties assigned to the geometry via the API. Typically, transmission loss is modeled with a low-pass filter and a volume attenuation.
The image below is a screenshot of the Game Object 3D Viewer in Wwise. It shows a sound with a diffraction path, diffracting around the edges of a thin wall, and a transmission path with a transmission loss of 100%.
Warning: Geometric diffraction and transmission can be used to entirely replace your game engine's raycasting method for computing obstruction, however the performance cost grows with the complexity of the geometry. Geometry passed to Spatial Audio should be kept as simple as possible. Also, it is good to use the efficient Rooms and Portals abstraction (see Rooms and Portals) in conjunction with Geometric Diffraction in order to reduce the computational complexity of the latter. |
Geometric diffraction can be used to affect the direct sound propagation path between the emitter and listener, but also the path of its early reflections, when used in conjunction with Reflect.
Each geometry set that is passed to Spatial Audio needs to say explicitly whether it should be considered for calculating diffraction paths. This is done via the AkGeometryParams::EnableDiffraction
flag. This flag enables generation of edge data that is necessary for diffraction calculations, and is used for both geometric diffraction on the direct path and for diffraction of reflections.
Also, consider whether or not you want the boundary edges of a mesh to be able to diffract sound. For a given mesh, a boundary edge is defined as an edge that is connected to only one triangle and, therefore, exists on the boundary of the manifold. The complexity of the diffraction calculation increases with the number of edges, so the option should be disabled if your mesh contains boundary edges that should not diffract sound.
Finally, note that acoustic textures assigned to acoustic surfaces do not have any effect on diffraction because edge materials don't absorb energy. Edges simply bend sound.
There are no additional steps required to set up geometry for sound transmission, however it may be desirable to adjust the transmission loss coefficient for various geometry types. For example, a concrete structure is likely to block almost all sound transmission, whereas geometry composed of plywood may block significantly less sound.
Each AkTriangle
in the AkGeometryParams::Triangles
array contains AkTriangle::surface
, an index into the AkGeometryParams::Surfaces
array. The AkAcousticSurface::transmissionLoss
field describes how much transmission loss to apply to a sound transmitting though a triangle that references it. It is expressed as a value between 0 and 1. The transmission loss is converted to a percentage and then used to evaluate Wwise curves. The final volume attenuation and filter value applied to a sound with a given transmission loss will depend on the curves defined in the project. By default, the project transmission curve is used. Custom transmission curves can be created in the Attenuation ShareSet added to the sound. Transmission loss may also be applied as a built-in parameter and can be mapped to an RTPC.
By default, each geometry instance is treated as a collection of infinitely thin surfaces for the purpose of transmission. This means that when a transmission path passes through a geometry instance, it applies transmission loss at each triangle that the path intersects. A geometry instance can be marked as solid by using AkGeometryInstanceParams::IsSolid
. A solid geometry instance applies transmission loss every time a transmission path passes entirely through the geometry, recognized by two triangle intersections. The transmission loss applied is the max of the triangles intersected when entering and exiting the geometry. AkGeometryInstanceParams::IsSolid
has no effect when AkSpatialAudioInitSettings::eTransmissionOperation
is set to AkTransmissionOperation_Max
.
Note: A transmission path can pass through a solid geometry instance more than once. When this happens, transmission loss is applied each time a path enters and exits the shape through two triangle intersections. |
Refer to the Geometric Diffraction demo and its code in the Integration Demo Sample (in SDK/samples/IntegrationDemo) for an example of using geometry for the purpose of geometric diffraction of the direct path. Look for Spatial Audio Demos > Geometry Demo.
In the Positioning tab in the Wwise Authoring tool, ensure that Enable Diffraction and Transmission is checked. This box enables Spatial Audio features related to diffraction and transmission, including:
AkRoomParams::transmissionLoss
or a triangle's associated AkAcousticSurface::TransmissionLoss
.AkSpatialAudioInitSettings::bCalcEmitterVirtualPosition
is set.By default, the project diffraction curves are used for diffraction and the project transmission curves are used for transmission.
Custom curves for diffraction and transmission can be created by adding an Attenuation ShareSet to the sound. Use the Attenuation Editor to create custom curves on Volume, LPF and HPF and fine-tune them while monitoring. For more information, refer to the Applying Attenuation section of the Wwise Help.
Diffraction and transmission may be observed in the Game Object 3D Viewer, provided the proper profiling settings and view options are set (see the following images).
The calculated diffraction factor on a path from emitter to listener is displayed for each diffracting edge. Built-in Game Parameter values may be profiled by adding the bound Game Parameter to the Game Sync Monitor, and Obstruction and Diffraction may be profiled in the Profiler's Obs/Occ tab.
The calculated transmission loss factor is displayed beside the corresponding transmission path in the Game Object 3D Viewer. If the source of the transmission loss is from geometry, a hit point is indicated, with the accompanying transmission loss percentage. If the source of the transmission loss is from a room, the transmission loss percentage is displayed with the text "(Room)" appended below.
Like with Portals, the Diffraction value is 0 when the emitter is in direct sight of the listener, and it begins to increase as the emitter penetrates the shadow zone (see Diffraction). Also, please refer to Rooms and Portals' Diffraction for more details on shadow zone diffraction and for a discussion about using curves versus the Built-in Diffraction Game Parameter.
With Spatial Audio Rooms and Portals (Rooms and Portals), Portals also model diffraction of direct sounds in adjacent rooms. The two systems complement each other in that no geometry-driven diffraction paths are searched for emitters that are not in the same room as the listener. Provided that Rooms and Portals are much more efficient to calculate than geometry, it is beneficial to use both systems together to reduce computational complexity.
Refer to the Reflect Diffraction demo and its code in the Integration Demo Sample (in SDK/samples/IntegrationDemo) for an example of using geometry for the purpose of geometric diffraction of Early Reflections. Look for Spatial Audio Demos > Reflect Demo.
As was noted above, early reflections may diffract off of edges, and Spatial Audio supports modeling this phenomenon when emitters are routed to Reflect.
Prior to explaining how to do it, we need to define view zone diffraction.
Consider the figure below. The emitter is in direct sight of the listener, but the listener is not hit by specular reflections. It is thus in the view zone. As was said in Diffraction, diffraction occurs in the view zone as well. However, in Wwise Spatial Audio, neither the Rooms and Portals or Geometric Diffraction of direct path models consider diffraction in the view zone, as it is negligible compared to the actual direct path. However, for reflections, view zone diffraction has a dramatic impact. Without diffraction, early reflections are heard in the reflection zone only, where they are purely specular. As soon as the listener enters the view zone, reflections become silent. With diffraction enabled, the edge contributes to diffract the reflected wave. Thus, the listener perceives the reflection, albeit with additional filtering and attenuation as they go around and away from the reflection zone.
In the reflection zone, there is no diffracted path and, therefore, no diffraction value is calculated, because the specular reflection is assumed to take over. The calculated view zone diffraction of a given edge is 0% at the boundary between the reflection zone and the view zone, and 100% at the boundary between the view zone and the shadow zone.
With higher orders of early reflections, both view and shadow zone diffraction come into play.
In the Wwise Authoring Tool, set the desired early reflections send to an aux bus containing Reflect for all sounds requiring reflections. Refer to Wwise project setup for more details. There is no specific setting needed to enable diffraction for the purpose of reflections' diffraction, apart from enabling diffraction on the geometry.
Reflections that undergo diffraction effects will appear as image sources in Reflect. You may design the effect of diffraction on reflections with the three curves that depend on diffraction: Diffraction Attenuation, Diffraction LPF, and Diffraction HPF. See Reflect's documentation for more details.
Rooms and portals in Wwise Spatial Audio work in conjunction with the geometric APIs for reflection and diffraction. The rooms and portals network can be thought of a high level abstraction (or as a low level-of-detail version) of the surrounding geometry. With care, the combination of rooms and portals with level geometry can result in a acoustic simulation that is both detailed and efficient.
In the case where an emitter (assuming it is playing a sound that has been set up correctly for geometric diffraction, see Setting up a Sound for Diffraction and Transmission), is not in the same room as the listener, the geometric path is calculated as follows:
Reflections can pass through portals and can reflect off of walls on either or both sides of the portal. Reflections can pass through more than one portal, possibly reflecting on surfaces between them if the reflection order is high enough (refer to AkSpatialAudioInitSettings::uMaxReflectionOrder
). To ensure smooth reflections through portals, we recommend that you set AkSpatialAudioInitSettings::uDiffractionOnReflectionsOrder to at least 2, but be aware that increasing this setting also increases CPU usage.
Because the portal itself describes an acoustic opening, it is not necessary to also "cut holes" in the triangle geometry to allow a sound to pass through, which would greatly increase the number of triangles. A portal box represents negative space, so remember that any geometry that intersects a portal is effectively ignored, for example in a room where the geometry is described by a box, with two triangles for each of the six sides. To ensure that sound can propagate outside the box, add a portal that intersects one of the walls along the portal's z-axis.
When using the Simplified Reflect workflow, reflection paths that cross through a portal carry the occlusion value associated with that portal, set using AK::SpatialAudio::SetPortalObstructionAndOcclusion
. If a reflection path crosses multiple portals, it carries the highest portal occlusion value encountered along the path. For more information about the Simplified Reflect workflow, see Intended Reflect Workflow.
Note: Unlike diffraction, reflection paths through portals are not calculated independently for each room and then later combined. Instead, reflections are calculated exactly as if the emitter and listener were in the same room, and the portal is treated as a hole in the geometry.
|
The following image shows an example of a correctly oriented portal.
| |
| |
|
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageRegister your project and we'll help you get started with no strings attached!
Get started with Wwise