2
\$\begingroup\$

I'm developing a 2D game in Godot. The engine doesn't matter in this case.

Given a polygon, convex or concave, and a listener (camera) location, what 2D position should an audio emitter be placed at to simulate audio coming from the entire polygon uniformly? The audio will be directional, and volume is automatically changed based on distance to the listener (camera). One challenge I anticipate is the case where the listener is partially surrounded by the polygon, but not inside of it.

The polygon in this case may be convex or concave. Example use cases include:

  1. Audio from a river (encapsulate the whole river within the polygon)
  2. Audio from a large zone/area, such as waves from the ocean, or animals from a forest

Edit: Related questions here and here.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ In general, I don't think there is guaranteed to be any one place where you can put a single point source to exactly match the effect of even emission from the whole polygon, or that will not exhibit discontinuities as the listener moves. What you may be able to do is approximate it by multiple point sources, located at the local minima of the "distance to listener" function constrained to the perimeter of the polygon, and cross-fading between the closest 2-3 such minima according to their respective distances. \$\endgroup\$
    – DMGregory
    Commented Jul 29, 2022 at 12:12

0

You must log in to answer this question.

Browse other questions tagged .