Surface Detector Notify

The Surface Detector is a custom Animation Notify capable of retrieving the surface a character has stepped on and to play an associated set of sounds based on this information.

Introduction
‍

The plugin comes with the following elements:

  • An animation notify blueprint called AN_Footstep_Surface_MetaSoundParam which takes care of binding surfaces with the desired audio samples. To be used on animations for footstep content.
  • An “Audio Surface Data Asset” located in the “Example” folder, that can be used to route indexes from the Project Settings’ to the desired values of your metasound parameter base on user’s preferences.
  • Multiple Metasound assets and their dependencies. Those Metasounds provide a good template and starting point to use in combination with the custom animation notify. 

‍

Surface Detector plugin strongly benefits from being used in conjunction with the Audio Animation Tool. This guide will cover the usage of the Surface Detector both in combination and without the Audio Animation Tool.

Process

Setting Up The Surface And The Metasounds:

To use the Surface Detector plugin effectively, the user must set up a few things.

‍

  1. Set Surface Types in Unreal Engine’s Project Settings. Go to Project Settings → Engine → Physics and scroll down to the Physical Surfaces section. Make sure these fields are populated with the surfaces of your game.

‍

  1. The user can use one of the Metasound assets provided with the plugin to bind a set of sounds to a specific surface.
    1. Those MetaSounds are located in
      Plugins\DM_SurfaceDetection\Content\Metasounds\Base\Public\
      and are named MSS_Switch_*. You can ignore the MetaSounds ending with VolumePitch_Parameters, as those are intended for use with the Audio Animation Tool. We recommend copying the MetaSound you want to use into another location in your project and working with that copy, so the original assets remain intact for future use.

‍

  1. You can now import each asset type into the corresponding index inside your new metasound asset.

‍

Remember: by default, the 0 value of your Metasound will represent the first “Default” value in your Project Settings’ Surface Type list. For the other values, index 1 in the Project Settings list will be associated with index 1 in Metasound, and so on.

‍

For example, let's say your project has surfaces of wood, stone and metal in that order. You would set that up as wave assets 1 having the wood assets, wave assets 2 having the stone assets and wave assets 3 having the metal assets. Finally, you would need to add the default sounds to use when the surface has none of these 3 materials (imagine the level designer just added a new sand environment). These default sounds would be in wave assets 0 and you could use the wood assets for example. This means that whenever we trigger the notify on an unknown surface, we would hear the wood assets.

If you’d like binding to occur differently, so that two different index values are associated with each other, please refer to the Audio Surface Data Asset section of this document.

‍

  1. !!! Before going to the next step and to have the desired result, make sure that surface types have been set on the right physical material and that those physical materials are assigned in the game !!!

‍

For example, something like the following needs to be set up:

‍

Actors have one or more materials assigned to them:

‍

Granted that you have created a Physical Material asset somewhere in your project, by opening a Material asset, you can assign a Physical Material:

‍

From the Physical Material details panel you can select the desired Surface Type for the given material:

‍

Adding The Notifies On Animation Files (Manual Way):

‍

  1. Now that those values have been linked, you can use the Surface Detector Animation Notify on any animation simply by right-clicking on the timeline and looking for the animation notify:

‍

Then, assign the corresponding metasound to the animation notify in the details panel:

‍

Using The Audio Animation Tools:

If you want to use the Surface Detector in combination with the Audio Animation Tool, make sure to import the Audio Animation Tool into your project. Please refer to the Audio Animation Tool’s documentation to get it working in your project.

‍

  1. After following the steps in the “setting up the surfaces and metasounds” section to make sure the Audio Animation Tool uses the desired animation notify as default on animations, head to the following directory: /DM_AudioTools/AudioAnimationTools and open the AudioAnimationTools_AudioFunctions blueprint and set the return node of the Get Anim Notify Class function to the AN_Footstep_Surface_MetaSoundParam animation blueprint..

‍

Additionally, make sure to replace the animation notify cast in the Set Footstep Notifies Data function of this same blueprint.

Make sure to set the sound, the follow, the attach name and the parameters for the AN_Footstep_Surface_MetaSoundParam notify. It should look like the following screenshot at the end:

‍

  1. All that is left to do now is to place our custom animation notify class on your animations, which is something the Audio Animation Tool will take care of. Please, for this step, refer to the Audio Animation Tool documentation.

‍

Audio Surface Data Asset

The Audio Surface Data Asset is useful in case your metasound inputs structure doesn’t align precisely with the project settings order. You can manually reroute the parameter value of a given surface (including default) to the desired input of your metasound like this:

‍

For example, imagine that your first input in the metasound is assigned to Wood, but Wood is actually the 4th element in your project settings. When the Wood surface type will be detected to the system it is going to be translated to an integer of value 4 which doesn’t correspond to Wood sounds in your metasound.

In this case you would specify that Wood needs to point to the first input (0) of your metasound.

‍

An Audio Surface Data Asset example file can be found inside the Example folder of the Module.

‍

You can set the Audio Surface Data Asset that you want to be used for the given animation notifies in their properties panel:

Complex Tracing

By default, complex tracing will be turned on. This means that characters walking on an actor that has multiple surface types assigned to it will play back the sound of the surface at the exact collision point detected by the line trace.

When complex tracing is turned off, the system iterates through all material slots on the hit component (Slot 0, Slot 1, etc.) and plays back the sound of the first valid surface type found. Note that Default is considered valid, but any other surface type will be preferred over Default when multiple surfaces exist on the same object.

‍

To change this option, check or uncheck the “Trace Complex” checkbox in the Line Trace for Surface Types node inside the AN_Footstep_Surface_MetaSoundParam Blueprint.

Debug

The Surface Detection plugin comes with two different console commands that can help in visualizing the detected surface and filtering it for specific characters:

‍

  1. You can use DEMUTE.Debug.PrintFootstepMaterial to show or hide the onscreen overlay and the log print of detected surfaces using 0,1, 2 and 3 as arguments.
    1. 0: hides screen overlay.
    2. 1: shows screen overlay.
    3. 2: prints logs.
    4. 3: shows screen overlay AND prints logs.

You can also filter the debug information for one or more actors in the game, adding their name after the previous commands, followed by “-solo”.

‍

  1. You can clear the debugging using DEMUTE.Debug.ClearFootstepDebugging.

‍

Examples:

DEMUTE.Debug.PrintFootstepMaterial 1: activates screen overlay for all actors.

DEMUTE.Debug.ClearFootstepDebugging: clears previous commands.

DEMUTE.Debug.PrintFootstepMaterial 3 BP_Player -solo: activates onscreen overlay and logging for specified actor.

DEMUTE.Debug.PrintFootstepMaterial 3 BP_Enemy -solo: activates onscreen overlay and logging for specified actor without removing previous actor.

Support

For additional support you can contact us at: tools@demute.studio
You can also join our public discord server at: https://discord.gg/srNFquSUtu