Footsteps Material Management using Wwise / Unreal Engine 4 / Unity 3D

게임 오디오 / 사운드 디자인 / Wwise에 대한 팁과 도구

Early in pre-production, sound designers need to prototype many systems, and they don’t always have an audio programmer to help them.

Fortunately, Wwise, combined with today's engines like Unreal Engine 4 and Unity 3D, is really helpful for that.

 

Unreal Engine 4 has, for example, a powerful scripting interface which allows sound designers to do many things without the need for a programmer’s involvement. And combined with powerful behaviors that Wwise offers, it would be a shame to not take advantage of these great tools!

That said, this tutorial will explain how to detect/manage ground materials and play the appropriate footstep sounds.

It has been made with, and will mainly focus on:

  • Audiokinetic's Wwise 2016.1: Switch Group, RTPC, Switch controlled by RTPC, and Random Containers
  • Unreal Engine 4.12.5: Blueprint, Surface & Physical Materials, AkEvent Notify, Set Switch, and Set RTPC
  • Unity 3D 5.1
  • Free Assets from both the Unreal and Unity store.

 

Wwise

The setup is strictly identical for Unreal and Unity to be able to play footsteps according to the different ground materials detected by the engine.

Game Syncs

  • Create a new Switch Group in Game Syncs and name it Material.
  • Create 4 Switches under the Switch Group and name them Concrete, Grass, Tiles, andWood.

 FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3DKeep in mind that a Switch is “game object based”, which means it can be used for different situations and not only for player footsteps. It can have different values depending on which game object is used, such as bullet impacts and NPC footsteps. This means that a State, which is “global” must not be used to manage physical material. 

 

Global Setup (Audio / Events / Switch Assignation)

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

  • (1) Create a new Switch Container and name it FS_Pawn.
  • (2) Create 4 Random Containers for each Material: Walk_Concrete, Walk_Grass, Walk_Tiles, and Walk_Wood.
  • (3) Import all audio files according to these containers and materials.
  • (4) Click on the Switch Container and set the Switch created before:

                                 Group: Material
                                 Default Switch/State: Concrete

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

Setting a default value means that if the engine sends a material name that Wwise does not have, it will play
Concrete by default (if set to none, nothing will be played).
  • (5) Now in Assigned Objects drag’n’drop each Random Container from the Contents Editor (or Project Explorer) to their respective Switches.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • (6) Create a New Event Play from the Switch Container FS_Pawn and name it Play_FS_Pawn.
  • (7) You can test your Event and switch the Material in the Transport Control or in a Soundcaster Session.

 

 

Unreal Engine 4

Project Settings

  • (1) Open the Project Settings and go to Engine>Physics>Physical Surface.
  • (2) Add 4 new Surface Types (with the same names as created in Wwise): Concrete, Grass, Wood, and Tiles.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Physical Material Settings

  • (1) Create 4 new Physical Materials in the content browser and name them PM_Concrete, PM_Grass, PM_Tiles,  andPM_Wood.

 

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • (2) Open each of them and assign the corresponding Surface Type.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Material Settings

  • Open each Material used in your map and set the correct Physical Material for each of them: PM_Concrete, PM_Grass, PM_Tiles, and PM_Wood.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • Map Overview

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Animation Sequence

  • Open the Animation Sequence. This is where we are going to trigger the AkEvent footstep.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

  • (1) Add notify AkEvent to the desired position in the timeline.
  • (2) In Anim Notify, choose the Wwise AkEvent Play_FS_Pawn created in the Wwise project.
At this time, if you play the animation you should hear the footstep sounds with the default Switch, Concrete.

 

Blueprint

  • This Blueprint is where Unreal is going to “identify” the different material the pawn will walk on and send the correct Switch to Wwise.
  • In the content browser, create a new Blueprint Class (Actor Component Class) and name this Blueprint BP_Wwise_Footsteps.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • Open the Blueprint and start to script it. Once finished, it should look like this!

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Let’s have a closer look at each block of scripting:

  • (1) The Blueprint is tick based, and it takes the location of the player pawn.
FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D
  • (2) The LineTraceByChannel box is basically a ray-trace made from the start-to-end input (the Z value should be adjusted, depending on your pawn). You can visualize the ray-trace in game by turning Draw Debug Type to “For One Frame”; it will display a red line under your pawn to the ground and, if the ray-trace is colliding with the ground, a box at the bottom .

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • (3) The first Branch box is to check if the LineTraceByChannel has a return value.

The second one is to avoid the Blueprint sending the Switch to Wwise if the pawn doesn’t walk on a new Surface Type. Without this gate, at each tick Wwise would receive the Switch indefinitely!

The Get Surface Type box returns an Enum that is linked to the Project Settings.

To be able to get and set this variable, create a new variable named CurrentSurfaceType and set its type to EPhysical Surface.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

 

  • (4) As I said before, a Wwise Switch is “game object based”. In this particular case, the AkEvent notify which is posted in the Animation Sequence creates an Ak Component attached to the mesh, so we need to cast the Set Switch on this Ak Component and not on the pawn itself.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • (5) This box returns the corresponding string to the Surface Type Enum (Concrete, Grass, …).
  • (6) Now, we can feed the Set Switch box that will send to Wwise the Current Surface Type the pawn is walking on!

                                              Target: Get the Ak Component from the mesh where the AkEvent is posted
                                              Switch Group: Material (same that has been set up in Wwise session)
                                              Switch State: Surface Type defined in Unreal

                                           The Print String box is just for debugging purposes to display the Current Surface Type in the Unreal Screen.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • Compile the Blueprint, save it, and add it as component to your pawn.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • Connecting Wwise to Unreal will show the Switch in the Profiler layout's Capture Log view.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Going Further

A very cool feature offered by Wwise is the ability for a Switch to be entirely controlled by an RTPC, which means a Switch can be changed according to values sent to an RTPC!

In our case, this will be great because we are going to use this feature to switch footsteps between Walk and Run depending on the pawn’s speed. 

In UE4, open the Pawn’s Animation Blueprint and add a Set RTPC box at the end of the “Update Animation Event” (which is tick based).

  • Target: We have to get the Ak Component where the Ak Event Notify is posted.
  • RTPC: Pawn_Speed
  • Value: Get Speed (velocity based)

 FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 Creating a Switch controlled by an RTPC

  • Create a new Switch Group called FS_Type with Walk and Run as Switch values.
  • Create an RTPC called Pawn_Speed.

                            Min = 0 (pawn is idle)

                            Max = 300 (max speed)

                            Default = 0

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • In my case, I know that 0 ≤ Walk Speed < 250 ≤ Run Speed ≤ 300 (you can track this speed in real time by connecting Wwise to Unreal and profiling the RTPC sent to the pawn).
  • Link the Pawn_Speed RTPC to FS_Type Switch by enabling Use Game Parameter and creating a “stair” like that.

 

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 Our Switch is now controlled by the RTPC value sent by the game:

  • Switch to Walk when 0 < Pawn_Speed ≤ 250
  • Switch to Run when 250 < Pawn_Speed ≤ 300

  FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

  • Build your SoundBanks, play, and enjoy!

 

Unity 3D

Setting up Tags

  • Click on any actors in your map and go into the Inspector window.
    • Click the Tag drop-down box and select Add Tag….

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

  • Add the Wood, Concrete, Grass, and Tiles values in this window.

 

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

Ground setup

  • For each ground/object that a player can walk on, assign the right Tag in the Inspector window to the Collider.
    • Sometimes a Collider is not embedded with the mesh, so be sure to set the Tag on the Collider and not just on the mesh.

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

C Sharp code

  • Add this C# code to the Character Controller script of your project.

 

  • Variables declaration:

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

  • Main script:

FOOTSTEPS MATERIAL MANAGEMENT - using Wwise / Unreal Engine 4 / Unity 3D

 

 

Hope you enjoyed this, and I look forward to sharing more game audio with you on the Audiokinetic blog very soon!

  

Sébastien Gaillard

Audio Director

DONTNOD Entertainment

Sébastien Gaillard

Audio Director

DONTNOD Entertainment

Sébastien Gaillard is an Audio Director with 15+ years of experience in game sound design, scripting and integration. For the last 3 years, he has been managing DONTNOD’s audio department, notably for the award winning “Life is Strange”. He is also a regular lecturer at ISART Digital in Technical Sound Design.

댓글

Alvaro Lopez

October 24, 2016 at 04:27 pm

I have an issue: The notification Switch to "[material container]" is received but it is not switching. Is there anything that will enable this? I'm stuck Thank you

Jakub Piekarczyk

February 25, 2017 at 07:14 am

Thank you, very helpful.

Panagiotis Pagonis

August 23, 2017 at 12:34 pm

Does this method work on a 1st person too ?

Sebastien Gaillard

August 30, 2017 at 09:58 am

Yes, In your case (FirstPersonCharacter) you have to : - use "Cast To FirstPersonCharacter" blueprint box instead of "Cast To ThirdPersonCharacter" - target “Mesh 2P” instead of "Mesh"

Panagiotis Pagonis

September 20, 2017 at 11:04 am

Thank so much for the respond! I just saw your reply. I worked it out somehow.

Eric Lavallee

October 26, 2017 at 03:19 am

When I package the game, and everything above is done in unreal to the tee. All surfaces react in real time in game no problem names of surface types print to screen confirmed. But in packaged game the game seems to forget the names for the surface types. 4.16.3. What can do.

Jeshua Whitaker

December 01, 2017 at 03:30 am

Great blog post! I have tried to implement your code into Unity's Standard Asset FirstPersonController script without luck. Any tips appreciated!

Anthony Matt Rochette

August 02, 2018 at 08:39 am

Hi, I tried it with the demo ShootingGame available on the Epic Games Launcher. It's a FPS but there is no FirstPersonShooter, so I tried with PlayerPawn but it did't work ! I'm trying to find a way to make it work but I really don't know how ! Can you help me ?

댓글 달기

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

다른 글

Wwise에서 템플릿 사용하기

게임 개발자의 도구 상자에 있는 수많은 도구와 마찬가지로 Wwise역시 심도 있고 복잡한 프로그램이며, 웬만한 소설보다도 긴 문서를 제공하고 있습니다. 요즘 이 문서를 완전히...

13.3.2019 - 작성자: Bradley Meyer (브래들리 메이어)

소규모 게임 프로젝트가 Wwise로부터 혜택을 받을 수 있는 5가지 이유

여러분이 게임 오디오 분야에 종사하고 있으며 이전에 소규모 게임 프로젝트를 수행한 적이 있는 경우. 다음과 같은 대화를 나눈 적이 있을 수 있습니다. "근데, 와이즈와 같은...

7.7.2020 - 작성자: 알렉스 메이 (ALEX MAY)

아우터 월드(Outer Worlds)의 사운드: 제 1부

저희 Obsidian 오디오 팀은 Wwise와 Unreal을 사용하여 아우터 월드(Outer Worlds)의 사운드, 음악, VO를 제작한 방식을 두 편의 글로 심층적으로...

8.12.2020 - 작성자: 옵시디언 엔터테인먼트 (Obsidian Entertainment)

Strata, Wwise, Unreal을 결합해 몰입형 게임 환경 만들기

이 블로그에서는 Wwise가 통합된 Unreal Engine 5 프로젝트의 멀티트랙 컬렉션 중 하나를 사용하여 Strata를 이용한 상호작용 디자인 과정을 살펴보겠습니다.이...

16.5.2023 - 작성자: 체이스 스틸(Chase Steele)

Strata 작업 과정 파워업하기 | 2부 - "연결된 REAPER 프로젝트 열기"

Wwise를 REAPER와 함께 사용하는 사운드 디자이너라면 Wwise에서 작업하는 동안 REAPER에서 사운드를 다시 렌더링하고 싶은 경우가 종종 있습니다. 원래대로라면 관련...

15.8.2023 - 작성자: Audiokinetic (오디오키네틱)

Wwise Spatial Audio 2023.1의 새로운 기능 | 개선된 Aux Send Model

Wwise 2023.1에서 새로 제공되는 수많은 기능의 목록을 살펴보셨다면 아마 '개선된 Aux Send Model'이라는 흥미로운 문구를 발견하셨을 겁니다. 도대체 이게 무슨...

14.12.2023 - 작성자: Nathan Harris

다른 글

Wwise에서 템플릿 사용하기

게임 개발자의 도구 상자에 있는 수많은 도구와 마찬가지로 Wwise역시 심도 있고 복잡한 프로그램이며, 웬만한 소설보다도 긴 문서를 제공하고 있습니다. 요즘 이 문서를 완전히...

소규모 게임 프로젝트가 Wwise로부터 혜택을 받을 수 있는 5가지 이유

여러분이 게임 오디오 분야에 종사하고 있으며 이전에 소규모 게임 프로젝트를 수행한 적이 있는 경우. 다음과 같은 대화를 나눈 적이 있을 수 있습니다. "근데, 와이즈와 같은...

아우터 월드(Outer Worlds)의 사운드: 제 1부

저희 Obsidian 오디오 팀은 Wwise와 Unreal을 사용하여 아우터 월드(Outer Worlds)의 사운드, 음악, VO를 제작한 방식을 두 편의 글로 심층적으로...