Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Viewport

Inherits: Node < Object

Inherited By: SubViewport, Window

Abstract base class for viewports. Encapsulates drawing and interaction with a game world.

Description

A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera3D 3D nodes will render on it too.

Optionally, a viewport can have its own 2D or 3D world, so it doesn't share what it draws with other viewports.

Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.

Also, viewports can be assigned to different screens in case the devices have multiple screens.

Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.

Tutorials

Properties

bool

audio_listener_enable_2d

false

bool

audio_listener_enable_3d

false

int

canvas_cull_mask

4294967295

DefaultCanvasItemTextureFilter

canvas_item_default_texture_filter

1

DefaultCanvasItemTextureRepeat

canvas_item_default_texture_repeat

0

Transform2D

canvas_transform

DebugDraw

debug_draw

0

bool

disable_3d

false

float

fsr_sharpness

0.2

Transform2D

global_canvas_transform

bool

gui_disable_input

false

bool

gui_embed_subwindows

false

bool

gui_snap_controls_to_pixels

true

bool

handle_input_locally

true

float

mesh_lod_threshold

1.0

MSAA

msaa_2d

0

MSAA

msaa_3d

0

bool

own_world_3d

false

bool

physics_object_picking

false

bool

physics_object_picking_sort

false

bool

positional_shadow_atlas_16_bits

true

PositionalShadowAtlasQuadrantSubdiv

positional_shadow_atlas_quad_0

2

PositionalShadowAtlasQuadrantSubdiv

positional_shadow_atlas_quad_1

2

PositionalShadowAtlasQuadrantSubdiv

positional_shadow_atlas_quad_2

3

PositionalShadowAtlasQuadrantSubdiv

positional_shadow_atlas_quad_3

4

int

positional_shadow_atlas_size

2048

Scaling3DMode

scaling_3d_mode

0

float

scaling_3d_scale

1.0

ScreenSpaceAA

screen_space_aa

0