Volumetric Audio


DOCUMENTATION

How do I get started?


Step 1 - Create a Volumetric Shape

Volumetric Audio supports 5 different audio shapes (Sphere, Box, Capsule, Path, and Mesh), you can use any combination of these to sculpt your audio world.

For example: if you want to apply volumetric audio to some power lines in your scene, then you would probably want to use the Mesh or Path shapes. However, if you want to apply volumetric audio to a tunnel then you might want to use the Box shape instead.

Once you've decided which shape you want, select your GameObject and go to Add Component / Volumetric Audio / __shape__, you should now see a shape component added to your GameObject (e.g. VA_Capsule if you chose a capsule shape).

NOTE  If your selected GameObject already contains a collider (e.g. a CapsuleCollider), then adding the appropriate volumetric audio shape will automatically copy the collider settings for you.
NOTE  If your volumetric shape is too complex to be represented by just one of these shapes, then you can create it using multiple shapes (if you do this, I recommend you use a separate GameObject for each shape).


Step 2 - Add an Audio Source to Your Scene

Now it's time to add an Audio Source to your scene. If you've imported a sound (e.g. WindLoop.wav) into your Unity project, then you can just drag and drop it from the Project window into your Scene or Hierarchy windows.

Once you've added it, you'll probably want to check the Loop option if you want your sound to loop, and also you'll probably want to drag the Spatial Blend slider to the 3D side. You might also want to play with the volume and rolloff settings.



Step 3 - Bind Your Audio Source to the Volumetric Shape.

Now that you've created your volumetric shape and sound, it's time to bind them together.

To do this, select your Audio Source GameObject and go to Add Component / Volumetric Audio / VA Audio Source, you should now see the VA_AudioSource component in the inspector window.

Inside the VA_AudioSource component you should see the Shapes field marked in red. If you drag and drop the volumetric shape you made earlier into this field, then it should work.

NOTE  If your volumetric shape is represented using multiple shapes (e.g. three VA_Box components), then you can drag and drop them all into the Shapes field.


Step 4 - Make Your Game!

If you hit play, you should now have volumetric audio!

If it doesn't seem to work, then make sure you play around with the 3D sound settings (particularly volume, spatial blend,, loop, and rolloff).

Additionally, if you select your volumetric shape then you can view its shape in the Scene window.




2D & 3D Sounds


3D Sounds

Volumetric Audio uses Unity's built-in Audio Source component to produce audio. This allows you to hear which way the sound is coming from based on the camera's position and orientation. However, if your camera goes inside a 3D shape, then Unity's audio system won't be able to decide which way the sound is coming from, because the sound is actually all around you.

This is why the VA_AudioSource component has the Blend setting. If you enable this, then 3D sounds will gradually turn into 2D sounds as the camera approaches the volumetric shape. Once the camera is inside the shape, the Audio Source's Spatial Blend setting will turn to 2D, and the sound will appear to come from all around you. You can then play around with the Blend Min Distance and Blend Max Distance settings to adjust how small or wide this transition should be.



2D Sounds

Like 3D sounds, Volumetric Audio uses Unity's built-in Audio Source component to produce 2D audio (e.g. ambient/background music). However, the built-in Audio Source component doesn't have any way to change the volume of the sound based on your camera's position, so it's always playing at its default volume.

This is why the VA_AudioSource component has the Volume setting. If you enable this, then your Audio Source's volume setting will change based on the camera's distance to your volumetric shape. You can then play around with the Volume Min Distance and Volume Max Distance settings to adjust how small or wide this transition should be.




What Examples Are Included?

This is a list of the in-game example scenes and a description of what it shows.

Box

This shows you how to make a volumetric sound in the shape of a box. This is done by adding the VA_Box component the box, and the VA_AudioSource component to your sound. You can then enable the .Position setting, and drag and drop the box GameObject into the Position / Shapes list. This will associate the sound with the volumetric shape. The VA_Box.IsHollow setting can be used to make the sound only emit from the hollow shell of the shape.

Sphere

This shows you how to make a volumetric sound in the shape of a sphere. This is done by adding the VA_Sphere component the sphere, and the VA_AudioSource component to your sound. You can then enable the .Position setting, and drag and drop the sphere GameObject into the Position / Shapes list. This will associate the sound with the volumetric shape. The VA_Sphere.IsHollow setting can be used to make the sound only emit from the hollow shell of the shape.

Capsule

This shows you how to make a volumetric sound in the shape of a capsule. This is done by adding the VA_Capsule component the capsule, and the VA_AudioSource component to your sound. You can then enable the .Position setting, and drag and drop the capsule GameObject into the Position / Shapes list. This will associate the sound with the volumetric shape. The VA_Capsule.IsHollow setting can be used to make the sound only emit from the hollow shell of the shape.

Mesh

This shows you how to make a volumetric sound in the shape of a mesh. This is done by adding the VA_Mesh component the mesh, and the VA_AudioSource component to your sound. You can then enable the .Position setting, and drag and drop the mesh GameObject into the Position / Shapes list. This will associate the sound with the volumetric shape. The VA_Mesh.IsHollow setting can be used to make the sound only emit from the hollow shell of the shape. Keep in mind meshes can only be made volumetric if they are closed and have no holes/gaps.

Bake

This shows how you can bake high poly meshes so they run efficiently at runtime. Try selecting the mesh and clicking Clear Baked Mesh to see the speed difference!

Dynamic

This shows how you can make sound emanate from a dynamic mesh. Just keep in mind this approach is quite expensive, so try to limit it to low poly meshes, or provide a low poly variant for the audio system to use.

Path

This shows you how to make a sound in the shape of a path. This is done by adding the VA_Path component to a GameObject, and the VA_AudioSource component to your sound. You can then enable the .Position setting, and drag and drop the mesh GameObject into the Position / Shapes list. This will associate the sound with the shape. If you select your path then you can move the points around in the Scene view, as well as click to split a line.

Rotating Doppler

This shows how you can make sounds emanate from rotating objects. Notice the doppler effect as the object passes by the camera.

Compound Shape

This shows how you can use the Shapes list to combine multiple shapes into one, and have the same sound emanate from all of them.

Occlusion

This shows how you can use the Occlude and Occlude Groups settings to make certain objects block sound from travelling through them.

Zones

This shows how the VA_Zone component can smoothly enable sounds when entering the zone, and smoothly disable sounds when exiting. This is very useful for improving performance in large scenes that don''t need every sound enabled at the same time. The Deactivate Game Objects setting can also be used to increase performance even more!

Exclusion Zones

This shows how the Excluded Shapes list can be used to create pockets within volumetric shapes where sound can''t emanate from. Fly into the cube to hear it in action.

Whizzing Bullets

This shows you how the VA_AudioSource.Fade & FadeWhiz settings can be combined to increase and maintain a sounds volume when they pass by the listener, simulating bullets whizzing past.

River

This shows a number of Volumetric Audio features working at the same time in common game scenarios.



Integrations


DJ PRO

Volumetric Audio is compatible with the DJ PRO asset, which allows you to play music from your in-game library.

To see an example of them working together, install the Plugins/CW/VolumetricAudio/Integrations/DJ PRO package.

For more information:

DJ PRO



Radio PRO

Volumetric Audio is compatible with the Radio PRO asset, which allows you to play music from online radio stations.

To see an example of them working together, install the Plugins/CW/VolumetricAudio/Integrations/Radio PRO package.

For more information:

Radio PRO



RT-Voice PRO

Volumetric Audio is compatible with the RT-Voice PRO asset, which allows you to automatically voice written text.

To see an example of them working together, install the Plugins/CW/VolumetricAudio/Integrations/RT-Voice PRO package.

For more information:

RT-Voice PRO








Assets

Here's a list of all my other assets, please check them out!

You can also view this list on my Asset Store page.

Lean Touch

Lean Touch

Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!


Lean Touch+

Lean Touch+

Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.


Lean Localization

Lean Localization

Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.


Lean Pool

Lean Pool

Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.


Lean Transition

Lean Transition

Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.


Lean GUI

Lean GUI

Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.


Lean GUI Shapes

Lean GUI Shapes

Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!


Lean Texture

Lean Texture

Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!


Lean Texture+

Lean Texture+

Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!


CW Spaceships - Build & Destroy

Spaceships - Build & Destroy

Build your dream spaceship, and then have fun destroying it!


Modular Backgrounds

Modular Backgrounds

Unlock a universe of visual possibilities with Modular Backgrounds. Simply drag and drop these graphics into the background of your scenes.


Paint in 3D

Paint in 3D

Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!


Paint in 2D

Paint in 2D

Paint all your sprites with Paint in 2D. With incredible performance on mobile, WebGL, and much more!


Paint in Editor

Paint in Editor

Paint in Editor unlocks the ability to paint objects in your scene - great for making small tweaks, or even creating entirely new texture sets!


FLOW

FLOW

FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.


Destructible 2D

Destructible 2D

Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!


Space Graphics Toolkit

Space Graphics Toolkit

Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.


Space Graphics Planets

Space Graphics Planets

Enhance your space scenes using this large pack of high detail volumetric planets. These planets are finished using the powerful planet features from Space Graphics Toolkit (not required).


Volumetric Audio

Volumetric Audio

Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.






Versions

2.1.0

Updated CW/Common code to latest version.



2.0.2

Moved main build to Unity 2021.3.0f1.
Updated shaders to latest version.



2.0.1

Updated shaders for URP and HDRP.
Moved main build to Unity 2020.3.0f1.
Fixed sound positioning VaMesh issue in some scenarios.



2.0.0

NOTE  This is a massive update. To update you must first back up your project, delete the root VolumetricAudio folder, then install the new version.

Changed folder structure to be inside Plugins/CW/VolumetricAudio.
Updated inspector code to support third party assets that implement nested inspectors.
Added basic FMOD integration package to Integrations folder.
Added audio listener fallback to the MainCamera when using a custom audio system.



1.2.3

Fixed transform gizmos not appearing in Unity 2021.2.
Added support for new Input System package.
Replaced VA_Freeflight component with VA_CameraMove and VA_CameraPivot.



1.2.2

Added VA_AudioSource.Distant setting.
Fixed VA_Zone error.
Fixed VA_Path error.



1.2.1

Added Examples/Integrations/RT-Voice PRO package.
Added Examples/Integrations/DJ PRO package.



1.2.0

Added Examples/Integrations/Radio PRO package.



1.1.9

Refactored all code.
Improved all demo scenes.
Updated documentation.



1.1.8

Improved AudioListener search to ignore disabled ones.
Added VA_AudioListener to support custom audio systems.



1.1.7

Fixed VA_Sphere shape with non-uniform scaling.
Fixed VA_Capsule shape with non-uniform scaling.



1.1.6

Fixed shaders warnings in Unity 5.5+.
Updated all demo scenes.
Removed Ambient Music demo scene.



1.1.5

Optimized baked VA_Mesh by over 300%.
Added VA_Zone component to disable audio sources that are too far away.
Added Zones demo scene.
Added VA_AudioSource.Position setting.
Added VA_AudioSource.PositionDampening setting.







Components

VA_AudioListener

If you're using a custom audio system then you can add this component to your audio listener (ear), so volumetric audio knows where it is.


static List<VA_AudioListener>
Instances

This contains all active and enabled VA_AudioListener instances.




VA_AudioSource

This component can be added to any sound to make it volumetric.


bool
Position

Should this sound have its position update?



float
PositionDamping

The speed at which the sound position changes.

0 = Instant.



List<VA_Shape>
Shapes

The shapes you want the sound to emit from (e.g. VA_Mesh).



List<VA_VolumetricShape>
ExcludedShapes

The shapes you want the audio source to be excluded from.



bool
Blend

Should this sound have its Spatial Blend update?



float
BlendMinDistance

The distance at which the sound becomes fully mono.



float
BlendMaxDistance

The distance at which the sound becomes fully stereo.



AnimationCurve
BlendCurve

The distribution of the mono to stereo ratio.



bool
Volume

Should this sound have its volume update?



float
BaseVolume

The base volume of the audio source.



VA_Zone
Zone

The zone this sound is associated with.



bool
Fade

Should the volume fade based on distance?



float
FadeMinDistance

The distance at which the sound fades to maximum volume.



float
FadeMaxDistance

The distance at which the sound fades to minimum volume.



AnimationCurve
FadeCurve

The distribution of volume based on its scaled distance.



bool
FadeWhizz

Should the volume fade cap to the closest distance to simulate a bullet whizzing past?



float
FadeWhizzClosestDistance

The sound volume will be calculated based on this distance rather than the actual distance. If the actual distance is lower than this, then this value will be reduced to match.



bool
Occlude

Should this sound be blocked when behind other objects?



OccludeType
OccludeMethod

The raycast style against the occlusion groups.



bool
OccludeMaterial

Check for VA_Material instances attached to the occlusion object?



float
OccludeDamping

How quickly the sound fades in/out when behind an object.



List<OccludeGroup>
OccludeGroups

The amount of occlusion checks.



bool
Distant

Should this sound's dynamics change based on its distance to the camera?



float
DistantMinDistance

The camera distance where the minimum sound dynamics will be used.



float
DistantMaxDistance

The camera distance where the maximum sound dynamics will be used.



AudioReverbFilter
DistantMinDynamics

The sound dynamics used when the camera is at or below the minimum distance.



AudioReverbFilter
DistantMaxDynamics

The sound dynamics used when the camera is at or above the minimum distance.




VA_Box VA_VolumetricShape

This component allows you to define a box shape that can emit sound.


BoxCollider
BoxCollider

If you set this, then all shape settings will automatically be copied from the collider.



Vector3
Center

The center of the box shape.



Vector3
Size

The size of the box shape.




VA_BulletSpawner

This component allows you to create a bullet spawner that sprays bullets forward.


Rigidbody
Prefab

The bullet prefab.



float
Spray

The spray angle in degrees.



float
Speed

The speed of the bullets in units per second.



float
Age

How long the bullet stays alive in seconds.



float
Delay

The time between each shot in seconds.




VA_Capsule VA_VolumetricShape

This component allows you to define a capsule shape that can emit sound.


CapsuleCollider
CapsuleCollider

If you set this, then all shape settings will automatically be copied from the collider.



Vector3
Center

The center of the capsule shape.



float
Radius

The radius of the capsule shape.



float
Height

The height of the capsule shape.



int
Direction

The direction of the capsule shape.




VA_ChangeSpiral

This component animates the VA_Spiral component's AngleStep setting.


float
AngleStepA

The minimum AngleStep value.



float
AngleStepB

The maximum AngleStep value.



float
Interval

The amount of seconds it takes to go from AngleStep A and B.




VA_Material

This component allows you to define a specific volume override for the current collider.


float
OcclusionVolume

The volume multiplier when this material is blocking the VA_AudioSource.




VA_Mesh VA_VolumetricShape

This component allows you to define a mesh shape that can emit sound.


MeshCollider
MeshCollider

If you set this, then all shape settings will automatically be copied from the collider.



MeshFilter
MeshFilter

If you set this, then all shape settings will automatically be copied from the filter.



Mesh
Mesh

The mesh of the mesh shape.



float
MeshUpdateInterval

The interval between each mesh update in seconds

-1 = No updates.



float
RaySeparation

How far apart each volume checking ray should be separated to avoid miscalculations. This value should be based on the size of your mesh, but be kept quite low.




VA_MeshLinear

This class stores unbaked mesh triangle information.



VA_MeshTree

The class stores baked mesh triangle information.



VA_Path VA_Shape

This component allows you to define a path shape that can emit sound.

If you select a GameObject with this component then you can edit the points in the Scene view.


List<Vector3>
Points

The local space points for the path.




VA_Plane

This class defines a serializable plane.



VA_PopupAttribute

This attributes allows you to create an int popup inspector element.



VA_Shape

This is the base class for all shapes (e.g. VA_Path).



VA_Sphere VA_VolumetricShape

This component allows you to define a path shape that can emit sound.


SphereCollider
SphereCollider

If you set this, then all shape settings will automatically be copied from the collider.



Vector3
Center

The center of the sphere shape.



float
Radius

The radius of the sphere shape.




VA_Spin

This component spins the current GameObject.


Vector3
DegreesPerSecond

The amount of degrees this GameObject is rotated by each second in world space.




VA_Spiral

This component procedurally generates a flat spiral mesh.


int
SegmentCount

Amount of segments in the spiral.



float
SegmentThickness

Thickness of the spiral in local space.



float
InitialAngle

Initial angle of the spiral edge in degrees.



float
InitialDistance

Initial distance of the spiral inner edge in local space.



float
AngleStep

Angle increment of each spiral segment in degrees.



float
DistanceStep

Distance increment of each spiral segment in local space.




VA_Triangle

This class defines a serializable triangle.



VA_VolumetricShape VA_Shape

This is the base class for all volumetric shapes (e.g. VA_Box).


bool
IsHollow

If you set this, then sound will only emit from the thin shell around the shape, else it will emit from inside too.




VA_Wireframe

This component allows you to draw a wireframe between specified pairs of points. The points can be generated from a MeshFilter too.


List<Pair>
Pairs

The lines making up the wireframe.



Material
Material

The material used to render the wireframe mesh.




VA_Zone

This component allows you to create a spherical zone that you must enter for the specified sounds to play.


float
Radius

The radius of this zone in world space.



bool
DeactivateGameObjects

Should the GameObjects of the sounds be de/activated?



float
VolumeDamping

The speed at which the volume changes to its target value.



List<VA_AudioSource>
AudioSources

The audio sources this zone is associated with.



float
CurrentVolume

The current volume of this zone.




Index

How do I get started?

2D & 3D Sounds

What Examples Are Included?

Integrations



Assets

Lean Touch

Lean Touch+

Lean Localization

Lean Pool

Lean Transition

Lean GUI

Lean GUI Shapes

Lean Texture

Lean Texture+

Spaceships - Build & Destroy

Modular Backgrounds

Paint in 3D

Paint in 2D

Paint in Editor

FLOW

Destructible 2D

Space Graphics Toolkit

Space Graphics Planets

Volumetric Audio



Versions

2.1.0

2.0.2

2.0.1

2.0.0

1.2.3

1.2.2

1.2.1

1.2.0

1.1.9

1.1.8

1.1.7

1.1.6

1.1.5



Components

VA_AudioListener

VA_AudioSource

VA_Box

VA_BulletSpawner

VA_Capsule

VA_ChangeSpiral

VA_Material

VA_Mesh

VA_MeshLinear

VA_MeshTree

VA_Path

VA_Plane

VA_PopupAttribute

VA_Shape

VA_Sphere

VA_Spin

VA_Spiral

VA_Triangle

VA_VolumetricShape

VA_Wireframe

VA_Zone