Skip to content

Viewport background transparency not working with environment sky in Compatibility renderer #72602

@lostminds

Description

@lostminds

Godot version

4.0.beta17

System information

macOS 13.2

Issue description

The Transparent BG setting on SubViewport makes the background portions transparent in the resulting ViewportTexture as you can see in this example using the Mobile renderer:

Screenshot 2023-02-02 at 14 50 57

However, if you switch to the Compatibility renderer it no longer makes the background transparent.

Screenshot 2023-02-02 at 14 52 24

The issue here seems to be related to the environment, and more specifically background sky rendering. While the background sky is ignored in the Mobile and Forward+ renderer, it seems the background sky is rendered as opaque in the Compatibility renderer. If you remove the WorldEnvironment in the SubViewport (or just remove the sky background) you can see that the viewport correctly renders the background transparent again.

Screenshot 2023-02-02 at 14 53 23

While I don't think it's related to the background transparency I'm also getting this error each time I run this minimum reproduction project, regardless or renderer:

E 0:00:00:0786   setup_local_to_scene: Condition "proxy.is_valid()" is true.
  <C++ Source>   scene/main/viewport.cpp:88 @ setup_local_to_scene()

Steps to reproduce

  • Set up a SubViewport with a camera, a default WorldEnvironment, some mesh (to render something)
  • Turn on Transparent BG on the SubViewport to make the background transparent
  • Set up a UI scene with a TextureRect to render the ViewportTexture of the SubViewport
  • Observe that the background is transparent on Mobile and Forward+ rendrerers
  • Switch to Compatibility renderer
  • Observe that the default sky is now rendered in the viewport background, and the background is not transparent.

Minimal reproduction project

viewport_background_test.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions