class_viewport.rst 104 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Viewport.xml.
  6. .. _class_Viewport:
  7. Viewport
  8. ========
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`SubViewport<class_SubViewport>`, :ref:`Window<class_Window>`
  11. Base class for viewports.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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.
  16. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  17. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  18. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  19. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  20. .. rst-class:: classref-introduction-group
  21. Tutorials
  22. ---------
  23. - :doc:`Using Viewports <../tutorials/rendering/viewports>`
  24. - :doc:`Viewport and canvas transforms <../tutorials/2d/2d_transforms>`
  25. - `GUI in 3D Demo <https://godotengine.org/asset-library/asset/127>`__
  26. - `3D in 2D Demo <https://godotengine.org/asset-library/asset/128>`__
  27. - `2D in 3D Demo <https://godotengine.org/asset-library/asset/129>`__
  28. - `Screen Capture Demo <https://godotengine.org/asset-library/asset/130>`__
  29. - `Dynamic Split Screen Demo <https://godotengine.org/asset-library/asset/541>`__
  30. - `3D Viewport Scaling Demo <https://godotengine.org/asset-library/asset/586>`__
  31. .. rst-class:: classref-reftable-group
  32. Properties
  33. ----------
  34. .. table::
  35. :widths: auto
  36. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  37. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_2d<class_Viewport_property_audio_listener_enable_2d>` | ``false`` |
  38. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  39. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_3d<class_Viewport_property_audio_listener_enable_3d>` | ``false`` |
  40. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  41. | :ref:`int<class_int>` | :ref:`canvas_cull_mask<class_Viewport_property_canvas_cull_mask>` | ``4294967295`` |
  42. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  43. | :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` | :ref:`canvas_item_default_texture_filter<class_Viewport_property_canvas_item_default_texture_filter>` | ``1`` |
  44. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  45. | :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` | :ref:`canvas_item_default_texture_repeat<class_Viewport_property_canvas_item_default_texture_repeat>` | ``0`` |
  46. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  47. | :ref:`Transform2D<class_Transform2D>` | :ref:`canvas_transform<class_Viewport_property_canvas_transform>` | |
  48. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  49. | :ref:`DebugDraw<enum_Viewport_DebugDraw>` | :ref:`debug_draw<class_Viewport_property_debug_draw>` | ``0`` |
  50. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  51. | :ref:`bool<class_bool>` | :ref:`disable_3d<class_Viewport_property_disable_3d>` | ``false`` |
  52. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  53. | :ref:`float<class_float>` | :ref:`fsr_sharpness<class_Viewport_property_fsr_sharpness>` | ``0.2`` |
  54. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  55. | :ref:`Transform2D<class_Transform2D>` | :ref:`global_canvas_transform<class_Viewport_property_global_canvas_transform>` | |
  56. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  57. | :ref:`bool<class_bool>` | :ref:`gui_disable_input<class_Viewport_property_gui_disable_input>` | ``false`` |
  58. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  59. | :ref:`bool<class_bool>` | :ref:`gui_embed_subwindows<class_Viewport_property_gui_embed_subwindows>` | ``false`` |
  60. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  61. | :ref:`bool<class_bool>` | :ref:`gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` | ``true`` |
  62. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  63. | :ref:`bool<class_bool>` | :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` | ``true`` |
  64. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  65. | :ref:`float<class_float>` | :ref:`mesh_lod_threshold<class_Viewport_property_mesh_lod_threshold>` | ``1.0`` |
  66. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  67. | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa_2d<class_Viewport_property_msaa_2d>` | ``0`` |
  68. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  69. | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa_3d<class_Viewport_property_msaa_3d>` | ``0`` |
  70. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  71. | :ref:`bool<class_bool>` | :ref:`own_world_3d<class_Viewport_property_own_world_3d>` | ``false`` |
  72. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  73. | :ref:`bool<class_bool>` | :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` | ``false`` |
  74. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  75. | :ref:`bool<class_bool>` | :ref:`positional_shadow_atlas_16_bits<class_Viewport_property_positional_shadow_atlas_16_bits>` | ``true`` |
  76. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  77. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_0<class_Viewport_property_positional_shadow_atlas_quad_0>` | ``2`` |
  78. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  79. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_1<class_Viewport_property_positional_shadow_atlas_quad_1>` | ``2`` |
  80. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  81. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_2<class_Viewport_property_positional_shadow_atlas_quad_2>` | ``3`` |
  82. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  83. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_3<class_Viewport_property_positional_shadow_atlas_quad_3>` | ``4`` |
  84. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  85. | :ref:`int<class_int>` | :ref:`positional_shadow_atlas_size<class_Viewport_property_positional_shadow_atlas_size>` | ``2048`` |
  86. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  87. | :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` | :ref:`scaling_3d_mode<class_Viewport_property_scaling_3d_mode>` | ``0`` |
  88. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  89. | :ref:`float<class_float>` | :ref:`scaling_3d_scale<class_Viewport_property_scaling_3d_scale>` | ``1.0`` |
  90. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  91. | :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` | :ref:`screen_space_aa<class_Viewport_property_screen_space_aa>` | ``0`` |
  92. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  93. | :ref:`SDFOversize<enum_Viewport_SDFOversize>` | :ref:`sdf_oversize<class_Viewport_property_sdf_oversize>` | ``1`` |
  94. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  95. | :ref:`SDFScale<enum_Viewport_SDFScale>` | :ref:`sdf_scale<class_Viewport_property_sdf_scale>` | ``1`` |
  96. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  97. | :ref:`bool<class_bool>` | :ref:`snap_2d_transforms_to_pixel<class_Viewport_property_snap_2d_transforms_to_pixel>` | ``false`` |
  98. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  99. | :ref:`bool<class_bool>` | :ref:`snap_2d_vertices_to_pixel<class_Viewport_property_snap_2d_vertices_to_pixel>` | ``false`` |
  100. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  101. | :ref:`float<class_float>` | :ref:`texture_mipmap_bias<class_Viewport_property_texture_mipmap_bias>` | ``0.0`` |
  102. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  103. | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
  104. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  105. | :ref:`bool<class_bool>` | :ref:`use_debanding<class_Viewport_property_use_debanding>` | ``false`` |
  106. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  107. | :ref:`bool<class_bool>` | :ref:`use_occlusion_culling<class_Viewport_property_use_occlusion_culling>` | ``false`` |
  108. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  109. | :ref:`bool<class_bool>` | :ref:`use_taa<class_Viewport_property_use_taa>` | ``false`` |
  110. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  111. | :ref:`bool<class_bool>` | :ref:`use_xr<class_Viewport_property_use_xr>` | ``false`` |
  112. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  113. | :ref:`VRSMode<enum_Viewport_VRSMode>` | :ref:`vrs_mode<class_Viewport_property_vrs_mode>` | ``0`` |
  114. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  115. | :ref:`Texture2D<class_Texture2D>` | :ref:`vrs_texture<class_Viewport_property_vrs_texture>` | |
  116. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  117. | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
  118. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  119. | :ref:`World3D<class_World3D>` | :ref:`world_3d<class_Viewport_property_world_3d>` | |
  120. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  121. .. rst-class:: classref-reftable-group
  122. Methods
  123. -------
  124. .. table::
  125. :widths: auto
  126. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** |const| |
  128. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`World3D<class_World3D>` | :ref:`find_world_3d<class_Viewport_method_find_world_3d>` **(** **)** |const| |
  130. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`Camera2D<class_Camera2D>` | :ref:`get_camera_2d<class_Viewport_method_get_camera_2d>` **(** **)** |const| |
  132. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`Camera3D<class_Camera3D>` | :ref:`get_camera_3d<class_Viewport_method_get_camera_3d>` **(** **)** |const| |
  134. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`bool<class_bool>` | :ref:`get_canvas_cull_mask_bit<class_Viewport_method_get_canvas_cull_mask_bit>` **(** :ref:`int<class_int>` layer **)** |const| |
  136. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** |const| |
  138. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** |const| |
  140. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`get_positional_shadow_atlas_quadrant_subdiv<class_Viewport_method_get_positional_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant **)** |const| |
  142. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_method_get_render_info>` **(** :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` type, :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)** |
  144. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_screen_transform<class_Viewport_method_get_screen_transform>` **(** **)** |const| |
  146. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** |const| |
  148. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** |const| |
  150. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** |const| |
  152. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** |const| |
  154. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :ref:`Control<class_Control>` | :ref:`gui_get_focus_owner<class_Viewport_method_gui_get_focus_owner>` **(** **)** |
  156. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :ref:`bool<class_bool>` | :ref:`gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>` **(** **)** |const| |
  158. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** |const| |
  160. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | void | :ref:`gui_release_focus<class_Viewport_method_gui_release_focus>` **(** **)** |
  162. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** |const| |
  164. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | void | :ref:`push_input<class_Viewport_method_push_input>` **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)** |
  166. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | void | :ref:`push_text_input<class_Viewport_method_push_text_input>` **(** :ref:`String<class_String>` text **)** |
  168. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`push_unhandled_input<class_Viewport_method_push_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)** |
  170. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`set_canvas_cull_mask_bit<class_Viewport_method_set_canvas_cull_mask_bit>` **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enable **)** |
  172. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
  174. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | void | :ref:`set_positional_shadow_atlas_quadrant_subdiv<class_Viewport_method_set_positional_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)** |
  176. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  178. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. .. rst-class:: classref-section-separator
  180. ----
  181. .. rst-class:: classref-descriptions-group
  182. Signals
  183. -------
  184. .. _class_Viewport_signal_gui_focus_changed:
  185. .. rst-class:: classref-signal
  186. **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
  187. Emitted when a Control node grabs keyboard focus.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_Viewport_signal_size_changed:
  191. .. rst-class:: classref-signal
  192. **size_changed** **(** **)**
  193. Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
  194. .. rst-class:: classref-section-separator
  195. ----
  196. .. rst-class:: classref-descriptions-group
  197. Enumerations
  198. ------------
  199. .. _enum_Viewport_PositionalShadowAtlasQuadrantSubdiv:
  200. .. rst-class:: classref-enumeration
  201. enum **PositionalShadowAtlasQuadrantSubdiv**:
  202. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
  203. .. rst-class:: classref-enumeration-constant
  204. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = ``0``
  205. This quadrant will not be used.
  206. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
  207. .. rst-class:: classref-enumeration-constant
  208. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = ``1``
  209. This quadrant will only be used by one shadow map.
  210. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = ``2``
  213. This quadrant will be split in 4 and used by up to 4 shadow maps.
  214. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = ``3``
  217. This quadrant will be split 16 ways and used by up to 16 shadow maps.
  218. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = ``4``
  221. This quadrant will be split 64 ways and used by up to 64 shadow maps.
  222. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = ``5``
  225. This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the :ref:`positional_shadow_atlas_size<class_Viewport_property_positional_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
  226. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = ``6``
  229. This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the :ref:`positional_shadow_atlas_size<class_Viewport_property_positional_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
  230. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = ``7``
  233. Represents the size of the :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` enum.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _enum_Viewport_Scaling3DMode:
  237. .. rst-class:: classref-enumeration
  238. enum **Scaling3DMode**:
  239. .. _class_Viewport_constant_SCALING_3D_MODE_BILINEAR:
  240. .. rst-class:: classref-enumeration-constant
  241. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_BILINEAR** = ``0``
  242. Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using :ref:`scaling_3d_scale<class_Viewport_property_scaling_3d_scale>`. Values less then ``1.0`` will result in undersampling while values greater than ``1.0`` will result in supersampling. A value of ``1.0`` disables scaling.
  243. .. _class_Viewport_constant_SCALING_3D_MODE_FSR:
  244. .. rst-class:: classref-enumeration-constant
  245. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_FSR** = ``1``
  246. Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of scaling can be set using :ref:`scaling_3d_scale<class_Viewport_property_scaling_3d_scale>`. Values less then ``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.
  247. .. _class_Viewport_constant_SCALING_3D_MODE_MAX:
  248. .. rst-class:: classref-enumeration-constant
  249. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_MAX** = ``2``
  250. Represents the size of the :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` enum.
  251. .. rst-class:: classref-item-separator
  252. ----
  253. .. _enum_Viewport_MSAA:
  254. .. rst-class:: classref-enumeration
  255. enum **MSAA**:
  256. .. _class_Viewport_constant_MSAA_DISABLED:
  257. .. rst-class:: classref-enumeration-constant
  258. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_DISABLED** = ``0``
  259. Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.
  260. .. _class_Viewport_constant_MSAA_2X:
  261. .. rst-class:: classref-enumeration-constant
  262. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_2X** = ``1``
  263. Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better.
  264. .. _class_Viewport_constant_MSAA_4X:
  265. .. rst-class:: classref-enumeration-constant
  266. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_4X** = ``2``
  267. Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality.
  268. .. _class_Viewport_constant_MSAA_8X:
  269. .. rst-class:: classref-enumeration-constant
  270. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_8X** = ``3``
  271. 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.
  272. .. _class_Viewport_constant_MSAA_MAX:
  273. .. rst-class:: classref-enumeration-constant
  274. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_MAX** = ``4``
  275. Represents the size of the :ref:`MSAA<enum_Viewport_MSAA>` enum.
  276. .. rst-class:: classref-item-separator
  277. ----
  278. .. _enum_Viewport_ScreenSpaceAA:
  279. .. rst-class:: classref-enumeration
  280. enum **ScreenSpaceAA**:
  281. .. _class_Viewport_constant_SCREEN_SPACE_AA_DISABLED:
  282. .. rst-class:: classref-enumeration-constant
  283. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_DISABLED** = ``0``
  284. Do not perform any antialiasing in the full screen post-process.
  285. .. _class_Viewport_constant_SCREEN_SPACE_AA_FXAA:
  286. .. rst-class:: classref-enumeration-constant
  287. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_FXAA** = ``1``
  288. 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.
  289. .. _class_Viewport_constant_SCREEN_SPACE_AA_MAX:
  290. .. rst-class:: classref-enumeration-constant
  291. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_MAX** = ``2``
  292. Represents the size of the :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` enum.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _enum_Viewport_RenderInfo:
  296. .. rst-class:: classref-enumeration
  297. enum **RenderInfo**:
  298. .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
  299. .. rst-class:: classref-enumeration-constant
  300. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_OBJECTS_IN_FRAME** = ``0``
  301. Amount of objects in frame.
  302. .. _class_Viewport_constant_RENDER_INFO_PRIMITIVES_IN_FRAME:
  303. .. rst-class:: classref-enumeration-constant
  304. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_PRIMITIVES_IN_FRAME** = ``1``
  305. Amount of vertices in frame.
  306. .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
  307. .. rst-class:: classref-enumeration-constant
  308. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_DRAW_CALLS_IN_FRAME** = ``2``
  309. Amount of draw calls in frame.
  310. .. _class_Viewport_constant_RENDER_INFO_MAX:
  311. .. rst-class:: classref-enumeration-constant
  312. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MAX** = ``3``
  313. Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
  314. .. rst-class:: classref-item-separator
  315. ----
  316. .. _enum_Viewport_RenderInfoType:
  317. .. rst-class:: classref-enumeration
  318. enum **RenderInfoType**:
  319. .. _class_Viewport_constant_RENDER_INFO_TYPE_VISIBLE:
  320. .. rst-class:: classref-enumeration-constant
  321. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_VISIBLE** = ``0``
  322. .. _class_Viewport_constant_RENDER_INFO_TYPE_SHADOW:
  323. .. rst-class:: classref-enumeration-constant
  324. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_SHADOW** = ``1``
  325. .. _class_Viewport_constant_RENDER_INFO_TYPE_MAX:
  326. .. rst-class:: classref-enumeration-constant
  327. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_MAX** = ``2``
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _enum_Viewport_DebugDraw:
  331. .. rst-class:: classref-enumeration
  332. enum **DebugDraw**:
  333. .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
  334. .. rst-class:: classref-enumeration-constant
  335. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLED** = ``0``
  336. Objects are displayed normally.
  337. .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
  338. .. rst-class:: classref-enumeration-constant
  339. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_UNSHADED** = ``1``
  340. Objects are displayed without light information.
  341. .. _class_Viewport_constant_DEBUG_DRAW_LIGHTING:
  342. .. rst-class:: classref-enumeration-constant
  343. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_LIGHTING** = ``2``
  344. .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
  345. .. rst-class:: classref-enumeration-constant
  346. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OVERDRAW** = ``3``
  347. 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.
  348. .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
  349. .. rst-class:: classref-enumeration-constant
  350. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_WIREFRAME** = ``4``
  351. Objects are displayed in wireframe style.
  352. .. _class_Viewport_constant_DEBUG_DRAW_NORMAL_BUFFER:
  353. .. rst-class:: classref-enumeration-constant
  354. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_NORMAL_BUFFER** = ``5``
  355. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_ALBEDO:
  356. .. rst-class:: classref-enumeration-constant
  357. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_ALBEDO** = ``6``
  358. Objects are displayed with only the albedo value from :ref:`VoxelGI<class_VoxelGI>`\ s.
  359. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_LIGHTING:
  360. .. rst-class:: classref-enumeration-constant
  361. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_LIGHTING** = ``7``
  362. Objects are displayed with only the lighting value from :ref:`VoxelGI<class_VoxelGI>`\ s.
  363. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_EMISSION:
  364. .. rst-class:: classref-enumeration-constant
  365. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_EMISSION** = ``8``
  366. Objects are displayed with only the emission color from :ref:`VoxelGI<class_VoxelGI>`\ s.
  367. .. _class_Viewport_constant_DEBUG_DRAW_SHADOW_ATLAS:
  368. .. rst-class:: classref-enumeration-constant
  369. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SHADOW_ATLAS** = ``9``
  370. Draws the shadow atlas that stores shadows from :ref:`OmniLight3D<class_OmniLight3D>`\ s and :ref:`SpotLight3D<class_SpotLight3D>`\ s in the upper left quadrant of the **Viewport**.
  371. .. _class_Viewport_constant_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS:
  372. .. rst-class:: classref-enumeration-constant
  373. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS** = ``10``
  374. Draws the shadow atlas that stores shadows from :ref:`DirectionalLight3D<class_DirectionalLight3D>`\ s in the upper left quadrant of the **Viewport**.
  375. .. _class_Viewport_constant_DEBUG_DRAW_SCENE_LUMINANCE:
  376. .. rst-class:: classref-enumeration-constant
  377. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SCENE_LUMINANCE** = ``11``
  378. .. _class_Viewport_constant_DEBUG_DRAW_SSAO:
  379. .. rst-class:: classref-enumeration-constant
  380. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SSAO** = ``12``
  381. 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 :ref:`Environment.ssao_enabled<class_Environment_property_ssao_enabled>` set in your :ref:`WorldEnvironment<class_WorldEnvironment>`.
  382. .. _class_Viewport_constant_DEBUG_DRAW_SSIL:
  383. .. rst-class:: classref-enumeration-constant
  384. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SSIL** = ``13``
  385. 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 :ref:`Environment.ssil_enabled<class_Environment_property_ssil_enabled>` set in your :ref:`WorldEnvironment<class_WorldEnvironment>`.
  386. .. _class_Viewport_constant_DEBUG_DRAW_PSSM_SPLITS:
  387. .. rst-class:: classref-enumeration-constant
  388. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_PSSM_SPLITS** = ``14``
  389. Colors each PSSM split for the :ref:`DirectionalLight3D<class_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.
  390. .. _class_Viewport_constant_DEBUG_DRAW_DECAL_ATLAS:
  391. .. rst-class:: classref-enumeration-constant
  392. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DECAL_ATLAS** = ``15``
  393. Draws the decal atlas used by :ref:`Decal<class_Decal>`\ s and light projector textures in the upper left quadrant of the **Viewport**.
  394. .. _class_Viewport_constant_DEBUG_DRAW_SDFGI:
  395. .. rst-class:: classref-enumeration-constant
  396. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SDFGI** = ``16``
  397. .. _class_Viewport_constant_DEBUG_DRAW_SDFGI_PROBES:
  398. .. rst-class:: classref-enumeration-constant
  399. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SDFGI_PROBES** = ``17``
  400. .. _class_Viewport_constant_DEBUG_DRAW_GI_BUFFER:
  401. .. rst-class:: classref-enumeration-constant
  402. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_GI_BUFFER** = ``18``
  403. .. _class_Viewport_constant_DEBUG_DRAW_DISABLE_LOD:
  404. .. rst-class:: classref-enumeration-constant
  405. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLE_LOD** = ``19``
  406. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS:
  407. .. rst-class:: classref-enumeration-constant
  408. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_OMNI_LIGHTS** = ``20``
  409. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS:
  410. .. rst-class:: classref-enumeration-constant
  411. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_SPOT_LIGHTS** = ``21``
  412. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_DECALS:
  413. .. rst-class:: classref-enumeration-constant
  414. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_DECALS** = ``22``
  415. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES:
  416. .. rst-class:: classref-enumeration-constant
  417. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_REFLECTION_PROBES** = ``23``
  418. .. _class_Viewport_constant_DEBUG_DRAW_OCCLUDERS:
  419. .. rst-class:: classref-enumeration-constant
  420. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OCCLUDERS** = ``24``
  421. .. _class_Viewport_constant_DEBUG_DRAW_MOTION_VECTORS:
  422. .. rst-class:: classref-enumeration-constant
  423. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_MOTION_VECTORS** = ``25``
  424. .. rst-class:: classref-item-separator
  425. ----
  426. .. _enum_Viewport_DefaultCanvasItemTextureFilter:
  427. .. rst-class:: classref-enumeration
  428. enum **DefaultCanvasItemTextureFilter**:
  429. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
  430. .. rst-class:: classref-enumeration-constant
  431. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST** = ``0``
  432. The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized.
  433. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
  434. .. rst-class:: classref-enumeration-constant
  435. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR** = ``1``
  436. The texture filter blends between the nearest 4 pixels. Use this when you want to avoid a pixelated style, but do not want mipmaps.
  437. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
  438. .. rst-class:: classref-enumeration-constant
  439. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS** = ``2``
  440. The texture filter reads from the nearest pixel in the nearest mipmap. The fastest way to read from textures with mipmaps.
  441. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
  442. .. rst-class:: classref-enumeration-constant
  443. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS** = ``3``
  444. The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps.
  445. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX:
  446. .. rst-class:: classref-enumeration-constant
  447. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX** = ``4``
  448. Max value for :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` enum.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _enum_Viewport_DefaultCanvasItemTextureRepeat:
  452. .. rst-class:: classref-enumeration
  453. enum **DefaultCanvasItemTextureRepeat**:
  454. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
  455. .. rst-class:: classref-enumeration-constant
  456. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED** = ``0``
  457. 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.
  458. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
  459. .. rst-class:: classref-enumeration-constant
  460. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED** = ``1``
  461. 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.
  462. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
  463. .. rst-class:: classref-enumeration-constant
  464. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR** = ``2``
  465. Flip the texture when repeating so that the edge lines up instead of abruptly changing.
  466. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX:
  467. .. rst-class:: classref-enumeration-constant
  468. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX** = ``3``
  469. Max value for :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` enum.
  470. .. rst-class:: classref-item-separator
  471. ----
  472. .. _enum_Viewport_SDFOversize:
  473. .. rst-class:: classref-enumeration
  474. enum **SDFOversize**:
  475. .. _class_Viewport_constant_SDF_OVERSIZE_100_PERCENT:
  476. .. rst-class:: classref-enumeration-constant
  477. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_100_PERCENT** = ``0``
  478. .. _class_Viewport_constant_SDF_OVERSIZE_120_PERCENT:
  479. .. rst-class:: classref-enumeration-constant
  480. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_120_PERCENT** = ``1``
  481. .. _class_Viewport_constant_SDF_OVERSIZE_150_PERCENT:
  482. .. rst-class:: classref-enumeration-constant
  483. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_150_PERCENT** = ``2``
  484. .. _class_Viewport_constant_SDF_OVERSIZE_200_PERCENT:
  485. .. rst-class:: classref-enumeration-constant
  486. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_200_PERCENT** = ``3``
  487. .. _class_Viewport_constant_SDF_OVERSIZE_MAX:
  488. .. rst-class:: classref-enumeration-constant
  489. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_MAX** = ``4``
  490. .. rst-class:: classref-item-separator
  491. ----
  492. .. _enum_Viewport_SDFScale:
  493. .. rst-class:: classref-enumeration
  494. enum **SDFScale**:
  495. .. _class_Viewport_constant_SDF_SCALE_100_PERCENT:
  496. .. rst-class:: classref-enumeration-constant
  497. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_100_PERCENT** = ``0``
  498. .. _class_Viewport_constant_SDF_SCALE_50_PERCENT:
  499. .. rst-class:: classref-enumeration-constant
  500. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_50_PERCENT** = ``1``
  501. .. _class_Viewport_constant_SDF_SCALE_25_PERCENT:
  502. .. rst-class:: classref-enumeration-constant
  503. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_25_PERCENT** = ``2``
  504. .. _class_Viewport_constant_SDF_SCALE_MAX:
  505. .. rst-class:: classref-enumeration-constant
  506. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_MAX** = ``3``
  507. .. rst-class:: classref-item-separator
  508. ----
  509. .. _enum_Viewport_VRSMode:
  510. .. rst-class:: classref-enumeration
  511. enum **VRSMode**:
  512. .. _class_Viewport_constant_VRS_DISABLED:
  513. .. rst-class:: classref-enumeration-constant
  514. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_DISABLED** = ``0``
  515. VRS is disabled.
  516. .. _class_Viewport_constant_VRS_TEXTURE:
  517. .. rst-class:: classref-enumeration-constant
  518. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_TEXTURE** = ``1``
  519. VRS uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view.
  520. .. _class_Viewport_constant_VRS_XR:
  521. .. rst-class:: classref-enumeration-constant
  522. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_XR** = ``2``
  523. VRS texture is supplied by the primary :ref:`XRInterface<class_XRInterface>`.
  524. .. _class_Viewport_constant_VRS_MAX:
  525. .. rst-class:: classref-enumeration-constant
  526. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_MAX** = ``3``
  527. Represents the size of the :ref:`VRSMode<enum_Viewport_VRSMode>` enum.
  528. .. rst-class:: classref-section-separator
  529. ----
  530. .. rst-class:: classref-descriptions-group
  531. Property Descriptions
  532. ---------------------
  533. .. _class_Viewport_property_audio_listener_enable_2d:
  534. .. rst-class:: classref-property
  535. :ref:`bool<class_bool>` **audio_listener_enable_2d** = ``false``
  536. .. rst-class:: classref-property-setget
  537. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` value **)**
  538. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)**
  539. If ``true``, the viewport will process 2D audio streams.
  540. .. rst-class:: classref-item-separator
  541. ----
  542. .. _class_Viewport_property_audio_listener_enable_3d:
  543. .. rst-class:: classref-property
  544. :ref:`bool<class_bool>` **audio_listener_enable_3d** = ``false``
  545. .. rst-class:: classref-property-setget
  546. - void **set_as_audio_listener_3d** **(** :ref:`bool<class_bool>` value **)**
  547. - :ref:`bool<class_bool>` **is_audio_listener_3d** **(** **)**
  548. If ``true``, the viewport will process 3D audio streams.
  549. .. rst-class:: classref-item-separator
  550. ----
  551. .. _class_Viewport_property_canvas_cull_mask:
  552. .. rst-class:: classref-property
  553. :ref:`int<class_int>` **canvas_cull_mask** = ``4294967295``
  554. .. rst-class:: classref-property-setget
  555. - void **set_canvas_cull_mask** **(** :ref:`int<class_int>` value **)**
  556. - :ref:`int<class_int>` **get_canvas_cull_mask** **(** **)**
  557. The rendering layers in which this **Viewport** renders :ref:`CanvasItem<class_CanvasItem>` nodes.
  558. .. rst-class:: classref-item-separator
  559. ----
  560. .. _class_Viewport_property_canvas_item_default_texture_filter:
  561. .. rst-class:: classref-property
  562. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **canvas_item_default_texture_filter** = ``1``
  563. .. rst-class:: classref-property-setget
  564. - void **set_default_canvas_item_texture_filter** **(** :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` value **)**
  565. - :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **get_default_canvas_item_texture_filter** **(** **)**
  566. Sets the default filter mode used by :ref:`CanvasItem<class_CanvasItem>`\ s in this Viewport. See :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` for options.
  567. .. rst-class:: classref-item-separator
  568. ----
  569. .. _class_Viewport_property_canvas_item_default_texture_repeat:
  570. .. rst-class:: classref-property
  571. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **canvas_item_default_texture_repeat** = ``0``
  572. .. rst-class:: classref-property-setget
  573. - void **set_default_canvas_item_texture_repeat** **(** :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` value **)**
  574. - :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **get_default_canvas_item_texture_repeat** **(** **)**
  575. Sets the default repeat mode used by :ref:`CanvasItem<class_CanvasItem>`\ s in this Viewport. See :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` for options.
  576. .. rst-class:: classref-item-separator
  577. ----
  578. .. _class_Viewport_property_canvas_transform:
  579. .. rst-class:: classref-property
  580. :ref:`Transform2D<class_Transform2D>` **canvas_transform**
  581. .. rst-class:: classref-property-setget
  582. - void **set_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  583. - :ref:`Transform2D<class_Transform2D>` **get_canvas_transform** **(** **)**
  584. The canvas transform of the viewport, useful for changing the on-screen positions of all child :ref:`CanvasItem<class_CanvasItem>`\ s. This is relative to the global canvas transform of the viewport.
  585. .. rst-class:: classref-item-separator
  586. ----
  587. .. _class_Viewport_property_debug_draw:
  588. .. rst-class:: classref-property
  589. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw** = ``0``
  590. .. rst-class:: classref-property-setget
  591. - void **set_debug_draw** **(** :ref:`DebugDraw<enum_Viewport_DebugDraw>` value **)**
  592. - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **get_debug_draw** **(** **)**
  593. The overlay mode for test rendered geometry in debug purposes.
  594. .. rst-class:: classref-item-separator
  595. ----
  596. .. _class_Viewport_property_disable_3d:
  597. .. rst-class:: classref-property
  598. :ref:`bool<class_bool>` **disable_3d** = ``false``
  599. .. rst-class:: classref-property-setget
  600. - void **set_disable_3d** **(** :ref:`bool<class_bool>` value **)**
  601. - :ref:`bool<class_bool>` **is_3d_disabled** **(** **)**
  602. Disable 3D rendering (but keep 2D rendering).
  603. .. rst-class:: classref-item-separator
  604. ----
  605. .. _class_Viewport_property_fsr_sharpness:
  606. .. rst-class:: classref-property
  607. :ref:`float<class_float>` **fsr_sharpness** = ``0.2``
  608. .. rst-class:: classref-property-setget
  609. - void **set_fsr_sharpness** **(** :ref:`float<class_float>` value **)**
  610. - :ref:`float<class_float>` **get_fsr_sharpness** **(** **)**
  611. 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.
  612. To control this property on the root viewport, set the :ref:`ProjectSettings.rendering/scaling_3d/fsr_sharpness<class_ProjectSettings_property_rendering/scaling_3d/fsr_sharpness>` project setting.
  613. .. rst-class:: classref-item-separator
  614. ----
  615. .. _class_Viewport_property_global_canvas_transform:
  616. .. rst-class:: classref-property
  617. :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
  618. .. rst-class:: classref-property-setget
  619. - void **set_global_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  620. - :ref:`Transform2D<class_Transform2D>` **get_global_canvas_transform** **(** **)**
  621. The global canvas transform of the viewport. The canvas transform is relative to this.
  622. .. rst-class:: classref-item-separator
  623. ----
  624. .. _class_Viewport_property_gui_disable_input:
  625. .. rst-class:: classref-property
  626. :ref:`bool<class_bool>` **gui_disable_input** = ``false``
  627. .. rst-class:: classref-property-setget
  628. - void **set_disable_input** **(** :ref:`bool<class_bool>` value **)**
  629. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)**
  630. If ``true``, the viewport will not receive input events.
  631. .. rst-class:: classref-item-separator
  632. ----
  633. .. _class_Viewport_property_gui_embed_subwindows:
  634. .. rst-class:: classref-property
  635. :ref:`bool<class_bool>` **gui_embed_subwindows** = ``false``
  636. .. rst-class:: classref-property-setget
  637. - void **set_embedding_subwindows** **(** :ref:`bool<class_bool>` value **)**
  638. - :ref:`bool<class_bool>` **is_embedding_subwindows** **(** **)**
  639. If ``true``, sub-windows (popups and dialogs) will be embedded inside application window as control-like nodes. If ``false``, they will appear as separate windows handled by the operating system.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_Viewport_property_gui_snap_controls_to_pixels:
  643. .. rst-class:: classref-property
  644. :ref:`bool<class_bool>` **gui_snap_controls_to_pixels** = ``true``
  645. .. rst-class:: classref-property-setget
  646. - void **set_snap_controls_to_pixels** **(** :ref:`bool<class_bool>` value **)**
  647. - :ref:`bool<class_bool>` **is_snap_controls_to_pixels_enabled** **(** **)**
  648. If ``true``, the GUI controls on the viewport will lay pixel perfectly.
  649. .. rst-class:: classref-item-separator
  650. ----
  651. .. _class_Viewport_property_handle_input_locally:
  652. .. rst-class:: classref-property
  653. :ref:`bool<class_bool>` **handle_input_locally** = ``true``
  654. .. rst-class:: classref-property-setget
  655. - void **set_handle_input_locally** **(** :ref:`bool<class_bool>` value **)**
  656. - :ref:`bool<class_bool>` **is_handling_input_locally** **(** **)**
  657. If ``true``, this viewport will mark incoming input events as handled by itself. If ``false``, this is instead done by the the first parent viewport that is set to handle input locally.
  658. A :ref:`SubViewportContainer<class_SubViewportContainer>` will automatically set this property to ``false`` for the **Viewport** contained inside of it.
  659. See also :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` and :ref:`is_input_handled<class_Viewport_method_is_input_handled>`.
  660. .. rst-class:: classref-item-separator
  661. ----
  662. .. _class_Viewport_property_mesh_lod_threshold:
  663. .. rst-class:: classref-property
  664. :ref:`float<class_float>` **mesh_lod_threshold** = ``1.0``
  665. .. rst-class:: classref-property-setget
  666. - void **set_mesh_lod_threshold** **(** :ref:`float<class_float>` value **)**
  667. - :ref:`float<class_float>` **get_mesh_lod_threshold** **(** **)**
  668. The automatic LOD bias to use for meshes rendered within the **Viewport** (this is analogous to :ref:`ReflectionProbe.mesh_lod_threshold<class_ReflectionProbe_property_mesh_lod_threshold>`). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to ``0.0``, automatic LOD is disabled. Increase :ref:`mesh_lod_threshold<class_Viewport_property_mesh_lod_threshold>` to improve performance at the cost of geometry detail.
  669. To control this property on the root viewport, set the :ref:`ProjectSettings.rendering/mesh_lod/lod_change/threshold_pixels<class_ProjectSettings_property_rendering/mesh_lod/lod_change/threshold_pixels>` project setting.
  670. \ **Note:** :ref:`mesh_lod_threshold<class_Viewport_property_mesh_lod_threshold>` does not affect :ref:`GeometryInstance3D<class_GeometryInstance3D>` visibility ranges (also known as "manual" LOD or hierarchical LOD).
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_Viewport_property_msaa_2d:
  674. .. rst-class:: classref-property
  675. :ref:`MSAA<enum_Viewport_MSAA>` **msaa_2d** = ``0``
  676. .. rst-class:: classref-property-setget
  677. - void **set_msaa_2d** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  678. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa_2d** **(** **)**
  679. The multisample anti-aliasing mode for 2D/Canvas rendering. 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. This has no effect on shader-induced aliasing or texture aliasing.
  680. .. rst-class:: classref-item-separator
  681. ----
  682. .. _class_Viewport_property_msaa_3d:
  683. .. rst-class:: classref-property
  684. :ref:`MSAA<enum_Viewport_MSAA>` **msaa_3d** = ``0``
  685. .. rst-class:: classref-property-setget
  686. - void **set_msaa_3d** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  687. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa_3d** **(** **)**
  688. The multisample anti-aliasing mode for 3D rendering. 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 :ref:`scaling_3d_mode<class_Viewport_property_scaling_3d_mode>` for supersampling, which provides higher quality but is much more expensive. This has no effect on shader-induced aliasing or texture aliasing.
  689. .. rst-class:: classref-item-separator
  690. ----
  691. .. _class_Viewport_property_own_world_3d:
  692. .. rst-class:: classref-property
  693. :ref:`bool<class_bool>` **own_world_3d** = ``false``
  694. .. rst-class:: classref-property-setget
  695. - void **set_use_own_world_3d** **(** :ref:`bool<class_bool>` value **)**
  696. - :ref:`bool<class_bool>` **is_using_own_world_3d** **(** **)**
  697. If ``true``, the viewport will use a unique copy of the :ref:`World3D<class_World3D>` defined in :ref:`world_3d<class_Viewport_property_world_3d>`.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_Viewport_property_physics_object_picking:
  701. .. rst-class:: classref-property
  702. :ref:`bool<class_bool>` **physics_object_picking** = ``false``
  703. .. rst-class:: classref-property-setget
  704. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` value **)**
  705. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  706. If ``true``, the objects rendered by viewport become subjects of mouse picking process.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_Viewport_property_positional_shadow_atlas_16_bits:
  710. .. rst-class:: classref-property
  711. :ref:`bool<class_bool>` **positional_shadow_atlas_16_bits** = ``true``
  712. .. rst-class:: classref-property-setget
  713. - void **set_positional_shadow_atlas_16_bits** **(** :ref:`bool<class_bool>` value **)**
  714. - :ref:`bool<class_bool>` **get_positional_shadow_atlas_16_bits** **(** **)**
  715. .. container:: contribute
  716. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  717. .. rst-class:: classref-item-separator
  718. ----
  719. .. _class_Viewport_property_positional_shadow_atlas_quad_0:
  720. .. rst-class:: classref-property
  721. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_0** = ``2``
  722. .. rst-class:: classref-property-setget
  723. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  724. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  725. The subdivision amount of the first quadrant on the shadow atlas.
  726. .. rst-class:: classref-item-separator
  727. ----
  728. .. _class_Viewport_property_positional_shadow_atlas_quad_1:
  729. .. rst-class:: classref-property
  730. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_1** = ``2``
  731. .. rst-class:: classref-property-setget
  732. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  733. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  734. The subdivision amount of the second quadrant on the shadow atlas.
  735. .. rst-class:: classref-item-separator
  736. ----
  737. .. _class_Viewport_property_positional_shadow_atlas_quad_2:
  738. .. rst-class:: classref-property
  739. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_2** = ``3``
  740. .. rst-class:: classref-property-setget
  741. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  742. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  743. The subdivision amount of the third quadrant on the shadow atlas.
  744. .. rst-class:: classref-item-separator
  745. ----
  746. .. _class_Viewport_property_positional_shadow_atlas_quad_3:
  747. .. rst-class:: classref-property
  748. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_3** = ``4``
  749. .. rst-class:: classref-property-setget
  750. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  751. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  752. The subdivision amount of the fourth quadrant on the shadow atlas.
  753. .. rst-class:: classref-item-separator
  754. ----
  755. .. _class_Viewport_property_positional_shadow_atlas_size:
  756. .. rst-class:: classref-property
  757. :ref:`int<class_int>` **positional_shadow_atlas_size** = ``2048``
  758. .. rst-class:: classref-property-setget
  759. - void **set_positional_shadow_atlas_size** **(** :ref:`int<class_int>` value **)**
  760. - :ref:`int<class_int>` **get_positional_shadow_atlas_size** **(** **)**
  761. The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
  762. \ **Note:** If this is set to ``0``, no shadows will be visible at all (including directional shadows).
  763. .. rst-class:: classref-item-separator
  764. ----
  765. .. _class_Viewport_property_scaling_3d_mode:
  766. .. rst-class:: classref-property
  767. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **scaling_3d_mode** = ``0``
  768. .. rst-class:: classref-property-setget
  769. - void **set_scaling_3d_mode** **(** :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` value **)**
  770. - :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **get_scaling_3d_mode** **(** **)**
  771. 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.
  772. To control this property on the root viewport, set the :ref:`ProjectSettings.rendering/scaling_3d/mode<class_ProjectSettings_property_rendering/scaling_3d/mode>` project setting.
  773. .. rst-class:: classref-item-separator
  774. ----
  775. .. _class_Viewport_property_scaling_3d_scale:
  776. .. rst-class:: classref-property
  777. :ref:`float<class_float>` **scaling_3d_scale** = ``1.0``
  778. .. rst-class:: classref-property-setget
  779. - void **set_scaling_3d_scale** **(** :ref:`float<class_float>` value **)**
  780. - :ref:`float<class_float>` **get_scaling_3d_scale** **(** **)**
  781. Scales the 3D render buffer based on the viewport size uses an image filter specified in :ref:`ProjectSettings.rendering/scaling_3d/mode<class_ProjectSettings_property_rendering/scaling_3d/mode>` to scale the output image to the full viewport size. Values lower than ``1.0`` can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than ``1.0`` are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also :ref:`ProjectSettings.rendering/anti_aliasing/quality/msaa_3d<class_ProjectSettings_property_rendering/anti_aliasing/quality/msaa_3d>` for multi-sample antialiasing, which is significantly cheaper but only smooths the edges of polygons.
  782. 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.
  783. To control this property on the root viewport, set the :ref:`ProjectSettings.rendering/scaling_3d/scale<class_ProjectSettings_property_rendering/scaling_3d/scale>` project setting.
  784. .. rst-class:: classref-item-separator
  785. ----
  786. .. _class_Viewport_property_screen_space_aa:
  787. .. rst-class:: classref-property
  788. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **screen_space_aa** = ``0``
  789. .. rst-class:: classref-property-setget
  790. - void **set_screen_space_aa** **(** :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` value **)**
  791. - :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **get_screen_space_aa** **(** **)**
  792. 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.
  793. .. rst-class:: classref-item-separator
  794. ----
  795. .. _class_Viewport_property_sdf_oversize:
  796. .. rst-class:: classref-property
  797. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **sdf_oversize** = ``1``
  798. .. rst-class:: classref-property-setget
  799. - void **set_sdf_oversize** **(** :ref:`SDFOversize<enum_Viewport_SDFOversize>` value **)**
  800. - :ref:`SDFOversize<enum_Viewport_SDFOversize>` **get_sdf_oversize** **(** **)**
  801. .. container:: contribute
  802. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  803. .. rst-class:: classref-item-separator
  804. ----
  805. .. _class_Viewport_property_sdf_scale:
  806. .. rst-class:: classref-property
  807. :ref:`SDFScale<enum_Viewport_SDFScale>` **sdf_scale** = ``1``
  808. .. rst-class:: classref-property-setget
  809. - void **set_sdf_scale** **(** :ref:`SDFScale<enum_Viewport_SDFScale>` value **)**
  810. - :ref:`SDFScale<enum_Viewport_SDFScale>` **get_sdf_scale** **(** **)**
  811. .. container:: contribute
  812. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  813. .. rst-class:: classref-item-separator
  814. ----
  815. .. _class_Viewport_property_snap_2d_transforms_to_pixel:
  816. .. rst-class:: classref-property
  817. :ref:`bool<class_bool>` **snap_2d_transforms_to_pixel** = ``false``
  818. .. rst-class:: classref-property-setget
  819. - void **set_snap_2d_transforms_to_pixel** **(** :ref:`bool<class_bool>` value **)**
  820. - :ref:`bool<class_bool>` **is_snap_2d_transforms_to_pixel_enabled** **(** **)**
  821. .. container:: contribute
  822. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  823. .. rst-class:: classref-item-separator
  824. ----
  825. .. _class_Viewport_property_snap_2d_vertices_to_pixel:
  826. .. rst-class:: classref-property
  827. :ref:`bool<class_bool>` **snap_2d_vertices_to_pixel** = ``false``
  828. .. rst-class:: classref-property-setget
  829. - void **set_snap_2d_vertices_to_pixel** **(** :ref:`bool<class_bool>` value **)**
  830. - :ref:`bool<class_bool>` **is_snap_2d_vertices_to_pixel_enabled** **(** **)**
  831. .. container:: contribute
  832. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  833. .. rst-class:: classref-item-separator
  834. ----
  835. .. _class_Viewport_property_texture_mipmap_bias:
  836. .. rst-class:: classref-property
  837. :ref:`float<class_float>` **texture_mipmap_bias** = ``0.0``
  838. .. rst-class:: classref-property-setget
  839. - void **set_texture_mipmap_bias** **(** :ref:`float<class_float>` value **)**
  840. - :ref:`float<class_float>` **get_texture_mipmap_bias** **(** **)**
  841. Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close).
  842. Enabling temporal antialiasing (:ref:`use_taa<class_Viewport_property_use_taa>`) will automatically apply a ``-0.5`` offset to this value, while enabling FXAA (:ref:`screen_space_aa<class_Viewport_property_screen_space_aa>`) will automatically apply a ``-0.25`` offset to this value. If both TAA and FXAA are enbled at the same time, an offset of ``-0.75`` is applied to this value.
  843. \ **Note:** If :ref:`scaling_3d_scale<class_Viewport_property_scaling_3d_scale>` is lower than ``1.0`` (exclusive), :ref:`texture_mipmap_bias<class_Viewport_property_texture_mipmap_bias>` is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is ``log2(scaling_3d_scale) + mipmap_bias``.
  844. To control this property on the root viewport, set the :ref:`ProjectSettings.rendering/textures/default_filters/texture_mipmap_bias<class_ProjectSettings_property_rendering/textures/default_filters/texture_mipmap_bias>` project setting.
  845. .. rst-class:: classref-item-separator
  846. ----
  847. .. _class_Viewport_property_transparent_bg:
  848. .. rst-class:: classref-property
  849. :ref:`bool<class_bool>` **transparent_bg** = ``false``
  850. .. rst-class:: classref-property-setget
  851. - void **set_transparent_background** **(** :ref:`bool<class_bool>` value **)**
  852. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)**
  853. If ``true``, the viewport should render its background as transparent.
  854. .. rst-class:: classref-item-separator
  855. ----
  856. .. _class_Viewport_property_use_debanding:
  857. .. rst-class:: classref-property
  858. :ref:`bool<class_bool>` **use_debanding** = ``false``
  859. .. rst-class:: classref-property-setget
  860. - void **set_use_debanding** **(** :ref:`bool<class_bool>` value **)**
  861. - :ref:`bool<class_bool>` **is_using_debanding** **(** **)**
  862. If ``true``, uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is *not* affected by debanding unless the :ref:`Environment.background_mode<class_Environment_property_background_mode>` is :ref:`Environment.BG_CANVAS<class_Environment_constant_BG_CANVAS>`. See also :ref:`ProjectSettings.rendering/anti_aliasing/quality/use_debanding<class_ProjectSettings_property_rendering/anti_aliasing/quality/use_debanding>`.
  863. In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
  864. .. rst-class:: classref-item-separator
  865. ----
  866. .. _class_Viewport_property_use_occlusion_culling:
  867. .. rst-class:: classref-property
  868. :ref:`bool<class_bool>` **use_occlusion_culling** = ``false``
  869. .. rst-class:: classref-property-setget
  870. - void **set_use_occlusion_culling** **(** :ref:`bool<class_bool>` value **)**
  871. - :ref:`bool<class_bool>` **is_using_occlusion_culling** **(** **)**
  872. If ``true``, :ref:`OccluderInstance3D<class_OccluderInstance3D>` nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport, :ref:`ProjectSettings.rendering/occlusion_culling/use_occlusion_culling<class_ProjectSettings_property_rendering/occlusion_culling/use_occlusion_culling>` must be set to ``true`` instead.
  873. \ **Note:** 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 (:ref:`GeometryInstance3D.visibility_range_begin<class_GeometryInstance3D_property_visibility_range_begin>` and :ref:`GeometryInstance3D.visibility_range_end<class_GeometryInstance3D_property_visibility_range_end>`) compared to occlusion culling.
  874. .. rst-class:: classref-item-separator
  875. ----
  876. .. _class_Viewport_property_use_taa:
  877. .. rst-class:: classref-property
  878. :ref:`bool<class_bool>` **use_taa** = ``false``
  879. .. rst-class:: classref-property-setget
  880. - void **set_use_taa** **(** :ref:`bool<class_bool>` value **)**
  881. - :ref:`bool<class_bool>` **is_using_taa** **(** **)**
  882. Enables Temporal Anti-Aliasing for this viewport. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion.
  883. \ **Note:** The implementation is not complete yet, some visual instances such as particles and skinned meshes may show artifacts.
  884. .. rst-class:: classref-item-separator
  885. ----
  886. .. _class_Viewport_property_use_xr:
  887. .. rst-class:: classref-property
  888. :ref:`bool<class_bool>` **use_xr** = ``false``
  889. .. rst-class:: classref-property-setget
  890. - void **set_use_xr** **(** :ref:`bool<class_bool>` value **)**
  891. - :ref:`bool<class_bool>` **is_using_xr** **(** **)**
  892. If ``true``, 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.
  893. .. rst-class:: classref-item-separator
  894. ----
  895. .. _class_Viewport_property_vrs_mode:
  896. .. rst-class:: classref-property
  897. :ref:`VRSMode<enum_Viewport_VRSMode>` **vrs_mode** = ``0``
  898. .. rst-class:: classref-property-setget
  899. - void **set_vrs_mode** **(** :ref:`VRSMode<enum_Viewport_VRSMode>` value **)**
  900. - :ref:`VRSMode<enum_Viewport_VRSMode>` **get_vrs_mode** **(** **)**
  901. The Variable Rate Shading (VRS) mode that is used for this viewport. Note, if hardware does not support VRS this property is ignored.
  902. .. rst-class:: classref-item-separator
  903. ----
  904. .. _class_Viewport_property_vrs_texture:
  905. .. rst-class:: classref-property
  906. :ref:`Texture2D<class_Texture2D>` **vrs_texture**
  907. .. rst-class:: classref-property-setget
  908. - void **set_vrs_texture** **(** :ref:`Texture2D<class_Texture2D>` value **)**
  909. - :ref:`Texture2D<class_Texture2D>` **get_vrs_texture** **(** **)**
  910. Texture to use when :ref:`vrs_mode<class_Viewport_property_vrs_mode>` is set to :ref:`VRS_TEXTURE<class_Viewport_constant_VRS_TEXTURE>`.
  911. The texture *must* use a lossless compression format so that colors can be matched precisely. The following VRS densities are mapped to various colors, with brighter colors representing a lower level of shading precision:
  912. ::
  913. - 1x1 = rgb(0, 0, 0) - #000000
  914. - 1x2 = rgb(0, 85, 0) - #005500
  915. - 2x1 = rgb(85, 0, 0) - #550000
  916. - 2x2 = rgb(85, 85, 0) - #555500
  917. - 2x4 = rgb(85, 170, 0) - #55aa00
  918. - 4x2 = rgb(170, 85, 0) - #aa5500
  919. - 4x4 = rgb(170, 170, 0) - #aaaa00
  920. - 4x8 = rgb(170, 255, 0) - #aaff00 - Not supported on most hardware
  921. - 8x4 = rgb(255, 170, 0) - #ffaa00 - Not supported on most hardware
  922. - 8x8 = rgb(255, 255, 0) - #ffff00 - Not supported on most hardware
  923. .. rst-class:: classref-item-separator
  924. ----
  925. .. _class_Viewport_property_world_2d:
  926. .. rst-class:: classref-property
  927. :ref:`World2D<class_World2D>` **world_2d**
  928. .. rst-class:: classref-property-setget
  929. - void **set_world_2d** **(** :ref:`World2D<class_World2D>` value **)**
  930. - :ref:`World2D<class_World2D>` **get_world_2d** **(** **)**
  931. The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
  932. .. rst-class:: classref-item-separator
  933. ----
  934. .. _class_Viewport_property_world_3d:
  935. .. rst-class:: classref-property
  936. :ref:`World3D<class_World3D>` **world_3d**
  937. .. rst-class:: classref-property-setget
  938. - void **set_world_3d** **(** :ref:`World3D<class_World3D>` value **)**
  939. - :ref:`World3D<class_World3D>` **get_world_3d** **(** **)**
  940. The custom :ref:`World3D<class_World3D>` which can be used as 3D environment source.
  941. .. rst-class:: classref-section-separator
  942. ----
  943. .. rst-class:: classref-descriptions-group
  944. Method Descriptions
  945. -------------------
  946. .. _class_Viewport_method_find_world_2d:
  947. .. rst-class:: classref-method
  948. :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** |const|
  949. Returns the first valid :ref:`World2D<class_World2D>` for this viewport, searching the :ref:`world_2d<class_Viewport_property_world_2d>` property of itself and any Viewport ancestor.
  950. .. rst-class:: classref-item-separator
  951. ----
  952. .. _class_Viewport_method_find_world_3d:
  953. .. rst-class:: classref-method
  954. :ref:`World3D<class_World3D>` **find_world_3d** **(** **)** |const|
  955. Returns the first valid :ref:`World3D<class_World3D>` for this viewport, searching the :ref:`world_3d<class_Viewport_property_world_3d>` property of itself and any Viewport ancestor.
  956. .. rst-class:: classref-item-separator
  957. ----
  958. .. _class_Viewport_method_get_camera_2d:
  959. .. rst-class:: classref-method
  960. :ref:`Camera2D<class_Camera2D>` **get_camera_2d** **(** **)** |const|
  961. Returns the currently active 2D camera. Returns null if there are no active cameras.
  962. .. rst-class:: classref-item-separator
  963. ----
  964. .. _class_Viewport_method_get_camera_3d:
  965. .. rst-class:: classref-method
  966. :ref:`Camera3D<class_Camera3D>` **get_camera_3d** **(** **)** |const|
  967. Returns the currently active 3D camera.
  968. .. rst-class:: classref-item-separator
  969. ----
  970. .. _class_Viewport_method_get_canvas_cull_mask_bit:
  971. .. rst-class:: classref-method
  972. :ref:`bool<class_bool>` **get_canvas_cull_mask_bit** **(** :ref:`int<class_int>` layer **)** |const|
  973. Returns an individual bit on the rendering layer mask.
  974. .. rst-class:: classref-item-separator
  975. ----
  976. .. _class_Viewport_method_get_final_transform:
  977. .. rst-class:: classref-method
  978. :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** |const|
  979. Returns the transform from the viewport's coordinate system to the embedder's coordinate system.
  980. .. rst-class:: classref-item-separator
  981. ----
  982. .. _class_Viewport_method_get_mouse_position:
  983. .. rst-class:: classref-method
  984. :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** |const|
  985. Returns the mouse's position in this **Viewport** using the coordinate system of this **Viewport**.
  986. .. rst-class:: classref-item-separator
  987. ----
  988. .. _class_Viewport_method_get_positional_shadow_atlas_quadrant_subdiv:
  989. .. rst-class:: classref-method
  990. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  991. Returns the :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` of the specified quadrant.
  992. .. rst-class:: classref-item-separator
  993. ----
  994. .. _class_Viewport_method_get_render_info:
  995. .. rst-class:: classref-method
  996. :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` type, :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
  997. .. container:: contribute
  998. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  999. .. rst-class:: classref-item-separator
  1000. ----
  1001. .. _class_Viewport_method_get_screen_transform:
  1002. .. rst-class:: classref-method
  1003. :ref:`Transform2D<class_Transform2D>` **get_screen_transform** **(** **)** |const|
  1004. Returns the transform from the Viewport's coordinates to the screen coordinates of the containing window manager window.
  1005. .. rst-class:: classref-item-separator
  1006. ----
  1007. .. _class_Viewport_method_get_texture:
  1008. .. rst-class:: classref-method
  1009. :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** |const|
  1010. Returns the viewport's texture.
  1011. \ **Note:** When trying to store the current texture (e.g. in a file), it might be completely black or outdated if used too early, especially when used in e.g. :ref:`Node._ready<class_Node_method__ready>`. To make sure the texture you get is correct, you can await :ref:`RenderingServer.frame_post_draw<class_RenderingServer_signal_frame_post_draw>` signal.
  1012. ::
  1013. func _ready():
  1014. await RenderingServer.frame_post_draw
  1015. $Viewport.get_texture().get_image().save_png("user://Screenshot.png")
  1016. .. rst-class:: classref-item-separator
  1017. ----
  1018. .. _class_Viewport_method_get_viewport_rid:
  1019. .. rst-class:: classref-method
  1020. :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** |const|
  1021. Returns the viewport's RID from the :ref:`RenderingServer<class_RenderingServer>`.
  1022. .. rst-class:: classref-item-separator
  1023. ----
  1024. .. _class_Viewport_method_get_visible_rect:
  1025. .. rst-class:: classref-method
  1026. :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** |const|
  1027. Returns the visible rectangle in global screen coordinates.
  1028. .. rst-class:: classref-item-separator
  1029. ----
  1030. .. _class_Viewport_method_gui_get_drag_data:
  1031. .. rst-class:: classref-method
  1032. :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** |const|
  1033. Returns the drag data from the GUI, that was previously returned by :ref:`Control._get_drag_data<class_Control_method__get_drag_data>`.
  1034. .. rst-class:: classref-item-separator
  1035. ----
  1036. .. _class_Viewport_method_gui_get_focus_owner:
  1037. .. rst-class:: classref-method
  1038. :ref:`Control<class_Control>` **gui_get_focus_owner** **(** **)**
  1039. Returns the :ref:`Control<class_Control>` having the focus within this viewport. If no :ref:`Control<class_Control>` has the focus, returns null.
  1040. .. rst-class:: classref-item-separator
  1041. ----
  1042. .. _class_Viewport_method_gui_is_drag_successful:
  1043. .. rst-class:: classref-method
  1044. :ref:`bool<class_bool>` **gui_is_drag_successful** **(** **)** |const|
  1045. Returns ``true`` if the drag operation is successful.
  1046. .. rst-class:: classref-item-separator
  1047. ----
  1048. .. _class_Viewport_method_gui_is_dragging:
  1049. .. rst-class:: classref-method
  1050. :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** |const|
  1051. Returns ``true`` if the viewport is currently performing a drag operation.
  1052. Alternative to :ref:`Node.NOTIFICATION_DRAG_BEGIN<class_Node_constant_NOTIFICATION_DRAG_BEGIN>` and :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>` when you prefer polling the value.
  1053. .. rst-class:: classref-item-separator
  1054. ----
  1055. .. _class_Viewport_method_gui_release_focus:
  1056. .. rst-class:: classref-method
  1057. void **gui_release_focus** **(** **)**
  1058. Removes the focus from the currently focused :ref:`Control<class_Control>` within this viewport. If no :ref:`Control<class_Control>` has the focus, does nothing.
  1059. .. rst-class:: classref-item-separator
  1060. ----
  1061. .. _class_Viewport_method_is_input_handled:
  1062. .. rst-class:: classref-method
  1063. :ref:`bool<class_bool>` **is_input_handled** **(** **)** |const|
  1064. Returns whether the current :ref:`InputEvent<class_InputEvent>` has been handled. Input events are not handled until :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` has been called during the lifetime of an :ref:`InputEvent<class_InputEvent>`.
  1065. This is usually done as part of input handling methods like :ref:`Node._input<class_Node_method__input>`, :ref:`Control._gui_input<class_Control_method__gui_input>` or others, as well as in corresponding signal handlers.
  1066. If :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` is set to ``false``, this method will try finding the first parent viewport that is set to handle input locally, and return its value for :ref:`is_input_handled<class_Viewport_method_is_input_handled>` instead.
  1067. .. rst-class:: classref-item-separator
  1068. ----
  1069. .. _class_Viewport_method_push_input:
  1070. .. rst-class:: classref-method
  1071. void **push_input** **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)**
  1072. Triggers the given ``event`` in this **Viewport**. This can be used to pass an :ref:`InputEvent<class_InputEvent>` between viewports, or to locally apply inputs that were sent over the network or saved to a file.
  1073. If ``in_local_coords`` is ``false``, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If ``in_local_coords`` is ``true``, the event's position is in viewport coordinates.
  1074. While this method serves a similar purpose as :ref:`Input.parse_input_event<class_Input_method_parse_input_event>`, it does not remap the specified ``event`` based on project settings like :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`.
  1075. Calling this method will propagate calls to child nodes for following methods in the given order:
  1076. - :ref:`Node._input<class_Node_method__input>`\
  1077. - :ref:`Control._gui_input<class_Control_method__gui_input>` for :ref:`Control<class_Control>` nodes
  1078. If an earlier method marks the input as handled via :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>`, any later method in this list will not be called.
  1079. .. rst-class:: classref-item-separator
  1080. ----
  1081. .. _class_Viewport_method_push_text_input:
  1082. .. rst-class:: classref-method
  1083. void **push_text_input** **(** :ref:`String<class_String>` text **)**
  1084. .. container:: contribute
  1085. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  1086. .. rst-class:: classref-item-separator
  1087. ----
  1088. .. _class_Viewport_method_push_unhandled_input:
  1089. .. rst-class:: classref-method
  1090. void **push_unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)**
  1091. Triggers the given :ref:`InputEvent<class_InputEvent>` in this **Viewport**. This can be used to pass input events between viewports, or to locally apply inputs that were sent over the network or saved to a file.
  1092. If ``in_local_coords`` is ``false``, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If ``in_local_coords`` is ``true``, the event's position is in viewport coordinates.
  1093. While this method serves a similar purpose as :ref:`Input.parse_input_event<class_Input_method_parse_input_event>`, it does not remap the specified ``event`` based on project settings like :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`.
  1094. Calling this method will propagate calls to child nodes for following methods in the given order:
  1095. - :ref:`Node._shortcut_input<class_Node_method__shortcut_input>`\
  1096. - :ref:`Node._unhandled_input<class_Node_method__unhandled_input>`\
  1097. - :ref:`Node._unhandled_key_input<class_Node_method__unhandled_key_input>`\
  1098. If an earlier method marks the input as handled via :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>`, any later method in this list will not be called.
  1099. If none of the methods handle the event and :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` is ``true``, the event is used for physics object picking.
  1100. .. rst-class:: classref-item-separator
  1101. ----
  1102. .. _class_Viewport_method_set_canvas_cull_mask_bit:
  1103. .. rst-class:: classref-method
  1104. void **set_canvas_cull_mask_bit** **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enable **)**
  1105. Set/clear individual bits on the rendering layer mask. This simplifies editing this **Viewport**'s layers.
  1106. .. rst-class:: classref-item-separator
  1107. ----
  1108. .. _class_Viewport_method_set_input_as_handled:
  1109. .. rst-class:: classref-method
  1110. void **set_input_as_handled** **(** **)**
  1111. Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
  1112. .. rst-class:: classref-item-separator
  1113. ----
  1114. .. _class_Viewport_method_set_positional_shadow_atlas_quadrant_subdiv:
  1115. .. rst-class:: classref-method
  1116. void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  1117. 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.
  1118. .. rst-class:: classref-item-separator
  1119. ----
  1120. .. _class_Viewport_method_warp_mouse:
  1121. .. rst-class:: classref-method
  1122. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` position **)**
  1123. Moves the mouse pointer to the specified position in this **Viewport** using the coordinate system of this **Viewport**.
  1124. \ **Note:** :ref:`warp_mouse<class_Viewport_method_warp_mouse>` is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.
  1125. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1126. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1127. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1128. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1129. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1130. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`