Hello people! This is the first entry in a series of small blog posts about audio tools, experiments, and fun using Unreal Engine 4 in combination with Wwise. Hopefully they can get us all thinking and talking, and in the end become better developers. I really want to just share stuff with the community and I’d LOVE to hear you folks' opinions on the topics that we touch upon. As this is the very first entry from my series, I find it appropriate to very briefly introduce myself. My name is Troels, and I’m what you would probably refer to as a technical sound designer, and I am also composer.
Over the last year and a half, I’ve spent countless evenings and weekends learning Unreal Engine 4, making game prototypes, and working on very non-commercial projects, and I just can’t stop! Now, I also started picking up Unreal Blueprint in my professional work and some of the things that I have learnt have been related to audio tools, which (among other things) made we want to write this blog. So here I am!
Now let’s unveil the first topic! I present to you...
The Spline Based Audio Emitter, probably better known as a Volumetric Audio Emitter.
My colleague and I started creating this tool because we couldn’t find an existing tool or solution for creating custom audio emitting area shapes in UE4.
What is it useful for?
The tool makes it easy to block out large, non-cubic, boxy, or spheric areas in UE4, inside or outside of which you’d like to add audio, such as a forest or swamp area. Please note, a simple shape version can easily be derived from the Spline based version and already exists.
Why would anyone use this?
Because you can make your ambience sounds fade in / out the closer you get to an area shape that you have defined, and so you aren’t tied to using basic shapes only. It can save lots of time, especially when prototyping and when the level / environment is changing rapidly. Additionally, if you have an encapsulated area with entrances, and the AkComponent has occlusion enabled, it will also make the inside / outside ambience play through the entrance without playing through the walls, so more convincing. Also, it only uses one emitter, and this can potentially keep your voice count down as well. Here’s a video on how it works. Note that this video is a very brief overview of its core functionality. Additional functionality not covered: inside / outside States, follow player height, and area fade distance RTPC for use with 2D or 3D sounds with user-defined position source.
What it does:
- The Spline Based Emitter uses a closed spline loop. It locates the point on the spline curve closest to the player and places an audio emitter at that point. The audio emitter location is updated continuously.
- The Spline Based Emitter has two states: Outside State and Inside State. When the player moves into the closed loop, the State changes to Inside and from that point the audio emitter location is now set to follow the listener as well as its orientation. The moment the player moves outside the spline loop, then State changes to Outside and the location of the audio emitter is once again “attached” to the spline curve and is continuously set to be positioned at the point (on the curve) closest to the player.
How it works:
To get an understanding of how the tool works, you could go through the Blueprint in UE4 - it’s thoroughly documented. Note that the tool also has several publicly exposed variables that makes it a bit more versatile. You can download it here.
The two main ingredients / node functions this tool relies on are:
- Get closest point on spline curve (for emitter location).
- Dot product (for knowing if we're inside or outside our closed spline loop).
How to use it:
- Place the Blueprint in your scene and create the shape you need. Personally, I prefer to change to Top view during this process.
- In the exposed variables in the details panel, add your sound and inform the Blueprint what RTPC you use for Area Fade.
You need to be aware of two points that might break the tool:
- V / concave shapes can be troublesome if the emitter attenuation is too long. I really want to come up with a solution to this issue. If you make a concave shape and locate the listener in the center between the two sides (as seen in the image below), you’ll end up with the emitter immediately jumping from one side to the other when the player moves across or within in the V shape.
- Make sure not to make any points in the spline loop cross one another. The relationship between the spline points’ rotation is essential for the Inside / Outside State to work.
Since I expect the CPU time for this Blueprint to be considerably longer compared to the already existing ambience shapes / tools, we added a little optimization to it. When the player / listener gets X distance away from the closest point on the spline curve the tick rate of the Blueprint is drastically reduced.