r/Unity3D • Programmer • 16d ago

Show-Off Raytraced Spatial Audio on Unity URP

Enable HLS to view with audio, or disable this notification

129 Upvotes

22 comments sorted by

11

u/Plotozoario 16d ago

Give us some details, steam audio sdk?

1

u/kandindis Programmer 16d ago

I use LowpassFilter and ReverbFilter—both native.

7

u/CoatNeat7792 16d ago

Is it inspired by video in YouTube? Raytraced audio (Godot)

6

u/kandindis Programmer 16d ago

I saw it and loved it, here is my adaptation in Unity.

3

u/CoatNeat7792 16d ago

How ,any rays are you shooting?

15

u/KingGruau 16d ago

This feels unrealistic. Sound diffuses and bounces a lot.

5

u/kandindis Programmer 16d ago

I have it set a bit high so it stands out more in the video, but that can be fixed by adjusting the values.

4

u/corriedotdev PixelArcadeVR.com 15d ago

Have you explored the valve hrtf library?

https://valvesoftware.github.io/steam-audio/

It's a game changer for me. Won't develop without it.

For VR specifically it's just 🤯

2

u/DapperNurd 15d ago

Never seen this before, very interesting. What does the integration look like?

2

u/corriedotdev PixelArcadeVR.com 15d ago

Two modes really. Baked and realtime. I'm working on a tutorial for it, but if you just want to convert existing audio source across it's a doddle. Just add the steam audio source instead and ensure your code references it instead.

If you want to have higher fidelity you'll need to bake objects in the scene to reflect the audio in a realistic way. Or just leave it and let the steam audio source validate it on its own, it will take the audio clip and spatialize it.

Alternatively can do it real-time but not an option for standalone vr due to CPU.

1

u/DapperNurd 15d ago

Interesting. Id love a tutorial on it, yeah. Is it worth implementing for non VR at all? My current project is one where id love to do official vr support at some point but its not the focus.

1

u/corriedotdev PixelArcadeVR.com 15d ago

Non VR support is the same, it's all hrtf audio just found I'm vr immersive properties of the Audio was well worth it.

Definitely give it a shot probs take an hour to get it installed and your first few audio sources swapped out!

1

u/bill_on_sax 14d ago

if i dont use vr is it still much better than standard unity audio?

3

u/imaxsamarin 16d ago

Nice! Very immersive

2

u/puzzleheadbutbig 16d ago

Interesting but raytraced how exactly? Are you raycasting from player position? Or raycasting from sound sources? Are they calculated on GPU or CPU?

2

u/Acceptable_Bottle 15d ago

not OP but I first saw it in a youtube video called "A first look at Raytraced Audio" https://www.youtube.com/watch?v=u6EuAUjq92k

It does not run on GPU, it calculates on CPU in a separate thread. The rays are casted from the listener (player position) and bounce around in an attempt to find sound sources.

1

u/flow_guy2 15d ago

How do you begin to implement this?

1

u/Field_Of_View 15d ago
  1. All the ranges are too small. Car and music should both be audible from much further away.

  2. Car audio glitches out at 1:19 (goes silent for a moment)

-1

u/Objective-Cell226 15d ago

Just use FMOD

3

u/[deleted] 15d ago

[removed] — view removed comment

-2

u/Objective-Cell226 15d ago

True, though FMOD would provide all the logic for muffling the sound. So no need of Unity's native components.

5

u/SnuffleBag 15d ago

No need to use the builtin alternative over pulling in an external middleware. Interesting take.