thedocruby / resounding

A New Minecraft mod that provides realistic audio physics using parallel wave tracing and an improved physics algorithm.
https://thedocruby.dev/resounding
GNU Lesser General Public License v3.0
85 stars 4 forks source link

Block sounds are self-occluded #43

Closed YurgenSchn closed 2 years ago

YurgenSchn commented 2 years ago

The closing sound of doors and trapdoors will sound much quieter and muffled if I have no line of sight with the center of the block. Since doors/trapdoors aren't centered, I believe this is due to the sound beign produced at the center of the block, and the "dynamic occlusion" muffling it in realtime (sometimes you can hear the occlusion beign delayed very briefly. I suppose this is related to sound refresh interval. This part is fine). I think a similar issue occurs with pistons extending aswell, but i'm not confident on this one (i feel like they sound muffled overall, but it's not as strong of an effect).

Screenshots In this image, i have a house, with a blue warped door.

image

If i open and close it from outside, it sounds fine, as i have direct line of sight with the center of the block. But doing it from the inside, the closing sound will be muffled, and much quieter as i do from farther inside the house.

Possible Solutions Maybe double the sound source, to play it inside and outside the door (the cheese way) Maybe make it so if a block produces a sound, it itself can't occlude its sounds (could do the trick for pistons, and the placing block sound issues from issue #42 )

My Machine:

thedocruby commented 2 years ago

Your analysis of the problem is very precise as well as accurate. Most of this stems from the fact that the occlusion mode is locked to "Fast", which is actually a form of pseudo-occlusion which uses the shared airspace measurements from the reverb pass. The true occlusion calculation is scheduled for Milestone 2 (approaching ever faster). However, this does raise an interesting point, and perhaps uncovers a flaw in the code that may have gone unnoticed otherwise.

The raycast method used by Resounding includes an optional parameter for a block to ignore. This is supposed to be used to prevent problems such as self-occlusion. However, it appears that in this case it may not be applied correctly. Thank you for bringing this issue to light!

thedocruby commented 2 years ago

Update: Everything looks fine in the code, but I will try using debugging tools tomorrow. If I am unable to find the cause by the end of the day tomorrow, I think it will be okay to release with the issue unresolved.

YurgenSchn commented 2 years ago

Update: as of Resounding alpha-7 (might've changed in a few earlier alphas), doors and trapdoor won't muffle (absorption brightness) their own closing sounds, but there's still some sort of occlusion: as i get farther from it, the sound still gets unusually quieter.

Also, it seems reverb (volume and length) is affected too: in the closing sound, it seems to "give preference" to one environment (and its reverb properties), the one where the door-block center is exposed.