Physics Related Sound Systems: implementation of procedural sounds for different materials in video games

Luca Petrillo
5 min readNov 18, 2020

Usually the realism of an interactive experience is based on these main components: graphics, physics & AI, and audio. After more than 30 years of computer graphics enhancements, modern 3D games such as Sony’s God of War, or Ninja Theory’s “Hellblade: Senua’s Sacrifice” can deliver a stunning and near-photorealistic image at interactive rates. This is not only related to graphics, for example games like Valve’s Half Life 2 or Rockstar’s Red Dead Redemption have developed a complex integrated physics system, including objects which interact one with another in a realistic way (N. Raghuvanshi, C. Lauterbach: ACM Press, 2007)

Propagation of Sound Waves on different materials

Sound is a sequence of pressure waves (called acoustic waves), which propagates through compressible medium (gaseous, liquid or solid). During the propagation the acoustic waves can be reflected, refracted or attenuated by the medium.

When particles in the medium vibrate parallel to the direction in which the sound wave is traveling, we have a longitudinal wave. On the contrary in some materials, it is possible to transmit transverse waves, characterised by having the vibrations moving perpendicular (transverse) to the direction of wave travel. Transverse waves travel horizontally (from left to right) — the vibration direction is perpendicular (at right angles) to the direction in which the wave travels or propagates. Waves in water and on strings are two good examples.

In air, sound is transmitted by pressure variations from its source to the surroundings. The sound level decreases, as it gets further and further away from its source. While absorption by air is one of the factors attributing to the weakening of a sound during transmission, distance plays a more important role in noise reduction during transmission.

The reduction of a sound is called Attenuation. The effect of distance attenuation depends on the type of sound sources. Most sounds or noises we encountered in our daily life are from sources, which can be characterised as point or line sources.

“For a point source, the noise level decreases by 6dB per doubling of distance from it.” If the sound source produces cylindrical spreading of sound such as stream of motor vehicles on a busy road at a distance, it may be considered as a line source. “For a line source, the noise level decreases by 3dB per doubling of distance from it”. (Wiener and Keast, 1959)

Properties affecting the behaviour of sound propagation

All media have three properties, which affect the behaviour of sound propagation:

  • A relationship between density and pressure: this relationship, affected by temperature, determines the speed of sound within the medium
  • The motion of the medium itself: example winds. Independent of the motion of sound through the medium, if the medium is moving, the sound is further transported
  • The viscosity of the medium: this determines the rate at which sound is attenuated. For many media, such as air or water, attenuation due to viscosity is negligible.
Figure 1: Compression and Rarefaction of sound waves (Prof. O. O. Ogunsote, University of Technology Akure)

— Practical Implementation of sound on different materials with Unreal —

Setting up Surface Types

Unreal Engine 4 allows to associate physical material types with shaders, so a snowy material can tell other systems which material it is made of. A wooden floor can be categorised as wood, and a grass material can behave as Grass when an object or a character is interacting with it.

In order to do this, it is needed to declare which material type are used inside the level. As shown in Figure 2, these settings are in project’s Edit > Project Settings Screen > Physics Section.

Figure 2: Physics window in Project Settings

Physical Materials

Next, it’s good to set up some “Physical Materials” that will refer to the surface types added in the project settings and then assign them to Floor materials. As shown in Figure 3 in the content browser, right-click and add Physics > Physical Material. Create and name physical material for each surface type it’s added in Project settings.

Figure 3: Assignment of Surface Type for each different physical material

Applying Physical Materials to the Shaders

After creating physical material it is needed to open each flooring material and inside the details panel, select the right material from the drop-down menu. See Figure 4.

Figure 4: Apply the Physical Material to the appropriate shader

Setting Up Sound Cues

For the footsteps example I created different sound cues that will trigger procedural sounds for surface type. See Figure 5

Figure 5: Sound Cue of Footsteps on the water

What has the player stepped on?

After completed the sound cues, it’s time to modify the blueprint in the Player Character. First, it is essential to find a way of detecting the surface type the player is walking over. To do this it needs to run a line-trace from the player character to the surface below and querying the material it hits, as shown in figure 6.

Figure 6: Character Animation Blueprint

Conclusions

It is clear that implementing physics based sound systems can definitely increase the realism of the game. With this technique is possible to create procedural systems which interact with different material types.

- References -

--

--