Creates a sub-view into the screen. 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 they don't share what they draw with other viewports. If a viewport is a child of a [SubViewportContainer], it will automatically take up its size, otherwise it must be set manually. 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. $DOCS_URL/tutorials/rendering/viewports.html $DOCS_URL/tutorials/2d/2d_transforms.html https://godotengine.org/asset-library/asset/127 https://godotengine.org/asset-library/asset/128 https://godotengine.org/asset-library/asset/129 https://godotengine.org/asset-library/asset/130 https://godotengine.org/asset-library/asset/541 https://godotengine.org/asset-library/asset/586 Returns the first valid [World2D] for this viewport, searching the [member world_2d] property of itself and any Viewport ancestor. Returns the first valid [World3D] for this viewport, searching the [member world_3d] property of itself and any Viewport ancestor. Returns the currently active 2D camera. Returns null if there are no active cameras. Returns the currently active 3D camera. Returns the total transform of the viewport. Returns the mouse's positon in this [Viewport] using the coordinate system of this [Viewport]. Returns the [enum ShadowAtlasQuadrantSubdiv] of the specified quadrant. Returns the viewport's texture. [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_image] to flip it back, for example: [codeblocks] [gdscript] var img = get_viewport().get_texture().get_image() img.flip_y() [/gdscript] [csharp] Image img = GetViewport().GetTexture().GetImage(); img.FlipY(); [/csharp] [/codeblocks] Returns the viewport's RID from the [RenderingServer]. Returns the visible rectangle in global screen coordinates. Returns the drag data from the GUI, that was previously returned by [method Control._get_drag_data]. Returns the [Control] having the focus within this viewport. If no [Control] has the focus, returns null. Returns [code]true[/code] if the drag operation is successful. Returns [code]true[/code] if the viewport is currently performing a drag operation. Removes the focus from the currently focussed [Control] within this viewport. If no [Control] has the focus, does nothing. Returns [code]true[/code] if the viewport is currently embedding windows. Stops the input from propagating further down the [SceneTree]. Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible. Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport]. If [code]true[/code], the viewport will process 2D audio streams. If [code]true[/code], the viewport will process 3D audio streams. Sets the default filter mode used by [CanvasItem]s in this Viewport. See [enum DefaultCanvasItemTextureFilter] for options. Sets the default repeat mode used by [CanvasItem]s in this Viewport. See [enum DefaultCanvasItemTextureRepeat] for options. The canvas transform of the viewport, useful for changing the on-screen positions of all child [CanvasItem]s. This is relative to the global canvas transform of the viewport. The overlay mode for test rendered geometry in debug purposes. Disable 3D rendering (but keep 2D rendering). Affects the final texture sharpness by reading from a lower or higher mipmap when using FSR. Mipmap bias does nothing when FSR is not being used. Negative values make textures sharper, while positive values make textures blurrier. This value is used to adjust the mipmap bias calculated internally which is based on the selected quality. The formula for this is [code]-log2(1.0 / scale) + mipmap_bias[/code]. This updates the rendering server's mipmap bias when called To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_mipmap_bias] project setting. Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference. To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/fsr_sharpness] project setting. The global canvas transform of the viewport. The canvas transform is relative to this. If [code]true[/code], the viewport will not receive input events. If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly. The automatic LOD bias to use for meshes rendered within the [Viewport] (this is analogous to [member ReflectionProbe.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail. To control this property on the root viewport, set the [member ProjectSettings.rendering/mesh_lod/lod_change/threshold_pixels] project setting. [b]Note:[/b] [member mesh_lod_threshold] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD). The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also bilinear scaling 3d [member scaling_3d_mode] for supersampling, which provides higher quality but is much more expensive. If [code]true[/code], the viewport will use the [World3D] defined in [member world_3d]. If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible. To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/mode] project setting. Scales the 3D render buffer based on the viewport size uses an image filter specified in [member ProjectSettings.rendering/scaling_3d/mode] to scale the output image to the full viewport size. Values lower than [code]1.0[/code] can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than [code]1.0[/code] are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member ProjectSettings.rendering/anti_aliasing/quality/msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons. When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale. To control this property on the root viewport, set the [member ProjectSettings.rendering/scaling_3d/scale] project setting. Sets the screen-space antialiasing method used. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry. The subdivision amount of the first quadrant on the shadow atlas. The subdivision amount of the second quadrant on the shadow atlas. The subdivision amount of the third quadrant on the shadow atlas. The subdivision amount of the fourth quadrant on the shadow atlas. The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2. [b]Note:[/b] If this is set to 0, shadows won't be visible. If [code]true[/code], the viewport should render its background as transparent. If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport, [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling] must be set to [code]true[/code] instead. [b]Note:[/b] Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it, and think whether your scene can actually benefit from occlusion culling. Large, open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling. If [code]true[/code], the viewport will use the primary XR interface to render XR output. When applicable this can result in a stereoscopic image and the resulting render being output to a headset. The custom [World2D] which can be used as 2D environment source. The custom [World3D] which can be used as 3D environment source. Emitted when a Control node grabs keyboard focus. Emitted when the size of the viewport is changed, whether by resizing of window, or some other means. This quadrant will not be used. This quadrant will only be used by one shadow map. This quadrant will be split in 4 and used by up to 4 shadow maps. This quadrant will be split 16 ways and used by up to 16 shadow maps. This quadrant will be split 64 ways and used by up to 64 shadow maps. This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the [member shadow_atlas_size] is very high, the shadows in this quadrant will be very low resolution. This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the [member shadow_atlas_size] is very high, the shadows in this quadrant will be very low resolution. Represents the size of the [enum ShadowAtlasQuadrantSubdiv] enum. Enables bilinear scaling on 3D viewports. The amount of scaling can be set using [member scaling_3d_scale]. Values less then [code]1.0[/code] will result in undersampling while values greater than [code]1.0[/code] will result in supersampling. A value of [code]1.0[/code] disables scaling. Enables FSR upscaling on 3D viewports. The amount of scaling can be set using [member scaling_3d_scale]. Values less then [code]1.0[/code] will be result in the viewport being upscaled using FSR. Values greater than [code]1.0[/code] are not supported and bilinear supersampling will be used instead. A value of [code]1.0[/code] disables scaling. Represents the size of the [enum Scaling3DMode] enum. Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting. Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better. Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality. 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. Represents the size of the [enum MSAA] enum. Do not perform any antialiasing in the full screen post-process. Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. Represents the size of the [enum ScreenSpaceAA] enum. Amount of objects in frame. Amount of vertices in frame. Amount of draw calls in frame. Represents the size of the [enum RenderInfo] enum. Objects are displayed normally. Objects are displayed without light information. Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw means you are wasting performance on drawing pixels that are being hidden behind others. Objects are displayed in wireframe style. Objects are displayed with only the albedo value from [VoxelGI]s. Objects are displayed with only the lighting value from [VoxelGI]s. Objects are displayed with only the emission color from [VoxelGI]s. Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport]. Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left quadrant of the [Viewport]. Draws the screen-space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment]. Draws the screen-space indirect lighting texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssil_enabled] set in your [WorldEnvironment]. Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order, they will be colored red, green, blue, and yellow. Draws the decal atlas used by [Decal]s and light projector textures in the upper left quadrant of the [Viewport]. The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized. The texture filter blends between the nearest 4 pixels. Use this when you want to avoid a pixelated style, but do not want mipmaps. The texture filter reads from the nearest pixel in the nearest mipmap. The fastest way to read from textures with mipmaps. The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps. Max value for [enum DefaultCanvasItemTextureFilter] enum. Disables textures repeating. Instead, when reading UVs outside the 0-1 range, the value will be clamped to the edge of the texture, resulting in a stretched out look at the borders of the texture. Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of the linear filtering modes, this can result in artifacts at the edges of a texture when the sampler filters across the edges of the texture. Flip the texture when repeating so that the edge lines up instead of abruptly changing. Max value for [enum DefaultCanvasItemTextureRepeat] enum.