Blog-WwiseUe4Occlusion

Wwise-UE4 Spline-Based Occlusion

First Blog!

First Blog!

What is occlusion though?

Simple explanation: In reality, if an object is in front of a sound source then this object will block the sound source and cause a sound shadow. This sound shadow is known as sound occlusion in games.

The problem...

Typically, occlusion is set on whether there's an object in between the listener and the sound source... and that's it. There's not much finesse in this approach for the following reasons:

  • Black and white approach, (only on/off states allowed)
  • Because of this, there aren't any levels, or 'intensities', of occlusion.

How is occlusion done in game engines?

This isn't for all game engines, but it's a method that has low computational cost and usually does the trick as a quick fix. But is only a quick fix. The following diagram shows how this is done in UE4:

 

This method takes something called a line trace, and marks the start point (from the player/listener) and the end point (the sound source). If there is something blocking this line, then this will tell the engine to switch the occlusion  on (usually this would entail adding a bit of low-pass filtering and a lowering in volume).

Here's how it sounds:

Is there an alternative?

Well... just so happens I stumbled across a method developed by the team at Blizzard when they did a talk over on the GDC YouTube channel. Their talk focussed on the audio development on their 2016 title 'Overwatch' (I not only recommend you watch the talk but also play the game... and try to not become addicted).

Their system employs the use of AI Paths (in other words, the paths that bots in Overwatch will follow when the player plays against AI). And the simple principle is this:

Depending on how far along the path you are, compared to how far the sound source is along the path, will dictate the amount of occlusion to be applied to the sound source.

Here's a quick diagram to help explain this.

So the green spline/path going across the map will track the closest point from the listener to the spline itself (marking that as Point A) and will do the same with the sound source (marking that as Point B). The distance, along the spline, between these two locations is then stored as a 'distance along the spline' float value, and then compared with the total distance of the spline.

50% Occlusion.PNG

Another note

Since we're still casting the line trace mentioned before, this is used in conjunction with the spline for if there's still an occlusion float value being sent to Wwise, but there's nothing in between the sound source and the listener (to cause the occlusion).

Is Occluded..PNG

But how does it sound?

Implementation notes

For multiple splines/different paths, interpolating between the splines is important to not have any sudden jumps in the occlusion amount. In Blueprint, Wwise offers this. (The Min Of Float Array node returns the lowest occlusion amount from the array of spline occlusion values.)

RTPC.JPG
Occlusion Calculation.JPG

ALL DONE IN BLUEPRINT :)

Good to demo to a programmer for whether they will be able to integrate into the audio engine or not for your game!

All Done In BP.JPG
 

Is there a video version of this blog?

Right here :)

 

(This is my first video by the way... be gentle.)