Footsteps in Unity3D

This is footsteps sounds testing area where you can walk on various surfaces and hear different versions of sound.

The footstep sound set is determined by collision with terrain and objects. The footsteps script examines whether the Player is walking on the Terrain or the other object. If  Terrain is detected under the Player’s foot version of the footsteps is determined by examining Terrain Texture.

Because Terrain Textures can me mixed and scattered there is kind of ‘sound antialiasing’ applied (not in the literal sense). This is done by mixing recently played footstep sound type with the new one. Volume of the old one is decreased to some degree (~50%). This alleviate a little an unpleasant effect of quick switching between sets of footsteps – especially when single footstep of the whole set is played and then switched to another. This helps the Player to percieve background sound as nicely blended and less discrete (binary 0/1). You can test the difference of ‘footsteps antialiasing‘ by switching it off or on using ‘E’ key. By default it is turned on.

Footsteps are shuffled and tempo of steps is based on Players speed.

There are two areas where you can hear a reverb on footsteps. One is achieved with Unity3ds Reverb Zone. The second one uses stereo samples with mixed prerendered Reverb. The second  solution takes much more memory than the first one because of stereo sound and long reverb tails.

Controls: WASD + Mouse and left shift to run. It doesn’t work in Chromium based browsers anymore (Chrome, Opera) so you have to use Firefox or else.

Update info (06.2017): due to policy changes and lack of updates of old webplayer by Unity, online example seems not to work in any of current browsers. Sorry.

[unity src=”749″]

Triggering Reverb Zones in Unity 3D

To have nice ambience of the closed places like room, cave or church you need to set up Reverb Zones. But Unity 3D 4.x provides only spherical shaped Reverb Zones which doesn’t fit into a box. In order to have such a place nicely filled with the reverberation we need to use triggers to switch it on and off when the player enters the area.

Barrack 1
Setup of Reverb Zone and Trigger for Barrack 1.

For simple shapes it is efficient to use Box Colliders. But there is another problem – do not cut reverb aburptly when player steps out the trigger. It is better to use simple scripting to smoothly fade out a reverb zone when OnTriggerExit occurs.

 

Listen to three cases in the scene below:

  • Barrack 1 uses a bit tricky positioned and tight setting for minDistance and maxDistance parameters of Reverb Zone to fade reverbation right before entrance. Not to flexible but useful sometimes.
  • Barrack 2 fades amount of reverb for a short period of time before switching it off. Simple smoothing can be easely spotted.
  • Barrack 3 fade bases on Players distance from the entrance. If the Player change his mind right after stepping out of the Barrack to go back, the reverb doesn’t disappear completely. In this example it is checked only on the exit, to preserve some CPU but you can do in both ways ofcourse.

Examples 2 and 3 operate on the single Reverb Zone parameter.

Controls: WASD + Mouse look. Small icon on the right bottom corner to fullscreen. About 5MB data to go. Unity Web Player is required.

Update info (06.2017): due to policy changes and lack of updates on Unity side, online example seems not to work in any of current browsers. Sorry. There is movie instead.
[unity src=”717″]

 

ps: The lightbulb in the Barrack 3 is broken.

Shooting Sci Fi Weapon Packs 1 & 2 for Unity Asset Store

A sound demos of Shooting Sci Fi Weapon Packs 1 & 2 designed for Unity Asset Store. The first one contains 64 distinctive oneshot sound effects. In the second one there are 67 sounds.

Shooting Sci Fi Weapon Packs 1 in Unity Asset Store

Shooting Sci Fi Weapon Packs 2 in Unity Asset Store