Viewports VS. Subviewports

The title explains it all. If it matters, my goal is to map what the viewports sees onto a Sprite3D or Mesh3D.

You may be able to use the viewport’s texture directly.

$Sprite3D.texture = get_viewport().get_texture()

The difference is stated shortly in the docs, subviewports are like little extra canvases you can draw to, then present on the main viewport.

Note: SubViewport is a Viewport that isn’t a Window, i.e. it doesn’t draw anything by itself. To display anything, SubViewport must have a non-zero size and be either put inside a SubViewportContainer or assigned to a ViewportTexture.

— docs.godotengine.org

1 Like

What does it mean when it says the SubViewport must be assigned to a ViewportTexture?

The SubViewport only draws when it’s being used, the only way to use a sub viewport is as a texture, either through a SubViewportContainer or a ViewportTexture.

This might come up to bite if you intend to only draw to a texture and not render it, maybe to then read data after drawing.

1 Like