Hey! I’ve spent yesterday working on a raycast-based reverb system, which determines how much reverb and echo all 3D sounds emitted from your character should have. It updates in real-time based on your environment, and takes into account for the amount of bounces between surfaces, surface materials, and total distance travelled!
Here’s a demo using a simple song loop:
And here’s how it looks in-game, using a model from the toolbox:
Feedback on what could be improved, or what else I should add for more realism would be appreciated!
This sounds so good! Good job on making this. I have a few questions. Is this open source? You really insprired me to create this but I have no idea how. Is there at least a tutorial somewhere on how I can use ray casts to do this myself? Your game also looks very epic! I have seen your other posts as well. Thank you for inspiring me, I really hope you can give me a tip or guide how this works and how to re-create it!
Do you plan on open sourcing this??? I feel like if this was added to every game made, it would make it 2000 times more immersive, I would love to get my hands on this!
The moment I replied on this post and people started being active. I don’t know how this works but bro, really this should be open source or at least explained in a video with a basic tutorial with the main features. I really feel like that if this got open sourced every game will be 20x times better because of the better audio. Many games need this, especially FPS games like CS:GO copies or other first person shooters.
Oh thanks for the information, I just got accepted to the Dev Forum today. I still don’t know most of the stuff here. I hope you can re-create it and make it open source. I don’t think the creator of this ever responds, on most of his posts he replied once and that’s it. By the way, if you can recreate it will you make a post about it?
Hey, sorry I have no plans on open sourcing this as I’ve sold licenses to others before already - it’d be weird if I suddenly released something people paid for for free.
As to how it was implemented, I imitated sound scattering through raycasts; sounds are waves rather than beams though, so you’d have to send several of them out per frame. An exponential decay along with a dot product was used to take into account for travel distance as well as sound emission direction, with a material reflectance coefficients table to serve as multipliers for different materials.
Ideally you should use ~30 raycasts with each ray bouncing up to 4 times each, but this gets extremely expensive so I opted for 8 rays with 3 bounces each. I then pass the results through a particle filter (more specifically, a low pass filter) to smoothen out the otherwise chaotic data.
I take into account for the average ray’s travel distance, final reflectance coefficient, and amount of bounces to calculate the reverb. I use all of the properties offered by the ReverbSoundEffect object to do this - not just WetLevel.
Hey there, Its me again. I’ve tried recreating it, here is my progress so far! The reverb is not being edited currently, I just decided to add the reverb effect before I actually proceed to the calculations because why not, its just going to be easier later on. I’ve made the reflection system with the help of some friends and other people. Its more complicated than I thought! I’m still missing the exponentical decay, everything else that you said is working. I couldn’t really recreate the visualizer very well but it works. I use Debris:AddItem(0.1, Part) to remove them, I think its the easiest way to do it, it doesnt make the game lag that much, also the visualizer is just for debugging, it shouldn’t be that fancy, else you will get a lot of lag and you won’t really be able to debug correctly. For now I won’t share the script here until its ready. The next step is adding the exponentical decay, after that I just need to make the calculations and done! An almost exact recreation, thank you so much for inspiring me to create this, also thank you so much for creating RayCastHitboxes as well, this is my favoruite module to play with when I’m bored, especially with the new custom rig functions.
Edit 1: I also made it so its only local to the client, aka all of the rays are only being casted on the client itself, it works for all sounds inside of workspace so every player will be able to hear them without the need to do any server interaction. This will also allow me to add an equalizer filter (low pass) so I can also make the audio feel like its behind the wall (for example your neighbors are having a big party next floor and you only hear the basses of the song).