Custom Wwise Listener Position Projection System for Titled 2D View

오디오 프로그래밍 / 게임 오디오

Introduction

This is the 2nd of a 3-part tech-blog series by Jater (Ruohao) Xu, sharing the work done for Reverse Collapse: Code Name Bakery. You can read the first article here, where he dives into using Wwise to drive in-game cinematics. Stay tuned for Part 3 in the coming weeks!

Custom Wwise Listener Position Projection System for Titled 2D View

Tech Blog Series | Part 2

Reverse Collapse features a distinctive art style, and one of the artistic choices to make the game stand out is the use of tilted 2D level maps. At first glance, the game presents a 2D top-down camera view. However, behind the scenes, each level of the map is meticulously crafted with a slight tilt from the direction that the camera is facing.

Implementing 3D audio in a typical top-down view is relatively straightforward. However, when dealing with a tilted 2D top-down view like in Reverse Collapse, the default 3D audio system may not provide accurate results. Initially attempting this approach led to issues with attenuation bugs, especially when moving the camera from left to right or top to bottom.

To address this, a customized system is necessary to make adjustments to the default 3D audio system and ensure it works seamlessly with the tilted 2D top-down view.

img1

The image above highlights the issue we're encountering: from the perspective of the camera view frustum, the map appears tilted, leading to inaccuracies in the default audio attenuation.

The solution involves utilizing a simple projection system created with Unity's game objects, scripts, and Wwise RTPC, to establish a projected X, Y, and Z coordinate system specifically for audio purposes. By moving the audio listener from its default position on the main camera to the converted position after the map has been rotated, we can achieve our objectives. This approach seamlessly integrates with the default Wwise audio attenuation. Additionally, we can leverage the customized coordinate system for special cases that require manual adjustment of the attenuation range through Wwise RTPCs.

To achieve this, we first need to set up the projected location, denoted by the magenta cube in the video below, as a prefab game object. This game object should be attachable to any camera with a fixed offset distance to the main camera. It's essential to make this game object a prefab for our project because we have multiple camera setups in the game. Therefore, we need the ability to install or switch the projection system as a child of the game object of any camera setup at runtime. However, it's worth noting that this step may not be the same for every project.

After setting up the prefab game object for the project location, the next step is to add the AkAudioListener.cs script, which comes with our Wwise Unity integration, to the prefab parent game object. This action designates it as the audio listener for the game. Subsequently, we should remove the default audio listener from the MainCamera game object.

img2

The image above shows the prefab setup for our special audio listener game object that is used in the sound projection system; we named it SoundProjectSampler

 

The above video demonstrates the problem of the map from the camera view, and showcases the final working system in the engine.

In Wwise, we configure the RTPC to transfer coordinate data from Unity to Wwise. This allows us to apply the results of the sound modifications we desire. The specific range of each RTPC depends on the unit sizes of the map in each game. In our case, we set the range between 0 to 100.

img3

On the camera object, similarly to the solution above, we attach the script and include these RTPC calls within the LateUpdate()function. While it would also function with Update(), using LateUpdate() ensures that all rendering operations are completed before updating our audio coordinates. This sequencing helps to maintain synchronization between audio and visuals.

AkSoundEngine.SetRTPCValue(CameraDistance_X, Normalization(soundProjectionSampler.transform.position.x, 0.0f, 100.0f));
AkSoundEngine.SetRTPCValue(CameraDistance_Y, Normalization(soundProjectionSampler.transform.position.y, 0.0f, 100.0f));
AkSoundEngine.SetRTPCValue(CameraDistance_Z, Normalization(soundProjectionSampler.transform.position.z, 0.0f, 100.0f));

Note that you may find, in the solution above, we have a helper function called Normalization(), which will convert any given float value based on a minimum and maximum range, to the final range of 0 to 1. It is highly recommended to have something like it to help us unify the range for the RTPC that we are working with. The function can be simply written by following the mathematical normalization formula:

Normalized Value = (Value To Be Normalized - Lower Bound) / (Upper Bound - Lower Bound)

There are plenty of implementation examples of normalization formulas in different programming languages, which include instances in C# and C++; a simple online search will yield many results for you in this case, so we will skip this part here.

With this RTPC hooked up, we can achieve accurate audio results using the default Wwise attenuation system. In addition, we have the flexibility to fine-tune each sound by applying the X, Y, and Z coordinate RTPCs directly to the audio sources themselves. This allows sound designers to set their own attenuation system, or augment it on top of the the default attenuation system.

img4

img5

img6

img7

The example demonstrates how the sound attenuation of the fungus is tuned when they are ignited by grenades in the 3009 gameplay level. Initially, the fungus sound is set up as a 3D sound with Wwise's attenuation, utilizing the default attenuation settings. Additionally, the attenuation is driven by the projected coordinates we created, allowing for further customization and fine-tuning of the sound attenuation based on the precise game map units.

In addition to working with existing attenuation profiles, the X, Y, and Z coordinate RTPCs can also independently create attenuation effects on game object scope sounds. Sound designers can fine-tune the sound on each axis of the map, allowing for more precise adjustments that generate accurate acoustic results in unique map angles, such as those found in Reverse Collapse.

This flexibility empowers sound designers to craft immersive audio experiences that complement the game's visuals and enhance the overall gameplay atmosphere.

Disclaimer: The code snippets utilized in this article are reconstructed generic versions intended solely for illustrative purposes. The underlying logic has been verified to function correctly, specific project-specific API calls and functions have been omitted from the examples due to potential copyright restrictions.

Ruohao (Jater) Xu

Audio Programmer, Technical Sound Designer

Ruohao (Jater) Xu

Audio Programmer, Technical Sound Designer

Jater Xu is a seasoned audio programmer and technical sound designer specializing in interactive audio solutions with Wwise integration in both Unreal and Unity using C++, blueprint, and C#. His work drives the immersive soundscapes in acclaimed games such as Homeworld 3, The Chant, and Reverse Collapse.

댓글

댓글 달기

이메일 주소는 공개되지 않습니다.

다른 글

UI 설계 관점에서 UI 오디오 접근하기 - 제 1부

어떤 게임에서는 사용자 인터페이스가 플레이어의 전체 경험에 궁극적으로 영향을 거의 미치지 않습니다. 수많은 모바일 게임과 같이 어떤 게임에서는 거의 전체 게임플레이 동안 UI를...

14.10.2020 - 작성자: 조셉 마척(JOSEPH MARCHUK)

‘잇 테이크 투(It Takes Two)’ 사운드 비하인드 스토리 | Hazelight 오디오 팀과의 Q&A

Hazelight Studios(헤이즈라이트 스튜디오)에서 제작한 잇 테이크 투(It Takes Two)는 분할 스크린 액션 어드벤처 플랫폼 협동 게임입니다. 이 게임은 엄청나게...

5.4.2022 - 작성자: Hazelight (헤이즐라이트)

텔 미 와이(Tell Me Why) | 오디오 다이어리 제 3부: 사운드 디자인

텔 미 와이(Tell Me Why)의 오디오 팀에게는 독특하면서도 인상 깊은 서사적 시퀀스를 향상시킬 수 있는 기회가 많았습니다. 저희 시네마틱 및 크리에이티브 디렉터는 영상에 꼭...

19.7.2022 - 작성자: 매튜 피오렌티니 (Mathieu Fiorentini)

Wwise 라이선스 및 가격 책정에 대해

"도대체 어떤 방식으로 책정되는거죠??"전 세계 스튜디오의 어두운 구석 어딘가에서 Wwise의 가격 모델이 조금... 복잡하다는 속삭임들이 있어 왔습니다. 완전히 틀린 말은 아닐...

13.4.2023 - 작성자: 마이크 드러멜스미스 (Mike Drummelsmith)

Wwise를 사용한 반복 재생 기반 자동차 엔진음 디자인 | 제 1부

이 시리즈에서는 Wwise Authoring과 오디오 및 자동차 전문 지식을 알맞게 사용해서 간단한 반복 재생 기반 자동차 엔진 사운드를 디자인하는 방법을 살펴보려고 합니다! ...

18.4.2023 - 작성자: 아르토 코이비스토 (Arto Koivisto)

Wwise를 사용한 반복 재생 기반 자동차 엔진음 디자인 | 제 2부

다시 뵙게 되어 반갑습니다! 이 시리즈에서는 Wwise에서의 간단한 반복 재생 기반 자동차 엔진을 구성 및 설계를 함께 살펴보게 됩니다. 디자인을 제어하기 위해 필요한 엔진 매개...

9.5.2023 - 작성자: 아르토 코이비스토 (Arto Koivisto)

다른 글

UI 설계 관점에서 UI 오디오 접근하기 - 제 1부

어떤 게임에서는 사용자 인터페이스가 플레이어의 전체 경험에 궁극적으로 영향을 거의 미치지 않습니다. 수많은 모바일 게임과 같이 어떤 게임에서는 거의 전체 게임플레이 동안 UI를...

‘잇 테이크 투(It Takes Two)’ 사운드 비하인드 스토리 | Hazelight 오디오 팀과의 Q&A

Hazelight Studios(헤이즈라이트 스튜디오)에서 제작한 잇 테이크 투(It Takes Two)는 분할 스크린 액션 어드벤처 플랫폼 협동 게임입니다. 이 게임은 엄청나게...

텔 미 와이(Tell Me Why) | 오디오 다이어리 제 3부: 사운드 디자인

텔 미 와이(Tell Me Why)의 오디오 팀에게는 독특하면서도 인상 깊은 서사적 시퀀스를 향상시킬 수 있는 기회가 많았습니다. 저희 시네마틱 및 크리에이티브 디렉터는 영상에 꼭...