Is there a way to set the bounding rectangle of Node2D without using SubViewport?

Godot Version



I’m working on a reboot of a classic game which has a 4-way scrolling TileMap and I’m probably going to implement a background with parallax scrolling. In the default configuration in landscape mode it will have a side panel displaying score-like information; the panel will fill the height of the screen and its width will be 1/4 of the height. The game viewport will either fill the remainder of the screen or be clipped to a square, and may be slightly clipped vertically as well as horizontally, and its content has scale and translation transforms.

The obvious way to do this would be to use SubViewport and Camera2D, but I think it’s inefficient, because of rendering the TileMap etc to a large texture then rendering the texture to the main buffer instead of rendering the TileMap directly to the main buffer. I’m new to Godot, and more used to lower level game engines or “raw” OpenGL, where I can use glViewport and have more control over what camera/transformation is used for different parts of the screen, making indirect rendering unnecessary.

Should I stop worrying about the inefficiency of SubViewport because it’s negligible in practice? Or is there some other way of controlling the bounds of a Node2D that I’ve missed. Control nodes have a size property, but I can’t see a way of using a Control as a clipping container for a Node2D except SubViewportContainer. I can’t seem to define my own Container type for this, because fit_child_in_rect expects the child to be a Control, not a Node2D.