Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

Reflect plugin: performance issues (UE4, Wwise 2017.2.5)

0 votes

I'd love to get some hints as to how to improve performance when using Reflect. Any hints at all. At the moment we don't know how hard we can be expected to push it, or if we're doing anything settings-wise or elsewhere that could be harming us.

We're noticing very poor performance trying to use Reflect in actual maps in our game. The maps we're testing in consist of large outdoor spaces with several buildings scattered around; the entire space is contained in one outdoor Room, and the buildings typically have one (sometimes up to 3) AkSpatialVolumes. The buildings also have several portals (typically 4 or so for the doors and windows), although I've tried cutting down the portals (down to 0, even, by not letting them call AK::SpatialAudio::SetPortal) without any great effect.

The map currently has some ~ 137 buildings with AkSpatialAudioVolumes. A lot of these are small and irrelevant and no one would have any issue with chopping the spatial audio volumes from them.

The Ak thread pushes our CPU use up to 100%. The Wwise profiler shows the thread using 100% CPU, and the audio get really really choppy.

If I just break in the debugger while the game is playing, the Ak EventManager thread is almost always in ValidateImageSource or AddImageSource, as below

> UE4Editor-AkAudio-Win64-DebugGame.dll!block_locate_free(pool_t * pool, unsigned __int64 size) Line 556 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!tlsf_memalign(void * tlsf, unsigned __int64 align, unsigned __int64 size) Line 905 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!AK::MemoryMgr::Malign(long in_poolId, unsigned __int64 in_uSize, unsigned long in_uAlignment) Line 583 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!AkArray<CAkImageSourceStack::IS,CAkImageSourceStack::IS const & __ptr64,AkArrayAllocatorAlignedSimd<_ArrayPoolSpatialAudio>,16,AkAssignmentMovePolicy<CAkImageSourceStack::IS> >::GrowArray(unsigned long in_uGrowBy) Line 532 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!CAkImageSourceStack::AddImageSource(unsigned long in_uDepth, const __m128 & in_imageSource, const AkImageSourcePlane * in_reflector) Line 75 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!CAkReflectionEngine::ValidatePath(const __m128 & in_emitter, const __m128 & in_listener, const __m128 & in_source, const AkImageSourcePlane * in_pReflector, unsigned long uStackIdx) Line 156 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!CAkReflectionEngine::Compute(const __m128 & in_emitter, const __m128 & in_listener, const __m128 & in_source, const AkImageSourcePlane * in_pReflector, unsigned long uStackIdx) Line 378 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!AK::SpatialAudio::CAkSpatialAudioPrivate::ProcessReflections(CAkSpatialAudioEmitter * pERE, CAkSpatialAudioListener * pERLstnr) Line 1346 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!AK::SpatialAudio::CAkSpatialAudioPrivate::Execute() Line 1198 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!_CallGlobalExtensions(AkGlobalCallbackLocation in_eLocation) Line 184 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!CAkAudioMgr::Perform() Line 506 C++
  UE4Editor-AkAudio-Win64-DebugGame.dll!CAkAudioThread::EventMgrThreadFunc(void * lpParameter) Line 74 C++

If I neuter Reflect by disabling UAkSurfaceReflectorSetComponent::SendSurfaceReflectorSet, I see something more like 12% in the Wwise profiler.

The profiler never shows Reflect plugin using more than 1% CPU, but I expect it's just not capturing it properly?

asked Jun 21, 2018 in General Discussion by Kartik S. (200 points)
retagged Jun 21, 2018 by Kartik S.
What we've done, and it seems to work well enough, is to modify the UE integration to only Add the X closest reflector sets / Y closest portals to the listener, and to Remove all other reflector sets/portals. That seems to work pretty well. Right now I'm testing it at 5 portals and 10 reflector sets, and CPU use is down considerably.

Please sign-in or register to answer this question.