0
\$\begingroup\$

I'm working on a project where audio propagates through a series of rooms and portals. This is modeled by finding all paths from a source to listener and then merging their contributions into a final audio stream. The issue is for the math to make sense the paths have to be both consistent and realistic:

  • Consistent in the sense that paths should only come into existence at the edge of the maximum sound distance, to make sure there is no audio pop-in.
  • Realistic in that if a path traverses more space than necessary, it creates discontinuities. For example if the paths went through the center of the portals, larger portals would create unnecessarily larger paths.

To solve this I came up with a heuristic that tries to pick smart crossing points and it comes up with pretty tight paths, but not for all cases.

The question:

It seems to me I can solve this with a string-pulling algorithm, but most of what I've seen either uses LOS checks (which I rather not do) or are only talked about in a 2D context. Given that I already have portals that describe the degrees of freedom of each crossing, I was wondering if there is an algorithm that matches my constraints.

\$\endgroup\$
7
  • \$\begingroup\$ What's your room graph like — any constraints on the shapes / orientations / axis or grid alignment of the rooms and portals? This can often help to simplify the algorithm, or provide opportunities to offload some work to pre-computation to speed up the per-frame workload. \$\endgroup\$ Commented Jul 27 at 1:16
  • \$\begingroup\$ Let's assume your rooms are only convex polygons with no obstacles within them. In that case, you only need to check distance from portal to portal. If they are concave, you have no choice but to either (1) check line of sight or (2) devolve convex polygons to concave ones in order to apply the aforementioned method... I would do this at startup, and cache the results (assuming your levels are static). \$\endgroup\$ Commented Jul 27 at 15:37
  • \$\begingroup\$ @DMGregory rooms are cubes with possible rotation. Portals are limited planes that can also rotate. If there is a easier/faster solution for axis aligned bounding boxes, I could make that work too. \$\endgroup\$ Commented Jul 30 at 3:23
  • \$\begingroup\$ @Engineer rooms indeed are cubes with no obstacles in them, but I'm not sure what you mean by "you only need to check distance from portal to portal". \$\endgroup\$ Commented Jul 30 at 3:25
  • \$\begingroup\$ One simple approach would be to set up a uniform grid of sound volume values that can encompass all rooms, and do cellular automaton propagation of sound between cells of that grid, similar to how Minecraft propagates light (but with propagation more circular and less diamond shaped). This would not deal with sound reflections or bouncing, but would more or less accurately propagate sound between rooms, with gradually decreasing volumes based on (cell) distance from sound source. (I personally don't think string-pulling is necessary here.) \$\endgroup\$ Commented Jul 30 at 13:42

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.