#What's with SubViewports in 2D vs in 3D?

4 messages · Page 1 of 1 (latest)

eternal haven
#

I made a test scene in 3D to learn viewports. I did it in 3D because I started following a tutorial, and figured it would be similar in 2D.

When I tried using SubViewports in 2D they seemed to regress massively in functionality. In 3D, they would capture the entire node tree, as long as the objects live on the right Culling layer.

But in 2D, it seems the SubViewport only captures it's direct children?
Not to mention it stops you from transforming viewport children, which it doesnt seem to in 3D.

I couldn't find much information online as to why 2D and 3D seem to behave differently, and if there are any ways around the seeming limitations of 2D viewports.

#

the 2 images are basic viewport + camera setups in both 2D and 3D:

  • In 3D, the camera captures the card and the blocks behind it.
  • In 2D, the camera only captures other sibling children of the subviewport
alpine quarry
#

I ran into this issue today and I found this thread while searching, so I thought I'd share the solution: it's tied to the relevant World2D/World3D variable.

The weirdness you've discovered isn't a limitation, it's just the default behavior. For some reason SubViewports default to having their own World2D, but default to inheriting their parent viewport's World3D.