Skip to content

Change line of sight occlusion to be calculated by the audio system rather than the client - #14

Draft
ccp-zoetrope wants to merge 3 commits into
mainfrom
los-occluder-spheres
Draft

Change line of sight occlusion to be calculated by the audio system rather than the client#14
ccp-zoetrope wants to merge 3 commits into
mainfrom
los-occluder-spheres

Conversation

@ccp-zoetrope

Copy link
Copy Markdown
Member

The game used to compute line-of-sight blockage and push values per emitter from the client code itself. The game now registers the bounding spheres of balls that can block sound with carbon audio and this then tests each positioned emitter's sightline against them. In essence, the client is now responsible for pushing a smaller scale version of the Carbon Destiny ballpark into carbon audio.

Why

There are a few benefits we get from moving occlusion detection into carbon audio, rather than having the client doing all the calculations for occlusion:

  1. It is much quicker for carbon audio to iterate over all existing audio emitters and test it against balls in space than it was for Python to have to constantly query for all audio emitters on models.
  2. Carbon audio knows where the listener is at all times and is better equipped to run calculations against it.
  3. The functionality is more self contained in the audio engine rather than spread out between the client and audio engine too much. It also makes it easier to flip between this and geometry based acoustics on the fly.

How it functionally works

  • The client is now responsible for pushing a smaller snapshot of the Carbon Destiny ballpark to carbon-audio.
  • Carbon audio does its own calculations against those balls to see if the emitter has line of sight to the listener.
  • Carbon audio fades and unfades emitters as necessary depending on these calculations.
  • Carbon audio is restricted at any one time to a single occlusion/obstruction based system. If spatial geometry is enabled then line of sight obstruction is disabled.
  • A new python file and occlusion manager was added specifically for the line of sight occlusion so that we did not bloat AudManager further.
  • Removed existing line of sight API's when the client was in charge of doing the obstruction calculations itself.
  • Added diagnostic APIs for testing and QA tooling.

Testing

  • Tests were added and are passing locally.
  • This was tested live on a sandbox stream and seems to work.

ccp-zoetrope and others added 3 commits August 11, 2026 10:41
Register occluder spheres with the audio system and let Update() compute each positioned emitter's occlusion by testing the listener-to-emitter segment against them, instead of the game pushing per-emitter blockage. While spheres are registered, per-emitter blockage calls are rejected so the two drivers cannot fight; both stay disabled while acoustics is on.

- Occluder centres stay in game world space (double) and are translated into audio space via SetOccluderOrigin, which the game reports as the player moves, so occluders never need re-sending.
- Tunables: blocked occlusion level, radius scale (bounding spheres are larger than what they bound), and LoS recompute interval.
- DescribeEmitterOcclusion() reports the listener/emitter positions and the responsible occluder, to tell real blockage from mismatched spaces.
- Track whether a game object ever received a real position so origin-bound emitters (UI, music) are skipped, and add IsUsableWorldPosition() so the finite spawn sentinel can't poison geometry math.
- Slower default fade rate (0.5) so sounds fade rather than switch.
- Add test_occluder_sphere_exposure.py.
…ject

* Occlusion had two drivers: the game pushing a blockage value per emitter, and the engine computing blockage itself from occluder spheres the game registers.
* The API also moves off AudManager into its own Blue concept - audio2.GetOcclusion(), wrapped by python/audio2/occlusion.py - which is a view onto the manager's subsystem, not a second instance.
* Gone from the manager:
SetEmitterLineOfSightBlockage, SetObstructionOcclusion, ClearObstructionOcclusion, GetEmitterOcclusion, and the obstructionOcclusion* properties.
* Added diagnostic api's for tests and QA tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants