AudioListener3D does not override Camera's listener when Camera is placed inside a SubViewport

Godot Version

v4.4.1.stable-mono.official

Question

I have a Camera node placed under a SubViewport (the rest of the game (player, world, etc.) is not under that SubViewport). The SubViewport has a shader and the Camera renders the scene to it. When I add an AudioListener3D to my Player character and start the game, the Player’s listener does not override the Camera’s listener — the camera/listener inside the SubViewport appears to remain active. I expect the Player’s AudioListener3D to be the active listener and control 3D audio.

My running Scene is looking something like that:

Root
├─ SubViewport
│  └─ Camera Rig
│     └─ Camera3D (current)
├─ 3d World
│  ├─ Player
│  │  └─ AudioListener3D
│  └─ Audio sources, environment, etc.
└─ UI & SubViewport Texture Render

What I did:

  1. Put the Camera under a SubViewport. The SubViewport is used because I render some special post-process shader on that viewport.
  2. Left the actual game world (including the Player and AudioListener3D) in the main scene root — not inside the SubViewport.
  3. Added an AudioListener3D to the Player.
  4. Run the scene.

Expected behavior
AudioListener3D attached to the Player should become the active 3D audio listener and thus determine 3D audio spatialization (i.e., audio should be heard relative to the Player).

Actual behavior
The Camera/listener inside the SubViewport remains the active listener (or audio behaves as if the camera listener is active). The Player’s AudioListener3D does not override it.

What I’ve tried

  • Making sure the Player’s AudioListener3D is enabled and present.
  • Moving Player’s listener under the SubViewport — then it works as expected (but that breaks my scene organization).
  • Searching for viewport audio isolation settings (didn’t find a clear setting).

Questions

  1. Is this expected behavior with SubViewport (i.e., do sub-viewports isolate audio listeners or make their camera/listener take precedence)?
  2. Is there a documented way to make a single AudioListener3D (on the Player) override any listener coming from a Camera that lives inside a SubViewport?
  3. Are there recommended workarounds (making the listener current at runtime, moving nodes between viewports, or other hacks)?
  4. Is this actually a bug?

Hi all,

I’ve run into this exact same problem. Is this a known issue?

Have you been able to solve the issue @NantoDev ?

Any help from anyone would be greatly appreciated.

I fixed this by moving my entire 3D world under the SubViewport.

My guess:

A SubViewport can act as its own audio listener context. When Enable 3D is checked on the SubViewport, it will use the active Camera3D or an AudioListener3D inside that SubViewport to drive 3D audio.

Because my AudioListener3D was outside the SubViewport, it could not override the listener coming from the camera inside the SubViewport. Once the 3D world (including the player and its AudioListener3D) was placed under the same SubViewport, the correct listener was used and audio behaved as expected.

Hope this helps anyone running into the same issue.

2 Likes

Thanks for the response man!

I had something similar happening. Due to our object pooler setup, our missiles weren’t being spawned in the world under the subviewport, so the audio source wasn’t technically under the viewport, despite the fact that the missile was visible there during gameplay.

We changed the way spawning and pooling worked, to bring them under the subviewport, and that fixed this issue.

1 Like