Skip to end of metadata
Go to start of metadata

Overview

You can enable different Obstruction/Occlusion settings on the AudioTriggerSpot, AudioAreaEntity and AudioAreaAmbience properties in the Editor.
Using these settings correctly helps you to create a game world where Sound is realistically filtered and attenuated and according to it's surrounding environments.

You can set the SoundObstructionType property for the AudioTriggerSpot, AudioAreaEntity and AudioAreaAmbience in their Properties panel which can be found in the RollupBar.
All Audio Entities default to SingleRay as their SoundObstructionType setting.

 

 

Property

Description
No AttenuationNo Raycasts are applied and the sound is unaffected by other objects in the Game World.
Single RayThe Entity shoots a SingleRay in order to calculate the treatment the Sound receives - depending on the position and physical properties of the objects found between the source and the listener.
Multiple RaysThe Entity shoots MultipleRays in order to calculate the treatment the sound receives - depending on the position and physical properties of the objects found between the source and the listener.
Icon

For each Audio Object then it's good practice to see which SoundObstructionType works best and to choose No Attenuation when there is no advantage gained from having Obstruction/Occlusion calculated.
Choose MultipleRays only if the accuracy of the single Raycast is not sufficient, or if you want the Entity to be able to calculate both the Occlusion and Obstruction separately.

Icon
The Raycasts are skipped for the Entities that don't have an active playing ATL trigger, even when the SoundObstructionType is set to SingleRay or MultipleRays.

Sound Obstruction/Occlusion

Occlusion 

Occlusion is applied to a Sound source that is completely or partially hidden from the listener by the other game object (s).

In the ENGINE a non-zero Occlusion value is set for a Sound source whenever at least one ray that is cast from that source encounters a surface with non-zero sound_obstruction value.
The sound_obstruction values from the surfaces hit by the ray are accumulated and the total values are averaged over time for each ray to produce this ray's Occlusion value (shown in the ray label enabled with s_DrawAudioDebug h flag). With the SingleRay SoundObstructionType the Audio Object Occlusion value is equal to its only ray's Occlusion value; with MultipleRays SoundObstructionType the Audio Object Occlusion value is the average of the Occlusion values for all the rays.


Icon
The Occlusion treatment is applied to the Audio signal before it is sent to the environment aux buses, therefore it affects both the dry and the wet signal.

 

 

Icon

s_OcclusionMaxDistance allows you to set a maximum distance beyond which the sound Obstruction/Occlusion calculations are disabled.
For example, "s_OcclusionMaxDistance = 150" will cause the ENGINE to calculate the Obstruction/Occlusion values for every active Audio Object with SoundObstructionType set to SingleRay or MultipleRays providing they are located within 150m from the Sound's Listener.

 

For a full reference of the ATL CVars in the Editor please see ATL Console Commands.

Obstruction

Obstruction is applied to a Sound source if the Occlusion value of the Center Ray from a Raycast is different from the average of the Occlusion values of the Outer Rays from the same Raycast.

Therefore, Obstuction will only be calculated when the SoundObstructionType is set to MultipleRays on the Entity, since a single ray does not provide enough information to differentiate between the Obstruction and Occlusion.

NOTE: The Obstruction treatment is applied to the Sound after the Occlusion treatment and in addition to it. 

NOTE: If the center ray of a Raycast has reached the listener without being blocked and the outer rays are fully or partially blocked by game objects, then the Obstruction value is set to zero and only the Occlusion value is positive.

 

Icon
The Obstruction treatment is only applied to the dry signal, it has no effect on the signal sent to the environment aux buses.

 

 

Obstruction is also affected by the distance of the Raycasting Entity to the Listener. As the distance increases, the Obstruction value decreases and the difference is transferred to the Occlusion value. This reflects the fact that with increasing distance the contribution of the direct line-of-sight Sound path in the overall Sound perception becomes progressively smaller.

 

Icon

s_FullObstructionMaxDistance sets the maximum distance after which the Obstruction value starts to decrease with distance.
For example, "s_FullObstructionMaxDistance = 5" means that for the sources that are farther than 5m away from the listener the Obstruction value will be lower than the actual value calculated from the Raycast. In this case, an object 10m away will have half the obstruction value of the similarly obstructed source located 5m away.

 

For a full reference of the ATL CVars in the Editor please see ATL Console Commands.

Synchronous vs Asynchronous Raycasts

The Raycasts used to calculate the Occlusion/Obstruction values can be performed synchronously (all individual ray's occlusions are available immediately in the same frame the Raycast has been requested) or asynchronously (the individual ray data is received over the next few frames and processed once all of the rays have reported back). Clearly, the synchronous Raycasts are much more responsive, but they also require more processing resources, and can cause performance spikes if a large number of Raycasts are performed in a single frame. In order to save resources and avoid performance spikes the ENGINE switches between synchronous and asynchronous Raycasts based on the distance between the Sound source and the listener. For the sources close to the listener, the synchronous casts are used to provide a max responsive environment, for the sources further away the ENGINE uses asynchronous casts.

 

Icon

s_OcclusionMaxSynchDistance sets the distance after which only asynchronous Raycasts are used for Occlusion/Obstruction calculations.
For example, "s_FullObstructionMaxDistance = 10" means that for the sources within 10m from the listener the Raycast will be executed synchronously, and for the sources farther than 10m they will be executed asynchronously.

 

For a full reference of the ATL CVars in the Editor please see ATL Console Commands.

Setting Surface Sound Obstruction Value

For each SurfaceType in your game you can define how much it affects the Sound passing through it.
The sound_obstruction Physics property is a value between 0 and 1. For each Raycast from a Sound source, the ray's Occlusion value increases by the sound_obstruction value of each surface it intersects.

Values for each SurfaceType can be set in the \Libs\MaterialEffects\SurfaceTypes.xml. The exact effect that this value has on the Audio Content of your Game will be defined in your Audio Middleware.

 

Example:

 

In this example the SurfaceType mat_fabric would have a sound_obstruction of 0.5 applied to the Sound.
For this material with a sound_obstruction = 0.5 the maximum Obstruction/Occlusion value that will be reached in the game is 0.5.
Therefore, if the Sound would be fully occluded by one object with this surface type, the Occlusion value shown in the Editor Debug and passed to the Audio Middleware will be 0.5.

If the Sound would also be Obstructed the combined values of Obstruction and Occlusion would be summing to 0.5. However, their sum would never exceed this maximum value as it is defined as the maximal Obstruction/Occlusion value in the sound_obstruction for the material.

Debugging Raycast in the Editor

There are three specific flags in the s_DrawAudioDebug CVar that will allow you to easily see in the Editor the values calculated by the Raycasts.

 

s_DrawAudioDebug

b: Show text labels for active Audio Objects. (this includes the current Obstruction (Obst.) and Occlusion (Occl.) value)
g
: Draw occlusion rays.
h: Show occlusion ray labels.

For a full reference of the ATL CVars in the Editor please see ATL Console Commands.

 

s_DrawAudioDebug gh


AudioTriggerSpot with SingleRay enabled in its SoundObstructionType properties.

 

AudioTriggerSpot with MultipleRays enabled in its SoundObstructionType properties.

 

To learn how to setup SoundObstruction/Occlusion in Wwise please see here.

  • No labels