Edit: Uploaded the video to youtube so that streamable wouldn’t pummel out of existence after 2 days.
To begin, I would like to mention that I didn’t come up with this idea in a vacuum, and it was heavily inspired by this post by PysephDEV.
This is mostly a recreation of what I saw from the few videos that they posted of it.
Things that it does
Material Reflectiveness/Density
Weighted Distance Calculations
Smooth Interpolation between Values
Debug Mode for you to stare at
Things that it doesn't
Accurate Occlusion
Parallelized Raycasting
Diffuse Reflections
Support for all materials (although this can easily be fixed)
The hardest part was just trying to figure out how to use the data I collected from the raycasts, and apply that to the sound effect. I swear I went through hundreds of equations before I settled on one that “worked”.
I’m gonna be honest, I don’t recommend that you use this, it’s way too convoluted for something so simple and there are better solutions out there anyways (you can just set AmbientReverb whenever you enter a new region instead of all this nonsense).
Performance is… not good. It updates on heartbeat and with 40 rays able to be reflected up to 8 times, it averages ~1.8ms on my R5 5600x without drawing any of the debug rays. This can be to your advantage, as you only have to calculate it once for a single position and you can apply it to as many sounds as you want that are coming from the same place, but it’s still abysmal.
It’s there, but I only ever use it for muffling audio if your camera cant see the audio’s source position.
The test place is still up for download if you want to mess with it. It’s in ReplicatedStorage I believe.
Too bad this will eventually be useless with roblox’s own audio emitters and listeners coming around the corner : p
You’d have to set up a new emitter at every source and simulate their reverb, then put the sounds you want to have reverbed under them which is super resource intensive (unless you turn the ray count wayy down) which is why I kinda gave up on this.
Idk i dont remember why I did it like that it’s just the way it is
That’s sad, Well. Do you have plans on making another one of these modules with roblox’s new Audio API? It has great features that the API doesn’t have (reverb, etc.)? This has great potential.
Maybe, I haven’t looked into what the new system entails but it really depends on if roblox fleshes out their own reverb systems. If not, and if I feel the need to update this, then I will.