Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Viewport¶
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¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Methods¶
Signals¶
gui_focus_changed ( Control node )
Emitted when a Control node grabs keyboard focus.
size_changed ( )
Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
Enumerations¶
enum PositionalShadowAtlasQuadrantSubdiv:
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED = 0
This quadrant will not be used.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_1 = 1
This quadrant will only be used by one shadow map.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_4 = 2
This quadrant will be split in 4 and used by up to 4 shadow maps.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_16 = 3
This quadrant will be split 16 ways and used by up to 16 shadow maps.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_64 = 4
This quadrant will be split 64 ways and used by up to 64 shadow maps.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_256 = 5
This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the positional_shadow_atlas_size is very high, the shadows in this quadrant will be very low resolution.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_1024 = 6
This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the positional_shadow_atlas_size is very high, the shadows in this quadrant will be very low resolution.
PositionalShadowAtlasQuadrantSubdiv SHADOW_ATLAS_QUADRANT_SUBDIV_MAX = 7
Represents the size of the PositionalShadowAtlasQuadrantSubdiv enum.
enum Scaling3DMode:
Scaling3DMode SCALING_3D_MODE_BILINEAR = 0
Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0
will result in undersampling while values greater than 1.0
will result in supersampling. A value of 1.0
disables scaling.
Scaling3DMode SCALING_3D_MODE_FSR = 1
Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0
will be result in the viewport being upscaled using FSR. Values greater than 1.0
are not supported and bilinear downsampling will be used instead. A value of 1.0
disables scaling.
Scaling3DMode SCALING_3D_MODE_FSR2 = 2
Use AMD FidelityFX Super Resolution 2.2 upscaling for the viewport's 3D buffer. The amount of scaling can be set using scaling_3d_scale. Values less than 1.0
will be result in the viewport being upscaled using FSR2. Values greater than 1.0
are not supported and bilinear downsampling will be used instead. A value of 1.0
will use FSR2 at native resolution as a TAA solution.
Scaling3DMode SCALING_3D_MODE_MAX = 3
Represents the size of the Scaling3DMode enum.
enum MSAA:
MSAA MSAA_DISABLED = 0
Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.
MSAA MSAA_2X = 1
Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better.
MSAA MSAA_4X = 2
Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality.
MSAA MSAA_8X = 3
Use 8× Multisample Antialiasing. This has a very high performance cost. The difference between 4× and 8× MSAA may not always be visible in real gameplay conditions. Likely unsupported on low-end and older hardware.
MSAA MSAA_MAX = 4
Represents the size of the MSAA enum.
enum ScreenSpaceAA: