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

Wave physics #99

Open mikenrafter opened 1 year ago

mikenrafter commented 1 year ago

Is your feature request related to a problem? Please describe. Wave physics aren't done justice via simple rays. For even simple situations, such as when there's a pillar in a room, between you and the sound — a proper sound-shadow isn't created. And it should be.

Describe the solution you'd like Allow each ray to cast sub-rays, limited in range, radially separated from eachother. More complex surroundings would be understood because of this. The Wave creates a circle representing the arc appropriated to this ray/wave and would need to remember its collisions with objects in the near-past in order to represent Huygens' wavelets properly.

Diffraction would then be possible.

Performance considerations:

  1. More rays would need to be cast per-ray.
  2. Cross-products and vector-rotation would need to be done to cast these circular rays surrounding the main-ray.

Describe alternatives you've considered

  1. The current solution, which is so far from physically accurate it doesn't do the mod concept justice.
  2. Splitting the rays into triads, calling it a Wave object, and letting the 3 rays communicate - tesselating the outgoing ray shapes.
  3. Using fixed-locations instead of rays to represent the circle around the ray.

Describe any compatibility requirements This would require a large overhaul of the current casting system, reflection and refraction system. Rays would need to be capable of accepting ending points, and a new Wave class would need to be created, and such a class would need to be responsible for spawning multiple rays.

Additional context https://www.britannica.com/science/sound-physics/Sound-absorption Goes in tandem with #98 and #97 - these are all requirements for proper acoustic/ultrasonic accuracy.