published Wednesday, 13 April 2011, 00:00 by Kenneth
One thing which has always annoyed me in many games is the fact that sounds are originating from a single point. While realistic in itself it often doesn't sound realistic... So why not fix it?...
Point Sound Source
In real life sounds usually originate from a single point like a trumpet, a mouth, the beak of a bird or the various parts in a car-engine.
But when you listen to a highway or other "linear" sound-sources you don't hear the individual cars and it's even more impossible to hear the individual parts in the car-engines.
Game engines usually only gives you point-sourced sounds to work with, so to create for instance a river, you need to do something like I did in the Unity example below. I've placed a number of point sound-sources in the middle of the river with some spacing. Notice how the sound is "uneven" when you walk from one point-sound to another, and you never really feel like you are standing in the river.
Linear, Cubic or other Sound Sources
So I've made a simple prototype to emulate linear sound-sources (in this case it's actually a loooong cube, but it can also be other geometrical shapes).
This way I can make a river sound more "realistic" by letting the sound of the river "follow" the character along the edge of the river and when you walk into the river I gently slide the sound from mono to stereo, so it sounds like you are surrounded by the river instead of using mono/point-sounds like in the first example...
And all of this by using only one stereo sound-source instead of multiple mono sound-sources like I did in the first example.
And it was actually made with very few lines of code in Unity (all power to Unity!!!).