Skip to content

Concepts

Terminology

The way that sound propagates is impacted by objects that it collides with in a number of ways. Simply stated the interaction between sounds and objects may result in Obstruction, Occlusion, or Exclusion. Diffraction of sounds also occurs when they bend around obstacles or spread out as they pass through openings.

Obstruction:

The direct path of the sound is blocked, but you can hear the indirect reflections and diffraction of the sound around obstacles.

Occlusion:

The direct path and reflections of the sound are blocked but you may hear the sound transmitting through other materials.

Occlusion
Occlusion

Exclusion:

The direct path of the sound is clear, but reflections are blocked.

Exclusion
Exclusion

Diffraction:

Diffraction of sound is where sound waves bend around obstacles or spread out after passing through narrow openings.

Diffraction
Diffraction

The current version of the SweejTech Propagation system is focussed on Obstruction.

The native Unreal Audio approach

The native Unreal Engine systems for occlusion and obstruction work on a room based or direct path-based model. Room based obstruction utilizes Audio Volumes (via Ambient Zones) or Attenuation Volume components on Audio Gameplay Volumes.

Unreal Engine Audio Volume
Unreal Engine Audio Volume

Unreal Engine Audio Gameplay Volume
Unreal Engine Audio Gameplay Volume

Direct path obstruction is enabled through the Attenuation options of a sound where volume attenuation and a low pass filter can be applied when the direct path on a given trace channel between the audio source and listener is obstructed.

Unreal Engine Attenuation (Occlusion) settings
Unreal Engine Attenuation (Occlusion) settings

Although there is an interpolation time for any obstruction to take effect the results remain quite binary, sounds are either fully obstructed or not. For example, the sound source behind the lamppost in the example below will have the full occlusion settings applied when the path to the listener is obstructed by the thin metal pole which feels unrealistic.

Unreal Engine Occlusion Illustration
Unreal Engine Occlusion Illustration

Note: The following section shows debug displays and values that can be observed using the Obstruction Inspector see Quick Reference for a quick guide to the Obstruction Inspector.

The SweejTech GPU Ray Trace System

The SweejTech Propagation system avoids this binary approach to obstruction by utilizing a number of points on a sphere around both the listener and source, then generating ray traces between them. The traces are run on the GPU for highly performant results, even with multiple sound sources.

SweejTech Obstruction Illustration - Lamppost
SweejTech Obstruction Illustration - Lamppost

Attenuation & Obstruction

SweejTech Propagation works in conjunction with Unreal Engine's attenuation system. Obstruction is only active when within the Falloff Distance of a sound actor.

Attenuation Falloff Distance
Attenuation Falloff Distance

Quick summary of system

Obstruction values are derived from the number of unobstructed rays between corresponding positions on source and listener hemispheres. These are impacted by user settings which can determine the radius of the source and listener hemispheres, the distribution of positions on those hemispheres, and the proportion of those positions considered 'inner' or 'outer' sound positions. The lowest value from either the inner or outer obstruction forms the raw obstruction value. This value is then mapped to a given range and scaled before being used to apply filtering and attenuation to the sound source.

Sound Sources with Debug Visualizations
Sound Sources with Debug Visualizations

Propagation System Summary
Propagation System Summary

Spheres, positions, and Rays

Each sound source has a Source Radius which you can define per actor, and rays are cast between this and the listener sphere, the radius of which is defined in the Project Settings. Sound Positions are distributed evenly on the source and listener spheres using a Fibonacci sphere algorithm. Rays are sent between corresponding points on the two facing hemispheres of the sound source sphere and listener sphere, and the Obstruction Value is determined by the number of successful rays that have not been obstructed. (There is actually a further level of refinement to this discussed in the Inner & Outer sound positions section below.)

64 Sound Positions on the sound source hemisphere and 64 corresponding Listener Positions on the listener hemisphere are used and the Obstruction value is derived using the calculation:

1 -- (No. of successful Traces / 64)

A completely unobstructed scenario would lead to an Obstruction value of 0.0. (Green and Teal colored sound positions illustrate unobstructed paths).

No obstruction gives 0.0
No obstruction gives 0.0

And a 50% obstructed scenario would lead to an obstruction value of 0.5. (Red and Purple colored sound positions illustrate obstructed paths).

50% Obstruction
50% Obstruction

This approach means that even when using sounds with a small source radius it is unlikely that they will ever be fully obstructed by thin obstacles, giving a more realistic result.

Source Radius 1.0
Source Radius 1.0

The Listener Radius is set by default to 100 units. This can be adjusted in Project Settings → SweejTech /→ Propagation → Listener. Smaller values will provide more accurate results, but may result in false positives when geometry is close to the listener. Larger values will be less accurate but will offer smoother results.

Listener size is set in Project Settings
Listener size is set in Project Settings

Hemisphere Points Distribution

The default even distribution of points on the source and listener hemispheres works well in many cases but depending on the nature of your project you may want to experiment with their distribution. You can do this on a project level by adjusting the following values via Project settings → Sweej Tech → Propagation → General Ray Tracing.

Hemisphere Points Distribution settings in Project Settings
Hemisphere Points Distribution settings in Project Settings

Hemisphere Points Distribution: This determines which distribution (Cosine or Uniform) is used for Fibonacci-generated hemisphere ray source positions. The default is a cosine distribution but you may find that a uniform distribution, that creates a lower density of points in the center, is more suited to your particular needs.

Cosine Hemisphere Points Distribution
Cosine Hemisphere Points Distribution

Uniform Hemisphere Points Distribution
Uniform Hemisphere Points Distribution

In order to have the opposite effect to the cosine distribution, so that the placement on the points is biased towards the outer edges of the sphere, you can use the Hemisphere Points Spread Factor, this is a nomalized weighting for Fibonacci-generated hemisphere ray source positions. A value of 0.5 reproduces the default behaviour. Values above 0.5 bias points toward the center, Values below 0.5 bias points toward the rim.

Hemisphere Points Spread Factor 0.35

 Hemisphere Points Spread Factor 0.35
Hemisphere Points Spread Factor 0.35

Inner & Outer Sound Positions

In order to get more consistent, natural feeling results the Sound Positions on the sound source hemisphere are actually considered as two types; Outer positions on the circumference of the hemisphere, and Inner positions within the hemisphere. These values can be displayed in the Obstruction Inspector, together with the resulting Raw Obstruction value which takes the lowest of the two values, in other words the less obstructed path wins.

This approach produces more realistic feeling obstruction results when a source is obstructed by a thin object:

Inner & Outer Sound Positions for thin object
Inner & Outer Sound Positions for thin object

Or when sources propagate between objects:

Inner & Outer Sound Positions for between objects
Inner & Outer Sound Positions for between objects

You can also influence the resulting raw obstruction by setting the Sphere Inner Points Proportion on a per actor basis via the Propagation Toolbar. This property controls what proportion of points per sound are considered as the inner part of the sphere.

Sphere Inner Points Proportion in Propagation Toolbar
Sphere Inner Points Proportion in Propagation Toolbar

Frequency, Attenuation and Scaling

Once the Raw Obstruction value has been derived for a sound you have options to determine the attenuation and filter frequency that will be applied to that sound when fully obstructed, what range of obstruction values to map these changes across (Obstruction Scaling Mode and Values), and how quickly these changes will be implemented (Obstruction Value Smoothing Time).

Obstruction Range and Scaling
Obstruction Range and Scaling

See the Obstruction effects: Frequency, Attenuation & Scaling section within the Authoring pages for details Authoring

Squishy Sound Sphere

One of the possible issues with the Listener Sphere is that this sphere may overlap with walls or other obstacles when the sound is in close proximity to walls or other obstructions. For example, using a glass -- non-obstructing wall for illustration, the source positions indicated by the red box would ordinarily return as obstructed, even though the path from the listener to the source is clearly unobstructed.

Sphere Obstruction Problem
Sphere Obstruction Problem

A typical example might be NPC footsteps which are spawned just above at ground level and would always return as nearly 50% obstructed because the path to nearly half of the Source Positions is obstructed by the floor.

Sphere Obstruction Problem - Footsteps
Sphere Obstruction Problem - Footsteps

In order to avoid this problem the SweejTech Propagation system makes use of a 'Squishy Ball', where the Source Sphere actually adapts to the geometry around it. In the illustration below you can see that the points that would normally be on the outer surface of the sphere are in fact now originating from the overlapping wall.

Sphere Obstruction Solution -- The Squishy Ball
Sphere Obstruction Solution -- The Squishy Ball

A ray trace on the GPU is made from the sounds origin position to the Sound Positions on the sphere, and if they hit anything then this point is designated as the new sound position. You can see these new Sound Positions clustered on the floor in the illustration below.

Ray Sound Positions Set to Overlap Locations
Ray Sound Positions Set to Overlap Locations

First Frame Rays

Although tracing and calculations on the GPU are highly efficient, data cannot make the round-trip to and from the GPU quickly enough to apply the appropriate obstruction effect on the first frame at which a sound plays. SweejTech Propagation mitigates this problem by using the CPU to quickly calculate the initial obstruction setting for the first frame. The Num Obstruction First Frame Rays value within Project Settings → SweejTech → Propagation determines how many rays are cast within this first frame on the CPU. The default setting of 3 is sufficient in most cases. You can observe these using the Draw First Frame Rays option from the settings gear icon in the Obstruction Inspector.

Draw First Frame Rays Debug Option
Draw First Frame Rays Debug Option

These are displayed as a thick red line for obstructed rays and a thick green line for unobstructed rays.

First Frame Rays Debug Appearance--
First Frame Rays Debug Appearance--

Note: If Obstruction First Frame Arrays is set to 0.0 in the SweejTech Propagation Menu then the Obstruction Value is automatically set to 0.5. This is in order to mitigate sudden jumps from the first frame value to the subsequent value received from the GPU.

Obstruction Value default if 0.0 First Frame Rays
Obstruction Value default if 0.0 First Frame Rays