summaryrefslogtreecommitdiff
path: root/doc/classes/Viewport.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Viewport.xml')
-rw-r--r--doc/classes/Viewport.xml101
1 files changed, 72 insertions, 29 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index e79cf0d233..6f4720491d 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Viewport" inherits="Node" version="4.0">
+<class name="Viewport" inherits="Node" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- Creates a sub-view into the screen.
+ Base class for viewports.
</brief_description>
<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 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.
</description>
<tutorials>
- <link title="Using Viewports">https://docs.godotengine.org/en/latest/tutorials/rendering/viewports.html</link>
- <link title="Viewport and canvas transforms">https://docs.godotengine.org/en/latest/tutorials/2d/2d_transforms.html</link>
+ <link title="Using Viewports">$DOCS_URL/tutorials/rendering/viewports.html</link>
+ <link title="Viewport and canvas transforms">$DOCS_URL/tutorials/2d/2d_transforms.html</link>
<link title="GUI in 3D Demo">https://godotengine.org/asset-library/asset/127</link>
<link title="3D in 2D Demo">https://godotengine.org/asset-library/asset/128</link>
<link title="2D in 3D Demo">https://godotengine.org/asset-library/asset/129</link>
@@ -25,13 +24,13 @@
<method name="find_world_2d" qualifiers="const">
<return type="World2D" />
<description>
- Returns the 2D world of the viewport.
+ Returns the first valid [World2D] for this viewport, searching the [member world_2d] property of itself and any Viewport ancestor.
</description>
</method>
<method name="find_world_3d" qualifiers="const">
<return type="World3D" />
<description>
- Returns the 3D world of the viewport, or if none the world of the parent viewport.
+ Returns the first valid [World3D] for this viewport, searching the [member world_3d] property of itself and any Viewport ancestor.
</description>
</method>
<method name="get_camera_2d" qualifiers="const">
@@ -55,7 +54,7 @@
<method name="get_mouse_position" qualifiers="const">
<return type="Vector2" />
<description>
- Returns the mouse position relative to the viewport.
+ Returns the mouse's position in this [Viewport] using the coordinate system of this [Viewport].
</description>
</method>
<method name="get_render_info">
@@ -107,15 +106,28 @@
Returns the drag data from the GUI, that was previously returned by [method Control._get_drag_data].
</description>
</method>
+ <method name="gui_get_focus_owner">
+ <return type="Control" />
+ <description>
+ Returns the [Control] having the focus within this viewport. If no [Control] has the focus, returns null.
+ </description>
+ </method>
+ <method name="gui_is_drag_successful" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if the drag operation is successful.
+ </description>
+ </method>
<method name="gui_is_dragging" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if the viewport is currently performing a drag operation.
</description>
</method>
- <method name="is_embedding_subwindows" qualifiers="const">
- <return type="bool" />
+ <method name="gui_release_focus">
+ <return type="void" />
<description>
+ Removes the focus from the currently focused [Control] within this viewport. If no [Control] has the focus, does nothing.
</description>
</method>
<method name="is_input_handled" qualifiers="const">
@@ -160,9 +172,9 @@
</method>
<method name="warp_mouse">
<return type="void" />
- <argument index="0" name="to_position" type="Vector2" />
+ <argument index="0" name="position" type="Vector2" />
<description>
- Warps the mouse to a position relative to the viewport.
+ Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport].
</description>
</method>
</methods>
@@ -188,23 +200,35 @@
<member name="disable_3d" type="bool" setter="set_disable_3d" getter="is_3d_disabled" default="false">
Disable 3D rendering (but keep 2D rendering).
</member>
+ <member name="fsr_mipmap_bias" type="float" setter="set_fsr_mipmap_bias" getter="get_fsr_mipmap_bias" default="0.0">
+ 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.
+ </member>
+ <member name="fsr_sharpness" type="float" setter="set_fsr_sharpness" getter="get_fsr_sharpness" default="0.2">
+ 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.
+ </member>
<member name="global_canvas_transform" type="Transform2D" setter="set_global_canvas_transform" getter="get_global_canvas_transform">
The global canvas transform of the viewport. The canvas transform is relative to this.
</member>
<member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled" default="false">
If [code]true[/code], the viewport will not receive input events.
</member>
- <member name="gui_embed_subwindows" type="bool" setter="set_embed_subwindows_hint" getter="get_embed_subwindows_hint" default="false">
+ <member name="gui_embed_subwindows" type="bool" setter="set_embedding_subwindows" getter="is_embedding_subwindows" default="false">
+ If [code]true[/code], sub-windows (popups and dialogs) will be embedded inside application window as control-like nodes. If [code]false[/code], they will appear as separate windows handled by the operating system.
</member>
<member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled" default="true">
If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly.
</member>
<member name="handle_input_locally" type="bool" setter="set_handle_input_locally" getter="is_handling_input_locally" default="true">
</member>
- <member name="lod_threshold" type="float" setter="set_lod_threshold" getter="get_lod_threshold" default="1.0">
+ <member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0">
+ 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).
</member>
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0">
- 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 [member scale_3d] for supersampling, which provides higher quality but is much more expensive.
+ 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.
</member>
<member name="own_world_3d" type="bool" setter="set_use_own_world_3d" getter="is_using_own_world_3d" default="false">
If [code]true[/code], the viewport will use the [World3D] defined in [member world_3d].
@@ -212,9 +236,14 @@
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
</member>
- <member name="scale_3d" type="float" setter="set_scale_3d" getter="get_scale_3d" default="1.0">
- Scales the 3D render buffer based on the viewport size and displays the result with linear filtering. 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] can be used to improve 3D rendering quality at a high performance cost (supersampling). See also [member msaa] for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
- To control this property on the root viewport, set the [member ProjectSettings.rendering/3d/viewport/scale] project setting.
+ <member name="scaling_3d_mode" type="int" setter="set_scaling_3d_mode" getter="get_scaling_3d_mode" enum="Viewport.Scaling3DMode" default="0">
+ 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.
+ </member>
+ <member name="scaling_3d_scale" type="float" setter="set_scaling_3d_scale" getter="get_scaling_3d_scale" default="1.0">
+ 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.
</member>
<member name="screen_space_aa" type="int" setter="set_screen_space_aa" getter="get_screen_space_aa" enum="Viewport.ScreenSpaceAA" default="0">
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.
@@ -251,6 +280,8 @@
<member name="use_debanding" type="bool" setter="set_use_debanding" getter="is_using_debanding" default="false">
</member>
<member name="use_occlusion_culling" type="bool" setter="set_use_occlusion_culling" getter="is_using_occlusion_culling" default="false">
+ 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.
</member>
<member name="use_xr" type="bool" setter="set_use_xr" getter="is_using_xr" default="false">
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.
@@ -300,6 +331,15 @@
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_MAX" value="7" enum="ShadowAtlasQuadrantSubdiv">
Represents the size of the [enum ShadowAtlasQuadrantSubdiv] enum.
</constant>
+ <constant name="SCALING_3D_MODE_BILINEAR" value="0" enum="Scaling3DMode">
+ Use bilinear scaling for the viewport's 3D buffer. 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.
+ </constant>
+ <constant name="SCALING_3D_MODE_FSR" value="1" enum="Scaling3DMode">
+ Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. 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 downsampling will be used instead. A value of [code]1.0[/code] disables scaling.
+ </constant>
+ <constant name="SCALING_3D_MODE_MAX" value="2" enum="Scaling3DMode">
+ Represents the size of the [enum Scaling3DMode] enum.
+ </constant>
<constant name="MSAA_DISABLED" value="0" enum="MSAA">
Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.
</constant>
@@ -378,29 +418,32 @@
<constant name="DEBUG_DRAW_SSAO" value="12" enum="DebugDraw">
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].
</constant>
- <constant name="DEBUG_DRAW_PSSM_SPLITS" value="13" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_SSIL" value="13" enum="DebugDraw">
+ 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].
+ </constant>
+ <constant name="DEBUG_DRAW_PSSM_SPLITS" value="14" enum="DebugDraw">
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.
</constant>
- <constant name="DEBUG_DRAW_DECAL_ATLAS" value="14" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_DECAL_ATLAS" value="15" enum="DebugDraw">
Draws the decal atlas used by [Decal]s and light projector textures in the upper left quadrant of the [Viewport].
</constant>
- <constant name="DEBUG_DRAW_SDFGI" value="15" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_SDFGI" value="16" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_SDFGI_PROBES" value="16" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_SDFGI_PROBES" value="17" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_GI_BUFFER" value="17" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_GI_BUFFER" value="18" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_DISABLE_LOD" value="18" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_DISABLE_LOD" value="19" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_CLUSTER_OMNI_LIGHTS" value="19" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_CLUSTER_OMNI_LIGHTS" value="20" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_CLUSTER_SPOT_LIGHTS" value="20" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_CLUSTER_SPOT_LIGHTS" value="21" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_CLUSTER_DECALS" value="21" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_CLUSTER_DECALS" value="22" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_CLUSTER_REFLECTION_PROBES" value="22" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_CLUSTER_REFLECTION_PROBES" value="23" enum="DebugDraw">
</constant>
- <constant name="DEBUG_DRAW_OCCLUDERS" value="23" enum="DebugDraw">
+ <constant name="DEBUG_DRAW_OCCLUDERS" value="24" enum="DebugDraw">
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST" value="0" enum="DefaultCanvasItemTextureFilter">
The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized.