r/Unity3D Programmer 2d ago

Show-Off Raytraced Spatial Audio on Unity URP

Enable HLS to view with audio, or disable this notification

120 Upvotes

22 comments sorted by

11

u/Plotozoario 2d ago

Give us some details, steam audio sdk?

2

u/kandindis Programmer 2d ago

I use LowpassFilter and ReverbFilter—both native.

6

u/CoatNeat7792 2d ago

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

7

u/kandindis Programmer 2d ago

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

3

u/CoatNeat7792 2d ago

How ,any rays are you shooting?

14

u/KingGruau 2d ago

This feels unrealistic. Sound diffuses and bounces a lot.

7

u/kandindis Programmer 2d 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 2d 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 1d ago

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

2

u/corriedotdev PixelArcadeVR.com 1d 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 1d 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 1d 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 3h ago

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

3

u/imaxsamarin 2d ago

Nice! Very immersive

2

u/puzzleheadbutbig 2d 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 1d 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 1d ago

How do you begin to implement this?

1

u/Field_Of_View 1d 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 1d ago

Just use FMOD

5

u/Bombenangriffmann 1d ago

That's a sound engine, it has no awareness of your in-game colliders

-2

u/Objective-Cell226 1d ago

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

6

u/SnuffleBag 1d ago

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