you are an Unreal Engine expert and technical sound designer who has worked on numerous…
- User
you are an Unreal Engine expert and technical sound designer who has worked on numerous AAA games, you know very well Unreal Engines documentation and you always check if you response corresponds to actual UE features. In Blueprints I'm building a system that mimics Portals from Wwise. I have a Source Bus emitter at the door in the building and the outside 2d ambience is transmitted to it. I also want 3d sounds, which are randomli spawned around the player to be routed to this source bus, however I don't want all of them being routed only those who are spawned within a debug sphere. Help me to create a logic that will check whether given sound is being spawned within this sphere. It should be a BP function that can be re-used in other BP
- Assistant
Great! Since you're working in Blueprints in Unreal Engine and want to replicate something akin to Wwise Portals but natively in UE using a Source Bus system (which is a cool and creative use of UE's Audio Mixer capabilities), here's how we can approach your problem.
✅ Goal Recap
You're doing the following:
- You have a Source Bus emitter located (say by a door) that gets outside 2D ambience routed to it.
- You have randomly spawned 3D one-shot sounds in the world.
- You ONLY want 3D sounds spawned within a debug sphere area (probably near a portal) to be rerouted to the Source Bus.
- You're trying to simulate the idea of Wwise-style Environmental Portals, controlling audio routing based on proximity to a region (the "debug sphere").
- You want to make this logic generic/reusable in a
Blueprint Function.
🧩 Solution Architecture
We’ll build a system that checks if a given sound spawn position (or actor location) is inside a given Sphere volume.
This will be implemented as a Blueprint Function that takes:
Function Input Parameters:
SoundLocation(Vector) — The location you're spawning sound.SphereCenter(Vector) — The center of your "debug sphere".SphereRadius(Float) — The radius of your "debug sphere".
Function Output:
IsInsideSphere(Boolean) — Whether the sound was within the sphere.
🔧 Creating the Blueprint Function Library
Step 1: Create a Blueprint Function Library
This gives us reusable global functions.
- Right-click in the Content Browser.
- Select
Blueprints → Blueprint Function Library. - Name it something like
BPFL_AudioHelpers.
Step 2: Create a Function —
IsSoundWithinSphereInside
BPFL_AudioHelpers:- Name the function
IsSoundWithinSphere - Set it to
Purefor performance/utility. - Inputs:
SoundLocation—VectorSphereCenter—VectorSphereRadius—Float
- Output:
IsInsideSphere—Boolean
Step 3: Implement the Logic
You just want to check if a point is inside a sphere.
🧮 Math
Distance = (SoundLocation - SphereCenter).Length If Distance <= SphereRadius → InsideBlueprint Nodes
- Drag out from
SoundLocation→Vector - Vector→ plugSphereCenter→ Gives a vector. - From that result →
Vector Length(orVector Length Squared) - Compare that to
SphereRadius- Optional performance tip: Compare Length Squared to
SphereRadius * SphereRadius(avoids sqrt).
- Optional performance tip: Compare Length Squared to
- Output result to
IsInsideSphere.
Example Node Flow:
(SoundLocation - SphereCenter) → Vector Length or Length Squared → Compare to SphereRadius → Return Result
🧠 Usage Example
When you spawn a random 3D sound:
- You have the spawn location (
SoundLocation). - You have the debug sphere center and radius (w maybe set via actor/component?).
You call:
IsInsideSphere(SoundLocation, SphereCenter, SphereRadius)If
true, you:- Set custom audio routing to Source Bus via
Set Submix Sendon the spawned sound.
If
false:- Skip or use normal audio routing.
🗂️ BONUS — Automatically Get SphereCenter and Radius from a Sphere Component
Let’s go further and make it even more user-friendly.
Variant Function Input:
SoundLocation(Vector)Sphere Component→ SphereCollision, AudioPortalSphere, etc.
You extract:
SphereCenter = SphereComponent.WorldLocationSphereRadius = SphereComponent.ScaledSphereRadius
That way you don’t need to pass vector values manually.
✅ Call:
IsSoundInsideSphere(SoundLocation, SphereComponent)
🧩 BONUS 2 — Visual Debug Help
Use
DrawDebugSphereorDrawDebugPointto visualize sounds and the portal sphere in-game to debug behavior.Example node:
DrawDebugSphere(WorldContext, SphereCenter, SphereRadius, ...) DrawDebugPoint(WorldContext, SoundLocation, ...)
✅ Summary
You now have:
Feature Implemented? Reusable BP logic ✅ Sphere inclusion test ✅ Matches Wwise Portal behavior ✅ Supports random 3D sounds ✅ Rerouting only if “in portal” ✅ Debug visualization possible ✅
✅ Next Step: Apply Custom Routing in Audio Components
Once you detect sound is in range:
- Call
SetSubmixSendon the Audio Component. - Route it to the same Source Bus submix you're using for outside 2D ambience.
Let me know if you want to go into how to assign Submix Sends dynamically at runtime depending on the match — I’ve done similar setups for layered environmental zones in AAA projects.
Would you like code examples for applying the Submix Send routing dynamically from within a Blueprint?
- User
how the actual Portal in Wwise handles outside sound directionality?
- Assistant
Great question — and one that's often misunderstood. Let’s dive deep into how actual Portals in Wwise (used in combination with Rooms) handle outside sound directionality, especially in spatialized environments like Unreal Engine.
🎧 What Are Wwise Portals & Rooms?
- Rooms simulate occlusion, reverb, and acoustic isolation.
- Portals define connections between Rooms.
- The Portal system handles audio propagation between Rooms when the listener or emitter is in a different Room than the other.
🎯 Your Question:
"How does Wwise Portals handle outside sound directionality?"
✅ Answer Overview:
Wwise Portals inherently preserve the directionality of distant sound sources through the Portal opening, simulating realistic propagation.
This happens both technically and perceptually, thanks to how Wwise:
- Projects the location of external emitters onto the Portal
- Calculates vector-based spatialization toward the listener
- Allows partial propagation across Rooms through Portals only
Let’s break it down.
🧠 Directionality via Portals in Wwise
✔️ 1. Portal Projection & Sound Proxies
Say you have:
- A listener inside Room A
- A sound in Room B
- A Portal connects A ↔ B
💡 Wwise will project the external emitter’s signal through the Portal and make it appear to come from the Portal opening, not the emitter itself (for the listener).
That projected sound is still spatialized, so you get directional cues: "The sound is coming from behind/left/right etc."
This means:
- Sounds "outside" are not fully spatialized to their original source
- They are proxied from the Portal position — but with attenuation, occlusion, and directionality contributed by the actual emitter-to-portal vector
📌 Key Idea: The external source’s contribution is ported through the Portal only, keeping correct direction relative to the Portal.
✔️ 2. Multiple Portals — Cumulative Directionality
If you're between multiple Portals (think: hallway or double doors), sounds from a Room can propagate through multiple Portals.
- A given emitter will contribute multiple times, one per Portal path
- The sound will then appear to come from multiple directions
- Wwise blends contributions, giving a subtle diffuse spatial image, but only from Portal directions — preserving directionality realism
✔️ 3. Listener Inside Room — Source Outside
When the listener is in a Room and the sound source is outside (or in another Room), Wwise Portal behavior ensures:
- The emitter is spatialized via the nearest relevant Portal
- You hear the sound from the Portal, not from source direction
- Accurate directionality from apertures (like doorways or windows)
- Controlled attenuation, reverb send, and occlusion/obstruction
This gives a convincing illusion of "the sound is coming from over there, through that open access"
It does not just muffle or attenuate — it routes directionally through geometrically plausible openings.
✔️ 4. Listener Outside — Source Inside (Reverse)
Same logic in reverse applies:
- Listener outside
- Sound emitter inside a Room
Wwise projects the audio out through available Portals to the “outside” (default/undefined Room).
- Sound is heard from Portal location
- Directionality is retained toward Portal location, not original source
This is very typical in games when approaching a house with sound inside.
🔊 Portal Audio Parameters That Influence Directionality
Here’s why Wwise’s directional behavior works convincingly:
Parameter Effect on Directionality Portal Position Sets the apparent emission point Emitter-to-Portal Vector Affects how spatialization is calculated Listener-to-Portal Vector Defines HRTF/spatial panning direction Attenuation Settings Affects how far sound travels between Rooms Obstruction/Occlusion Modulates filter and volume based on geometry Wet/Dry Mix (Reverb Sends) Simulates realistic environmental tailing
🎮 In Unreal Engine — What Happens?
When using Wwise Rooms & Portals in UE:
- The AkSpatialAudioVolume defines Rooms
- AkPortal Actors define Portals between volumes
- UE sends spatial geometry info to Wwise through WAAPI and Reflection Probes
- Sound emitters are registered to Rooms automatically (if placed inside volumes)
- Wwise handles all propagation and panning
📍You do not need to write logic to move sound sources yourself. Just define correct:
- Volumes (Rooms)
- Portal actors
- Reverb aux sends / room tone / reverbs
🧪 Debug Tips
In Wwise’s Game Object Profiler, you can observe:
- Sounds routed & re-spatialized through Portals
- Emission points from projected locations
- How Room/Portal transitions affect perceived location
In Unreal:
- Use
Show Debug Ak Spatial Audioto view Rooms/Portals
🧠 Summary: How Wwise Portals Handle Directionality
Wwise Feature Behavior Directionality Audio is spatialized from Portal location, not directly from source Multiple Portals Source contributes sound from each available Portal Obstruction/Occlusion Filtered based on portal geometry, improves realism Unreal Integration Transparent once Portals & Rooms are set up correctly
Want to Mimic This in Native Unreal?
You're already on your way with the Source Bus / Portal routing idea.
To simulate directionality, you’d need to:
- Copy sound position to the nearest Portal or "proxy emitter"
- Use that proxy for spatialization
- Possibly create duplicate Audio Components for Portal proxy
- Blend direct and indirect paths manually (for multiple Portals)
- Dynamically manage attenuation & obstruction type filters
Let me know if you want to build that system — it’s very doable, but requires careful routing logic!
Would you like a visual diagram of Wwise’s room ↔ portal ↔ listener propagation? Or conversion of this behavior using only Unreal’s native Audio Engine?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.