class_viewport.rst 110 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155
  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/4.1/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.1/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. Abstract base class for viewports. Encapsulates drawing and interaction with a game world.
  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. Child 2D nodes will display on it, and child Camera3D 3D nodes will render on it too.
  16. Optionally, a viewport can have its own 2D or 3D world, so it doesn't share what it draws 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:`physics_object_picking_sort<class_Viewport_property_physics_object_picking_sort>` | ``false`` |
  76. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  77. | :ref:`bool<class_bool>` | :ref:`positional_shadow_atlas_16_bits<class_Viewport_property_positional_shadow_atlas_16_bits>` | ``true`` |
  78. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  79. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_0<class_Viewport_property_positional_shadow_atlas_quad_0>` | ``2`` |
  80. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  81. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_1<class_Viewport_property_positional_shadow_atlas_quad_1>` | ``2`` |
  82. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  83. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_2<class_Viewport_property_positional_shadow_atlas_quad_2>` | ``3`` |
  84. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  85. | :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` | :ref:`positional_shadow_atlas_quad_3<class_Viewport_property_positional_shadow_atlas_quad_3>` | ``4`` |
  86. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  87. | :ref:`int<class_int>` | :ref:`positional_shadow_atlas_size<class_Viewport_property_positional_shadow_atlas_size>` | ``2048`` |
  88. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  89. | :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` | :ref:`scaling_3d_mode<class_Viewport_property_scaling_3d_mode>` | ``0`` |
  90. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  91. | :ref:`float<class_float>` | :ref:`scaling_3d_scale<class_Viewport_property_scaling_3d_scale>` | ``1.0`` |
  92. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  93. | :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` | :ref:`screen_space_aa<class_Viewport_property_screen_space_aa>` | ``0`` |
  94. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  95. | :ref:`SDFOversize<enum_Viewport_SDFOversize>` | :ref:`sdf_oversize<class_Viewport_property_sdf_oversize>` | ``1`` |
  96. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  97. | :ref:`SDFScale<enum_Viewport_SDFScale>` | :ref:`sdf_scale<class_Viewport_property_sdf_scale>` | ``1`` |
  98. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  99. | :ref:`bool<class_bool>` | :ref:`snap_2d_transforms_to_pixel<class_Viewport_property_snap_2d_transforms_to_pixel>` | ``false`` |
  100. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  101. | :ref:`bool<class_bool>` | :ref:`snap_2d_vertices_to_pixel<class_Viewport_property_snap_2d_vertices_to_pixel>` | ``false`` |
  102. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  103. | :ref:`float<class_float>` | :ref:`texture_mipmap_bias<class_Viewport_property_texture_mipmap_bias>` | ``0.0`` |
  104. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  105. | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
  106. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  107. | :ref:`bool<class_bool>` | :ref:`use_debanding<class_Viewport_property_use_debanding>` | ``false`` |
  108. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  109. | :ref:`bool<class_bool>` | :ref:`use_occlusion_culling<class_Viewport_property_use_occlusion_culling>` | ``false`` |
  110. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  111. | :ref:`bool<class_bool>` | :ref:`use_taa<class_Viewport_property_use_taa>` | ``false`` |
  112. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  113. | :ref:`bool<class_bool>` | :ref:`use_xr<class_Viewport_property_use_xr>` | ``false`` |
  114. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  115. | :ref:`VRSMode<enum_Viewport_VRSMode>` | :ref:`vrs_mode<class_Viewport_property_vrs_mode>` | ``0`` |
  116. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  117. | :ref:`Texture2D<class_Texture2D>` | :ref:`vrs_texture<class_Viewport_property_vrs_texture>` | |
  118. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  119. | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
  120. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  121. | :ref:`World3D<class_World3D>` | :ref:`world_3d<class_Viewport_property_world_3d>` | |
  122. +-----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------+
  123. .. rst-class:: classref-reftable-group
  124. Methods
  125. -------
  126. .. table::
  127. :widths: auto
  128. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** |const| |
  130. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`World3D<class_World3D>` | :ref:`find_world_3d<class_Viewport_method_find_world_3d>` **(** **)** |const| |
  132. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`Camera2D<class_Camera2D>` | :ref:`get_camera_2d<class_Viewport_method_get_camera_2d>` **(** **)** |const| |
  134. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`Camera3D<class_Camera3D>` | :ref:`get_camera_3d<class_Viewport_method_get_camera_3d>` **(** **)** |const| |
  136. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`bool<class_bool>` | :ref:`get_canvas_cull_mask_bit<class_Viewport_method_get_canvas_cull_mask_bit>` **(** :ref:`int<class_int>` layer **)** |const| |
  138. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** |const| |
  140. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** |const| |
  142. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | :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| |
  144. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | :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 **)** |
  146. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_screen_transform<class_Viewport_method_get_screen_transform>` **(** **)** |const| |
  148. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** |const| |
  150. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** |const| |
  152. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** |const| |
  154. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** |const| |
  156. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :ref:`Control<class_Control>` | :ref:`gui_get_focus_owner<class_Viewport_method_gui_get_focus_owner>` **(** **)** |const| |
  158. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`bool<class_bool>` | :ref:`gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>` **(** **)** |const| |
  160. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** |const| |
  162. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | void | :ref:`gui_release_focus<class_Viewport_method_gui_release_focus>` **(** **)** |
  164. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** |const| |
  166. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | void | :ref:`push_input<class_Viewport_method_push_input>` **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)** |
  168. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`push_text_input<class_Viewport_method_push_text_input>` **(** :ref:`String<class_String>` text **)** |
  170. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`push_unhandled_input<class_Viewport_method_push_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)** |
  172. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | 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 **)** |
  174. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
  176. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | 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 **)** |
  178. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | void | :ref:`update_mouse_cursor_state<class_Viewport_method_update_mouse_cursor_state>` **(** **)** |
  180. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  182. +-----------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. .. rst-class:: classref-section-separator
  184. ----
  185. .. rst-class:: classref-descriptions-group
  186. Signals
  187. -------
  188. .. _class_Viewport_signal_gui_focus_changed:
  189. .. rst-class:: classref-signal
  190. **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
  191. Emitted when a Control node grabs keyboard focus.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_Viewport_signal_size_changed:
  195. .. rst-class:: classref-signal
  196. **size_changed** **(** **)**
  197. Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
  198. .. rst-class:: classref-section-separator
  199. ----
  200. .. rst-class:: classref-descriptions-group
  201. Enumerations
  202. ------------
  203. .. _enum_Viewport_PositionalShadowAtlasQuadrantSubdiv:
  204. .. rst-class:: classref-enumeration
  205. enum **PositionalShadowAtlasQuadrantSubdiv**:
  206. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
  207. .. rst-class:: classref-enumeration-constant
  208. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = ``0``
  209. This quadrant will not be used.
  210. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = ``1``
  213. This quadrant will only be used by one shadow map.
  214. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = ``2``
  217. This quadrant will be split in 4 and used by up to 4 shadow maps.
  218. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = ``3``
  221. This quadrant will be split 16 ways and used by up to 16 shadow maps.
  222. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = ``4``
  225. This quadrant will be split 64 ways and used by up to 64 shadow maps.
  226. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = ``5``
  229. 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.
  230. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = ``6``
  233. 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.
  234. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = ``7``
  237. Represents the size of the :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` enum.
  238. .. rst-class:: classref-item-separator
  239. ----
  240. .. _enum_Viewport_Scaling3DMode:
  241. .. rst-class:: classref-enumeration
  242. enum **Scaling3DMode**:
  243. .. _class_Viewport_constant_SCALING_3D_MODE_BILINEAR:
  244. .. rst-class:: classref-enumeration-constant
  245. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_BILINEAR** = ``0``
  246. 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 than ``1.0`` will result in undersampling while values greater than ``1.0`` will result in supersampling. A value of ``1.0`` disables scaling.
  247. .. _class_Viewport_constant_SCALING_3D_MODE_FSR:
  248. .. rst-class:: classref-enumeration-constant
  249. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_FSR** = ``1``
  250. 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 than ``1.0`` will be result in the viewport being upscaled using FSR. Values greater than ``1.0`` are not supported and bilinear downsampling will be used instead. A value of ``1.0`` disables scaling.
  251. .. _class_Viewport_constant_SCALING_3D_MODE_MAX:
  252. .. rst-class:: classref-enumeration-constant
  253. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **SCALING_3D_MODE_MAX** = ``2``
  254. Represents the size of the :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` enum.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _enum_Viewport_MSAA:
  258. .. rst-class:: classref-enumeration
  259. enum **MSAA**:
  260. .. _class_Viewport_constant_MSAA_DISABLED:
  261. .. rst-class:: classref-enumeration-constant
  262. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_DISABLED** = ``0``
  263. Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.
  264. .. _class_Viewport_constant_MSAA_2X:
  265. .. rst-class:: classref-enumeration-constant
  266. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_2X** = ``1``
  267. Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better.
  268. .. _class_Viewport_constant_MSAA_4X:
  269. .. rst-class:: classref-enumeration-constant
  270. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_4X** = ``2``
  271. Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality.
  272. .. _class_Viewport_constant_MSAA_8X:
  273. .. rst-class:: classref-enumeration-constant
  274. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_8X** = ``3``
  275. 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.
  276. .. _class_Viewport_constant_MSAA_MAX:
  277. .. rst-class:: classref-enumeration-constant
  278. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_MAX** = ``4``
  279. Represents the size of the :ref:`MSAA<enum_Viewport_MSAA>` enum.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _enum_Viewport_ScreenSpaceAA:
  283. .. rst-class:: classref-enumeration
  284. enum **ScreenSpaceAA**:
  285. .. _class_Viewport_constant_SCREEN_SPACE_AA_DISABLED:
  286. .. rst-class:: classref-enumeration-constant
  287. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_DISABLED** = ``0``
  288. Do not perform any antialiasing in the full screen post-process.
  289. .. _class_Viewport_constant_SCREEN_SPACE_AA_FXAA:
  290. .. rst-class:: classref-enumeration-constant
  291. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_FXAA** = ``1``
  292. 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.
  293. .. _class_Viewport_constant_SCREEN_SPACE_AA_MAX:
  294. .. rst-class:: classref-enumeration-constant
  295. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **SCREEN_SPACE_AA_MAX** = ``2``
  296. Represents the size of the :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` enum.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _enum_Viewport_RenderInfo:
  300. .. rst-class:: classref-enumeration
  301. enum **RenderInfo**:
  302. .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
  303. .. rst-class:: classref-enumeration-constant
  304. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_OBJECTS_IN_FRAME** = ``0``
  305. Amount of objects in frame.
  306. .. _class_Viewport_constant_RENDER_INFO_PRIMITIVES_IN_FRAME:
  307. .. rst-class:: classref-enumeration-constant
  308. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_PRIMITIVES_IN_FRAME** = ``1``
  309. Amount of vertices in frame.
  310. .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
  311. .. rst-class:: classref-enumeration-constant
  312. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_DRAW_CALLS_IN_FRAME** = ``2``
  313. Amount of draw calls in frame.
  314. .. _class_Viewport_constant_RENDER_INFO_MAX:
  315. .. rst-class:: classref-enumeration-constant
  316. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MAX** = ``3``
  317. Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _enum_Viewport_RenderInfoType:
  321. .. rst-class:: classref-enumeration
  322. enum **RenderInfoType**:
  323. .. _class_Viewport_constant_RENDER_INFO_TYPE_VISIBLE:
  324. .. rst-class:: classref-enumeration-constant
  325. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_VISIBLE** = ``0``
  326. .. _class_Viewport_constant_RENDER_INFO_TYPE_SHADOW:
  327. .. rst-class:: classref-enumeration-constant
  328. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_SHADOW** = ``1``
  329. .. _class_Viewport_constant_RENDER_INFO_TYPE_MAX:
  330. .. rst-class:: classref-enumeration-constant
  331. :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` **RENDER_INFO_TYPE_MAX** = ``2``
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _enum_Viewport_DebugDraw:
  335. .. rst-class:: classref-enumeration
  336. enum **DebugDraw**:
  337. .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
  338. .. rst-class:: classref-enumeration-constant
  339. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLED** = ``0``
  340. Objects are displayed normally.
  341. .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
  342. .. rst-class:: classref-enumeration-constant
  343. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_UNSHADED** = ``1``
  344. Objects are displayed without light information.
  345. .. _class_Viewport_constant_DEBUG_DRAW_LIGHTING:
  346. .. rst-class:: classref-enumeration-constant
  347. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_LIGHTING** = ``2``
  348. .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
  349. .. rst-class:: classref-enumeration-constant
  350. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OVERDRAW** = ``3``
  351. 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.
  352. .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
  353. .. rst-class:: classref-enumeration-constant
  354. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_WIREFRAME** = ``4``
  355. Objects are displayed in wireframe style.
  356. .. _class_Viewport_constant_DEBUG_DRAW_NORMAL_BUFFER:
  357. .. rst-class:: classref-enumeration-constant
  358. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_NORMAL_BUFFER** = ``5``
  359. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_ALBEDO:
  360. .. rst-class:: classref-enumeration-constant
  361. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_ALBEDO** = ``6``
  362. Objects are displayed with only the albedo value from :ref:`VoxelGI<class_VoxelGI>`\ s.
  363. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_LIGHTING:
  364. .. rst-class:: classref-enumeration-constant
  365. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_LIGHTING** = ``7``
  366. Objects are displayed with only the lighting value from :ref:`VoxelGI<class_VoxelGI>`\ s.
  367. .. _class_Viewport_constant_DEBUG_DRAW_VOXEL_GI_EMISSION:
  368. .. rst-class:: classref-enumeration-constant
  369. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_VOXEL_GI_EMISSION** = ``8``
  370. Objects are displayed with only the emission color from :ref:`VoxelGI<class_VoxelGI>`\ s.
  371. .. _class_Viewport_constant_DEBUG_DRAW_SHADOW_ATLAS:
  372. .. rst-class:: classref-enumeration-constant
  373. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SHADOW_ATLAS** = ``9``
  374. 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**.
  375. .. _class_Viewport_constant_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS:
  376. .. rst-class:: classref-enumeration-constant
  377. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS** = ``10``
  378. Draws the shadow atlas that stores shadows from :ref:`DirectionalLight3D<class_DirectionalLight3D>`\ s in the upper left quadrant of the **Viewport**.
  379. .. _class_Viewport_constant_DEBUG_DRAW_SCENE_LUMINANCE:
  380. .. rst-class:: classref-enumeration-constant
  381. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SCENE_LUMINANCE** = ``11``
  382. .. _class_Viewport_constant_DEBUG_DRAW_SSAO:
  383. .. rst-class:: classref-enumeration-constant
  384. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SSAO** = ``12``
  385. 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>`.
  386. .. _class_Viewport_constant_DEBUG_DRAW_SSIL:
  387. .. rst-class:: classref-enumeration-constant
  388. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SSIL** = ``13``
  389. 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>`.
  390. .. _class_Viewport_constant_DEBUG_DRAW_PSSM_SPLITS:
  391. .. rst-class:: classref-enumeration-constant
  392. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_PSSM_SPLITS** = ``14``
  393. 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.
  394. .. _class_Viewport_constant_DEBUG_DRAW_DECAL_ATLAS:
  395. .. rst-class:: classref-enumeration-constant
  396. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DECAL_ATLAS** = ``15``
  397. Draws the decal atlas used by :ref:`Decal<class_Decal>`\ s and light projector textures in the upper left quadrant of the **Viewport**.
  398. .. _class_Viewport_constant_DEBUG_DRAW_SDFGI:
  399. .. rst-class:: classref-enumeration-constant
  400. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SDFGI** = ``16``
  401. .. _class_Viewport_constant_DEBUG_DRAW_SDFGI_PROBES:
  402. .. rst-class:: classref-enumeration-constant
  403. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_SDFGI_PROBES** = ``17``
  404. .. _class_Viewport_constant_DEBUG_DRAW_GI_BUFFER:
  405. .. rst-class:: classref-enumeration-constant
  406. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_GI_BUFFER** = ``18``
  407. .. _class_Viewport_constant_DEBUG_DRAW_DISABLE_LOD:
  408. .. rst-class:: classref-enumeration-constant
  409. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLE_LOD** = ``19``
  410. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS:
  411. .. rst-class:: classref-enumeration-constant
  412. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_OMNI_LIGHTS** = ``20``
  413. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS:
  414. .. rst-class:: classref-enumeration-constant
  415. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_SPOT_LIGHTS** = ``21``
  416. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_DECALS:
  417. .. rst-class:: classref-enumeration-constant
  418. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_DECALS** = ``22``
  419. .. _class_Viewport_constant_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES:
  420. .. rst-class:: classref-enumeration-constant
  421. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_CLUSTER_REFLECTION_PROBES** = ``23``
  422. .. _class_Viewport_constant_DEBUG_DRAW_OCCLUDERS:
  423. .. rst-class:: classref-enumeration-constant
  424. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OCCLUDERS** = ``24``
  425. .. _class_Viewport_constant_DEBUG_DRAW_MOTION_VECTORS:
  426. .. rst-class:: classref-enumeration-constant
  427. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_MOTION_VECTORS** = ``25``
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _enum_Viewport_DefaultCanvasItemTextureFilter:
  431. .. rst-class:: classref-enumeration
  432. enum **DefaultCanvasItemTextureFilter**:
  433. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
  434. .. rst-class:: classref-enumeration-constant
  435. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST** = ``0``
  436. The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled).
  437. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
  438. .. rst-class:: classref-enumeration-constant
  439. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR** = ``1``
  440. The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled).
  441. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
  442. .. rst-class:: classref-enumeration-constant
  443. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS** = ``2``
  444. The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``). This makes the texture look smooth from up close, and smooth from a distance.
  445. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to :ref:`Camera2D<class_Camera2D>` zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.
  446. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
  447. .. rst-class:: classref-enumeration-constant
  448. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS** = ``3``
  449. The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``). This makes the texture look pixelated from up close, and smooth from a distance.
  450. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to :ref:`Camera2D<class_Camera2D>` zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.
  451. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX:
  452. .. rst-class:: classref-enumeration-constant
  453. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX** = ``4``
  454. Max value for :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` enum.
  455. .. rst-class:: classref-item-separator
  456. ----
  457. .. _enum_Viewport_DefaultCanvasItemTextureRepeat:
  458. .. rst-class:: classref-enumeration
  459. enum **DefaultCanvasItemTextureRepeat**:
  460. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
  461. .. rst-class:: classref-enumeration-constant
  462. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED** = ``0``
  463. 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.
  464. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
  465. .. rst-class:: classref-enumeration-constant
  466. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED** = ``1``
  467. 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.
  468. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
  469. .. rst-class:: classref-enumeration-constant
  470. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR** = ``2``
  471. Flip the texture when repeating so that the edge lines up instead of abruptly changing.
  472. .. _class_Viewport_constant_DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX:
  473. .. rst-class:: classref-enumeration-constant
  474. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX** = ``3``
  475. Max value for :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` enum.
  476. .. rst-class:: classref-item-separator
  477. ----
  478. .. _enum_Viewport_SDFOversize:
  479. .. rst-class:: classref-enumeration
  480. enum **SDFOversize**:
  481. .. _class_Viewport_constant_SDF_OVERSIZE_100_PERCENT:
  482. .. rst-class:: classref-enumeration-constant
  483. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_100_PERCENT** = ``0``
  484. .. _class_Viewport_constant_SDF_OVERSIZE_120_PERCENT:
  485. .. rst-class:: classref-enumeration-constant
  486. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_120_PERCENT** = ``1``
  487. .. _class_Viewport_constant_SDF_OVERSIZE_150_PERCENT:
  488. .. rst-class:: classref-enumeration-constant
  489. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_150_PERCENT** = ``2``
  490. .. _class_Viewport_constant_SDF_OVERSIZE_200_PERCENT:
  491. .. rst-class:: classref-enumeration-constant
  492. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_200_PERCENT** = ``3``
  493. .. _class_Viewport_constant_SDF_OVERSIZE_MAX:
  494. .. rst-class:: classref-enumeration-constant
  495. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **SDF_OVERSIZE_MAX** = ``4``
  496. .. rst-class:: classref-item-separator
  497. ----
  498. .. _enum_Viewport_SDFScale:
  499. .. rst-class:: classref-enumeration
  500. enum **SDFScale**:
  501. .. _class_Viewport_constant_SDF_SCALE_100_PERCENT:
  502. .. rst-class:: classref-enumeration-constant
  503. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_100_PERCENT** = ``0``
  504. .. _class_Viewport_constant_SDF_SCALE_50_PERCENT:
  505. .. rst-class:: classref-enumeration-constant
  506. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_50_PERCENT** = ``1``
  507. .. _class_Viewport_constant_SDF_SCALE_25_PERCENT:
  508. .. rst-class:: classref-enumeration-constant
  509. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_25_PERCENT** = ``2``
  510. .. _class_Viewport_constant_SDF_SCALE_MAX:
  511. .. rst-class:: classref-enumeration-constant
  512. :ref:`SDFScale<enum_Viewport_SDFScale>` **SDF_SCALE_MAX** = ``3``
  513. .. rst-class:: classref-item-separator
  514. ----
  515. .. _enum_Viewport_VRSMode:
  516. .. rst-class:: classref-enumeration
  517. enum **VRSMode**:
  518. .. _class_Viewport_constant_VRS_DISABLED:
  519. .. rst-class:: classref-enumeration-constant
  520. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_DISABLED** = ``0``
  521. VRS is disabled.
  522. .. _class_Viewport_constant_VRS_TEXTURE:
  523. .. rst-class:: classref-enumeration-constant
  524. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_TEXTURE** = ``1``
  525. VRS uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view.
  526. .. _class_Viewport_constant_VRS_XR:
  527. .. rst-class:: classref-enumeration-constant
  528. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_XR** = ``2``
  529. VRS texture is supplied by the primary :ref:`XRInterface<class_XRInterface>`.
  530. .. _class_Viewport_constant_VRS_MAX:
  531. .. rst-class:: classref-enumeration-constant
  532. :ref:`VRSMode<enum_Viewport_VRSMode>` **VRS_MAX** = ``3``
  533. Represents the size of the :ref:`VRSMode<enum_Viewport_VRSMode>` enum.
  534. .. rst-class:: classref-section-separator
  535. ----
  536. .. rst-class:: classref-descriptions-group
  537. Property Descriptions
  538. ---------------------
  539. .. _class_Viewport_property_audio_listener_enable_2d:
  540. .. rst-class:: classref-property
  541. :ref:`bool<class_bool>` **audio_listener_enable_2d** = ``false``
  542. .. rst-class:: classref-property-setget
  543. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` value **)**
  544. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)**
  545. If ``true``, the viewport will process 2D audio streams.
  546. .. rst-class:: classref-item-separator
  547. ----
  548. .. _class_Viewport_property_audio_listener_enable_3d:
  549. .. rst-class:: classref-property
  550. :ref:`bool<class_bool>` **audio_listener_enable_3d** = ``false``
  551. .. rst-class:: classref-property-setget
  552. - void **set_as_audio_listener_3d** **(** :ref:`bool<class_bool>` value **)**
  553. - :ref:`bool<class_bool>` **is_audio_listener_3d** **(** **)**
  554. If ``true``, the viewport will process 3D audio streams.
  555. .. rst-class:: classref-item-separator
  556. ----
  557. .. _class_Viewport_property_canvas_cull_mask:
  558. .. rst-class:: classref-property
  559. :ref:`int<class_int>` **canvas_cull_mask** = ``4294967295``
  560. .. rst-class:: classref-property-setget
  561. - void **set_canvas_cull_mask** **(** :ref:`int<class_int>` value **)**
  562. - :ref:`int<class_int>` **get_canvas_cull_mask** **(** **)**
  563. The rendering layers in which this **Viewport** renders :ref:`CanvasItem<class_CanvasItem>` nodes.
  564. .. rst-class:: classref-item-separator
  565. ----
  566. .. _class_Viewport_property_canvas_item_default_texture_filter:
  567. .. rst-class:: classref-property
  568. :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **canvas_item_default_texture_filter** = ``1``
  569. .. rst-class:: classref-property-setget
  570. - void **set_default_canvas_item_texture_filter** **(** :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` value **)**
  571. - :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` **get_default_canvas_item_texture_filter** **(** **)**
  572. Sets the default filter mode used by :ref:`CanvasItem<class_CanvasItem>`\ s in this Viewport. See :ref:`DefaultCanvasItemTextureFilter<enum_Viewport_DefaultCanvasItemTextureFilter>` for options.
  573. .. rst-class:: classref-item-separator
  574. ----
  575. .. _class_Viewport_property_canvas_item_default_texture_repeat:
  576. .. rst-class:: classref-property
  577. :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **canvas_item_default_texture_repeat** = ``0``
  578. .. rst-class:: classref-property-setget
  579. - void **set_default_canvas_item_texture_repeat** **(** :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` value **)**
  580. - :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` **get_default_canvas_item_texture_repeat** **(** **)**
  581. Sets the default repeat mode used by :ref:`CanvasItem<class_CanvasItem>`\ s in this Viewport. See :ref:`DefaultCanvasItemTextureRepeat<enum_Viewport_DefaultCanvasItemTextureRepeat>` for options.
  582. .. rst-class:: classref-item-separator
  583. ----
  584. .. _class_Viewport_property_canvas_transform:
  585. .. rst-class:: classref-property
  586. :ref:`Transform2D<class_Transform2D>` **canvas_transform**
  587. .. rst-class:: classref-property-setget
  588. - void **set_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  589. - :ref:`Transform2D<class_Transform2D>` **get_canvas_transform** **(** **)**
  590. 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.
  591. .. rst-class:: classref-item-separator
  592. ----
  593. .. _class_Viewport_property_debug_draw:
  594. .. rst-class:: classref-property
  595. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw** = ``0``
  596. .. rst-class:: classref-property-setget
  597. - void **set_debug_draw** **(** :ref:`DebugDraw<enum_Viewport_DebugDraw>` value **)**
  598. - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **get_debug_draw** **(** **)**
  599. The overlay mode for test rendered geometry in debug purposes.
  600. .. rst-class:: classref-item-separator
  601. ----
  602. .. _class_Viewport_property_disable_3d:
  603. .. rst-class:: classref-property
  604. :ref:`bool<class_bool>` **disable_3d** = ``false``
  605. .. rst-class:: classref-property-setget
  606. - void **set_disable_3d** **(** :ref:`bool<class_bool>` value **)**
  607. - :ref:`bool<class_bool>` **is_3d_disabled** **(** **)**
  608. Disable 3D rendering (but keep 2D rendering).
  609. .. rst-class:: classref-item-separator
  610. ----
  611. .. _class_Viewport_property_fsr_sharpness:
  612. .. rst-class:: classref-property
  613. :ref:`float<class_float>` **fsr_sharpness** = ``0.2``
  614. .. rst-class:: classref-property-setget
  615. - void **set_fsr_sharpness** **(** :ref:`float<class_float>` value **)**
  616. - :ref:`float<class_float>` **get_fsr_sharpness** **(** **)**
  617. 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.
  618. 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.
  619. .. rst-class:: classref-item-separator
  620. ----
  621. .. _class_Viewport_property_global_canvas_transform:
  622. .. rst-class:: classref-property
  623. :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
  624. .. rst-class:: classref-property-setget
  625. - void **set_global_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  626. - :ref:`Transform2D<class_Transform2D>` **get_global_canvas_transform** **(** **)**
  627. The global canvas transform of the viewport. The canvas transform is relative to this.
  628. .. rst-class:: classref-item-separator
  629. ----
  630. .. _class_Viewport_property_gui_disable_input:
  631. .. rst-class:: classref-property
  632. :ref:`bool<class_bool>` **gui_disable_input** = ``false``
  633. .. rst-class:: classref-property-setget
  634. - void **set_disable_input** **(** :ref:`bool<class_bool>` value **)**
  635. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)**
  636. If ``true``, the viewport will not receive input events.
  637. .. rst-class:: classref-item-separator
  638. ----
  639. .. _class_Viewport_property_gui_embed_subwindows:
  640. .. rst-class:: classref-property
  641. :ref:`bool<class_bool>` **gui_embed_subwindows** = ``false``
  642. .. rst-class:: classref-property-setget
  643. - void **set_embedding_subwindows** **(** :ref:`bool<class_bool>` value **)**
  644. - :ref:`bool<class_bool>` **is_embedding_subwindows** **(** **)**
  645. 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.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_Viewport_property_gui_snap_controls_to_pixels:
  649. .. rst-class:: classref-property
  650. :ref:`bool<class_bool>` **gui_snap_controls_to_pixels** = ``true``
  651. .. rst-class:: classref-property-setget
  652. - void **set_snap_controls_to_pixels** **(** :ref:`bool<class_bool>` value **)**
  653. - :ref:`bool<class_bool>` **is_snap_controls_to_pixels_enabled** **(** **)**
  654. If ``true``, the GUI controls on the viewport will lay pixel perfectly.
  655. .. rst-class:: classref-item-separator
  656. ----
  657. .. _class_Viewport_property_handle_input_locally:
  658. .. rst-class:: classref-property
  659. :ref:`bool<class_bool>` **handle_input_locally** = ``true``
  660. .. rst-class:: classref-property-setget
  661. - void **set_handle_input_locally** **(** :ref:`bool<class_bool>` value **)**
  662. - :ref:`bool<class_bool>` **is_handling_input_locally** **(** **)**
  663. If ``true``, this viewport will mark incoming input events as handled by itself. If ``false``, this is instead done by the first parent viewport that is set to handle input locally.
  664. A :ref:`SubViewportContainer<class_SubViewportContainer>` will automatically set this property to ``false`` for the **Viewport** contained inside of it.
  665. 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>`.
  666. .. rst-class:: classref-item-separator
  667. ----
  668. .. _class_Viewport_property_mesh_lod_threshold:
  669. .. rst-class:: classref-property
  670. :ref:`float<class_float>` **mesh_lod_threshold** = ``1.0``
  671. .. rst-class:: classref-property-setget
  672. - void **set_mesh_lod_threshold** **(** :ref:`float<class_float>` value **)**
  673. - :ref:`float<class_float>` **get_mesh_lod_threshold** **(** **)**
  674. 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.
  675. 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.
  676. \ **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).
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_Viewport_property_msaa_2d:
  680. .. rst-class:: classref-property
  681. :ref:`MSAA<enum_Viewport_MSAA>` **msaa_2d** = ``0``
  682. .. rst-class:: classref-property-setget
  683. - void **set_msaa_2d** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  684. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa_2d** **(** **)**
  685. 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.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_Viewport_property_msaa_3d:
  689. .. rst-class:: classref-property
  690. :ref:`MSAA<enum_Viewport_MSAA>` **msaa_3d** = ``0``
  691. .. rst-class:: classref-property-setget
  692. - void **set_msaa_3d** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  693. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa_3d** **(** **)**
  694. 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.
  695. .. rst-class:: classref-item-separator
  696. ----
  697. .. _class_Viewport_property_own_world_3d:
  698. .. rst-class:: classref-property
  699. :ref:`bool<class_bool>` **own_world_3d** = ``false``
  700. .. rst-class:: classref-property-setget
  701. - void **set_use_own_world_3d** **(** :ref:`bool<class_bool>` value **)**
  702. - :ref:`bool<class_bool>` **is_using_own_world_3d** **(** **)**
  703. 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>`.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_Viewport_property_physics_object_picking:
  707. .. rst-class:: classref-property
  708. :ref:`bool<class_bool>` **physics_object_picking** = ``false``
  709. .. rst-class:: classref-property-setget
  710. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` value **)**
  711. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  712. If ``true``, the objects rendered by viewport become subjects of mouse picking process.
  713. \ **Note:** The number of simultaneously pickable objects is limited to 64 and they are selected in a non-deterministic order, which can be different in each picking process.
  714. .. rst-class:: classref-item-separator
  715. ----
  716. .. _class_Viewport_property_physics_object_picking_sort:
  717. .. rst-class:: classref-property
  718. :ref:`bool<class_bool>` **physics_object_picking_sort** = ``false``
  719. .. rst-class:: classref-property-setget
  720. - void **set_physics_object_picking_sort** **(** :ref:`bool<class_bool>` value **)**
  721. - :ref:`bool<class_bool>` **get_physics_object_picking_sort** **(** **)**
  722. If ``true``, objects receive mouse picking events sorted primarily by their :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` and secondarily by their position in the scene tree. If ``false``, the order is undetermined.
  723. \ **Note:** This setting is disabled by default because of its potential expensive computational cost.
  724. \ **Note:** Sorting happens after selecting the pickable objects. Because of the limitation of 64 simultaneously pickable objects, it is not guaranteed that the object with the highest :ref:`CanvasItem.z_index<class_CanvasItem_property_z_index>` receives the picking event.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_Viewport_property_positional_shadow_atlas_16_bits:
  728. .. rst-class:: classref-property
  729. :ref:`bool<class_bool>` **positional_shadow_atlas_16_bits** = ``true``
  730. .. rst-class:: classref-property-setget
  731. - void **set_positional_shadow_atlas_16_bits** **(** :ref:`bool<class_bool>` value **)**
  732. - :ref:`bool<class_bool>` **get_positional_shadow_atlas_16_bits** **(** **)**
  733. Use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices.
  734. .. rst-class:: classref-item-separator
  735. ----
  736. .. _class_Viewport_property_positional_shadow_atlas_quad_0:
  737. .. rst-class:: classref-property
  738. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_0** = ``2``
  739. .. rst-class:: classref-property-setget
  740. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  741. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  742. The subdivision amount of the first quadrant on the shadow atlas.
  743. .. rst-class:: classref-item-separator
  744. ----
  745. .. _class_Viewport_property_positional_shadow_atlas_quad_1:
  746. .. rst-class:: classref-property
  747. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_1** = ``2``
  748. .. rst-class:: classref-property-setget
  749. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  750. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  751. The subdivision amount of the second quadrant on the shadow atlas.
  752. .. rst-class:: classref-item-separator
  753. ----
  754. .. _class_Viewport_property_positional_shadow_atlas_quad_2:
  755. .. rst-class:: classref-property
  756. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_2** = ``3``
  757. .. rst-class:: classref-property-setget
  758. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  759. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  760. The subdivision amount of the third quadrant on the shadow atlas.
  761. .. rst-class:: classref-item-separator
  762. ----
  763. .. _class_Viewport_property_positional_shadow_atlas_quad_3:
  764. .. rst-class:: classref-property
  765. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **positional_shadow_atlas_quad_3** = ``4``
  766. .. rst-class:: classref-property-setget
  767. - void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  768. - :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  769. The subdivision amount of the fourth quadrant on the shadow atlas.
  770. .. rst-class:: classref-item-separator
  771. ----
  772. .. _class_Viewport_property_positional_shadow_atlas_size:
  773. .. rst-class:: classref-property
  774. :ref:`int<class_int>` **positional_shadow_atlas_size** = ``2048``
  775. .. rst-class:: classref-property-setget
  776. - void **set_positional_shadow_atlas_size** **(** :ref:`int<class_int>` value **)**
  777. - :ref:`int<class_int>` **get_positional_shadow_atlas_size** **(** **)**
  778. The shadow atlas' resolution (used for omni and spot lights). The value is rounded up to the nearest power of 2.
  779. \ **Note:** If this is set to ``0``, no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows).
  780. .. rst-class:: classref-item-separator
  781. ----
  782. .. _class_Viewport_property_scaling_3d_mode:
  783. .. rst-class:: classref-property
  784. :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **scaling_3d_mode** = ``0``
  785. .. rst-class:: classref-property-setget
  786. - void **set_scaling_3d_mode** **(** :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` value **)**
  787. - :ref:`Scaling3DMode<enum_Viewport_Scaling3DMode>` **get_scaling_3d_mode** **(** **)**
  788. 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.
  789. 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.
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_Viewport_property_scaling_3d_scale:
  793. .. rst-class:: classref-property
  794. :ref:`float<class_float>` **scaling_3d_scale** = ``1.0``
  795. .. rst-class:: classref-property-setget
  796. - void **set_scaling_3d_scale** **(** :ref:`float<class_float>` value **)**
  797. - :ref:`float<class_float>` **get_scaling_3d_scale** **(** **)**
  798. 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.
  799. 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.
  800. 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.
  801. .. rst-class:: classref-item-separator
  802. ----
  803. .. _class_Viewport_property_screen_space_aa:
  804. .. rst-class:: classref-property
  805. :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **screen_space_aa** = ``0``
  806. .. rst-class:: classref-property-setget
  807. - void **set_screen_space_aa** **(** :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` value **)**
  808. - :ref:`ScreenSpaceAA<enum_Viewport_ScreenSpaceAA>` **get_screen_space_aa** **(** **)**
  809. 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.
  810. .. rst-class:: classref-item-separator
  811. ----
  812. .. _class_Viewport_property_sdf_oversize:
  813. .. rst-class:: classref-property
  814. :ref:`SDFOversize<enum_Viewport_SDFOversize>` **sdf_oversize** = ``1``
  815. .. rst-class:: classref-property-setget
  816. - void **set_sdf_oversize** **(** :ref:`SDFOversize<enum_Viewport_SDFOversize>` value **)**
  817. - :ref:`SDFOversize<enum_Viewport_SDFOversize>` **get_sdf_oversize** **(** **)**
  818. .. container:: contribute
  819. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  820. .. rst-class:: classref-item-separator
  821. ----
  822. .. _class_Viewport_property_sdf_scale:
  823. .. rst-class:: classref-property
  824. :ref:`SDFScale<enum_Viewport_SDFScale>` **sdf_scale** = ``1``
  825. .. rst-class:: classref-property-setget
  826. - void **set_sdf_scale** **(** :ref:`SDFScale<enum_Viewport_SDFScale>` value **)**
  827. - :ref:`SDFScale<enum_Viewport_SDFScale>` **get_sdf_scale** **(** **)**
  828. .. container:: contribute
  829. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  830. .. rst-class:: classref-item-separator
  831. ----
  832. .. _class_Viewport_property_snap_2d_transforms_to_pixel:
  833. .. rst-class:: classref-property
  834. :ref:`bool<class_bool>` **snap_2d_transforms_to_pixel** = ``false``
  835. .. rst-class:: classref-property-setget
  836. - void **set_snap_2d_transforms_to_pixel** **(** :ref:`bool<class_bool>` value **)**
  837. - :ref:`bool<class_bool>` **is_snap_2d_transforms_to_pixel_enabled** **(** **)**
  838. .. container:: contribute
  839. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  840. .. rst-class:: classref-item-separator
  841. ----
  842. .. _class_Viewport_property_snap_2d_vertices_to_pixel:
  843. .. rst-class:: classref-property
  844. :ref:`bool<class_bool>` **snap_2d_vertices_to_pixel** = ``false``
  845. .. rst-class:: classref-property-setget
  846. - void **set_snap_2d_vertices_to_pixel** **(** :ref:`bool<class_bool>` value **)**
  847. - :ref:`bool<class_bool>` **is_snap_2d_vertices_to_pixel_enabled** **(** **)**
  848. .. container:: contribute
  849. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  850. .. rst-class:: classref-item-separator
  851. ----
  852. .. _class_Viewport_property_texture_mipmap_bias:
  853. .. rst-class:: classref-property
  854. :ref:`float<class_float>` **texture_mipmap_bias** = ``0.0``
  855. .. rst-class:: classref-property-setget
  856. - void **set_texture_mipmap_bias** **(** :ref:`float<class_float>` value **)**
  857. - :ref:`float<class_float>` **get_texture_mipmap_bias** **(** **)**
  858. 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).
  859. 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 enabled at the same time, an offset of ``-0.75`` is applied to this value.
  860. \ **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``.
  861. 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.
  862. .. rst-class:: classref-item-separator
  863. ----
  864. .. _class_Viewport_property_transparent_bg:
  865. .. rst-class:: classref-property
  866. :ref:`bool<class_bool>` **transparent_bg** = ``false``
  867. .. rst-class:: classref-property-setget
  868. - void **set_transparent_background** **(** :ref:`bool<class_bool>` value **)**
  869. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)**
  870. If ``true``, the viewport should render its background as transparent.
  871. .. rst-class:: classref-item-separator
  872. ----
  873. .. _class_Viewport_property_use_debanding:
  874. .. rst-class:: classref-property
  875. :ref:`bool<class_bool>` **use_debanding** = ``false``
  876. .. rst-class:: classref-property-setget
  877. - void **set_use_debanding** **(** :ref:`bool<class_bool>` value **)**
  878. - :ref:`bool<class_bool>` **is_using_debanding** **(** **)**
  879. 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>`.
  880. 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.
  881. .. rst-class:: classref-item-separator
  882. ----
  883. .. _class_Viewport_property_use_occlusion_culling:
  884. .. rst-class:: classref-property
  885. :ref:`bool<class_bool>` **use_occlusion_culling** = ``false``
  886. .. rst-class:: classref-property-setget
  887. - void **set_use_occlusion_culling** **(** :ref:`bool<class_bool>` value **)**
  888. - :ref:`bool<class_bool>` **is_using_occlusion_culling** **(** **)**
  889. 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.
  890. \ **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.
  891. \ **Note:** Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with ``module_raycast_enabled=yes``.
  892. .. rst-class:: classref-item-separator
  893. ----
  894. .. _class_Viewport_property_use_taa:
  895. .. rst-class:: classref-property
  896. :ref:`bool<class_bool>` **use_taa** = ``false``
  897. .. rst-class:: classref-property-setget
  898. - void **set_use_taa** **(** :ref:`bool<class_bool>` value **)**
  899. - :ref:`bool<class_bool>` **is_using_taa** **(** **)**
  900. 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.
  901. \ **Note:** The implementation is not complete yet, some visual instances such as particles and skinned meshes may show artifacts.
  902. .. rst-class:: classref-item-separator
  903. ----
  904. .. _class_Viewport_property_use_xr:
  905. .. rst-class:: classref-property
  906. :ref:`bool<class_bool>` **use_xr** = ``false``
  907. .. rst-class:: classref-property-setget
  908. - void **set_use_xr** **(** :ref:`bool<class_bool>` value **)**
  909. - :ref:`bool<class_bool>` **is_using_xr** **(** **)**
  910. 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.
  911. .. rst-class:: classref-item-separator
  912. ----
  913. .. _class_Viewport_property_vrs_mode:
  914. .. rst-class:: classref-property
  915. :ref:`VRSMode<enum_Viewport_VRSMode>` **vrs_mode** = ``0``
  916. .. rst-class:: classref-property-setget
  917. - void **set_vrs_mode** **(** :ref:`VRSMode<enum_Viewport_VRSMode>` value **)**
  918. - :ref:`VRSMode<enum_Viewport_VRSMode>` **get_vrs_mode** **(** **)**
  919. The Variable Rate Shading (VRS) mode that is used for this viewport. Note, if hardware does not support VRS this property is ignored.
  920. .. rst-class:: classref-item-separator
  921. ----
  922. .. _class_Viewport_property_vrs_texture:
  923. .. rst-class:: classref-property
  924. :ref:`Texture2D<class_Texture2D>` **vrs_texture**
  925. .. rst-class:: classref-property-setget
  926. - void **set_vrs_texture** **(** :ref:`Texture2D<class_Texture2D>` value **)**
  927. - :ref:`Texture2D<class_Texture2D>` **get_vrs_texture** **(** **)**
  928. Texture to use when :ref:`vrs_mode<class_Viewport_property_vrs_mode>` is set to :ref:`VRS_TEXTURE<class_Viewport_constant_VRS_TEXTURE>`.
  929. 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:
  930. ::
  931. - 1x1 = rgb(0, 0, 0) - #000000
  932. - 1x2 = rgb(0, 85, 0) - #005500
  933. - 2x1 = rgb(85, 0, 0) - #550000
  934. - 2x2 = rgb(85, 85, 0) - #555500
  935. - 2x4 = rgb(85, 170, 0) - #55aa00
  936. - 4x2 = rgb(170, 85, 0) - #aa5500
  937. - 4x4 = rgb(170, 170, 0) - #aaaa00
  938. - 4x8 = rgb(170, 255, 0) - #aaff00 - Not supported on most hardware
  939. - 8x4 = rgb(255, 170, 0) - #ffaa00 - Not supported on most hardware
  940. - 8x8 = rgb(255, 255, 0) - #ffff00 - Not supported on most hardware
  941. .. rst-class:: classref-item-separator
  942. ----
  943. .. _class_Viewport_property_world_2d:
  944. .. rst-class:: classref-property
  945. :ref:`World2D<class_World2D>` **world_2d**
  946. .. rst-class:: classref-property-setget
  947. - void **set_world_2d** **(** :ref:`World2D<class_World2D>` value **)**
  948. - :ref:`World2D<class_World2D>` **get_world_2d** **(** **)**
  949. The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
  950. .. rst-class:: classref-item-separator
  951. ----
  952. .. _class_Viewport_property_world_3d:
  953. .. rst-class:: classref-property
  954. :ref:`World3D<class_World3D>` **world_3d**
  955. .. rst-class:: classref-property-setget
  956. - void **set_world_3d** **(** :ref:`World3D<class_World3D>` value **)**
  957. - :ref:`World3D<class_World3D>` **get_world_3d** **(** **)**
  958. The custom :ref:`World3D<class_World3D>` which can be used as 3D environment source.
  959. .. rst-class:: classref-section-separator
  960. ----
  961. .. rst-class:: classref-descriptions-group
  962. Method Descriptions
  963. -------------------
  964. .. _class_Viewport_method_find_world_2d:
  965. .. rst-class:: classref-method
  966. :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** |const|
  967. 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.
  968. .. rst-class:: classref-item-separator
  969. ----
  970. .. _class_Viewport_method_find_world_3d:
  971. .. rst-class:: classref-method
  972. :ref:`World3D<class_World3D>` **find_world_3d** **(** **)** |const|
  973. 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.
  974. .. rst-class:: classref-item-separator
  975. ----
  976. .. _class_Viewport_method_get_camera_2d:
  977. .. rst-class:: classref-method
  978. :ref:`Camera2D<class_Camera2D>` **get_camera_2d** **(** **)** |const|
  979. Returns the currently active 2D camera. Returns null if there are no active cameras.
  980. .. rst-class:: classref-item-separator
  981. ----
  982. .. _class_Viewport_method_get_camera_3d:
  983. .. rst-class:: classref-method
  984. :ref:`Camera3D<class_Camera3D>` **get_camera_3d** **(** **)** |const|
  985. Returns the currently active 3D camera.
  986. .. rst-class:: classref-item-separator
  987. ----
  988. .. _class_Viewport_method_get_canvas_cull_mask_bit:
  989. .. rst-class:: classref-method
  990. :ref:`bool<class_bool>` **get_canvas_cull_mask_bit** **(** :ref:`int<class_int>` layer **)** |const|
  991. Returns an individual bit on the rendering layer mask.
  992. .. rst-class:: classref-item-separator
  993. ----
  994. .. _class_Viewport_method_get_final_transform:
  995. .. rst-class:: classref-method
  996. :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** |const|
  997. Returns the transform from the viewport's coordinate system to the embedder's coordinate system.
  998. .. rst-class:: classref-item-separator
  999. ----
  1000. .. _class_Viewport_method_get_mouse_position:
  1001. .. rst-class:: classref-method
  1002. :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** |const|
  1003. Returns the mouse's position in this **Viewport** using the coordinate system of this **Viewport**.
  1004. .. rst-class:: classref-item-separator
  1005. ----
  1006. .. _class_Viewport_method_get_positional_shadow_atlas_quadrant_subdiv:
  1007. .. rst-class:: classref-method
  1008. :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` **get_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  1009. Returns the :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` of the specified quadrant.
  1010. .. rst-class:: classref-item-separator
  1011. ----
  1012. .. _class_Viewport_method_get_render_info:
  1013. .. rst-class:: classref-method
  1014. :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` type, :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
  1015. Returns rendering statistics of the given type. See :ref:`RenderInfoType<enum_Viewport_RenderInfoType>` and :ref:`RenderInfo<enum_Viewport_RenderInfo>` for options.
  1016. .. rst-class:: classref-item-separator
  1017. ----
  1018. .. _class_Viewport_method_get_screen_transform:
  1019. .. rst-class:: classref-method
  1020. :ref:`Transform2D<class_Transform2D>` **get_screen_transform** **(** **)** |const|
  1021. Returns the transform from the Viewport's coordinates to the screen coordinates of the containing window manager window.
  1022. .. rst-class:: classref-item-separator
  1023. ----
  1024. .. _class_Viewport_method_get_texture:
  1025. .. rst-class:: classref-method
  1026. :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** |const|
  1027. Returns the viewport's texture.
  1028. \ **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.
  1029. ::
  1030. func _ready():
  1031. await RenderingServer.frame_post_draw
  1032. $Viewport.get_texture().get_image().save_png("user://Screenshot.png")
  1033. .. rst-class:: classref-item-separator
  1034. ----
  1035. .. _class_Viewport_method_get_viewport_rid:
  1036. .. rst-class:: classref-method
  1037. :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** |const|
  1038. Returns the viewport's RID from the :ref:`RenderingServer<class_RenderingServer>`.
  1039. .. rst-class:: classref-item-separator
  1040. ----
  1041. .. _class_Viewport_method_get_visible_rect:
  1042. .. rst-class:: classref-method
  1043. :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** |const|
  1044. Returns the visible rectangle in global screen coordinates.
  1045. .. rst-class:: classref-item-separator
  1046. ----
  1047. .. _class_Viewport_method_gui_get_drag_data:
  1048. .. rst-class:: classref-method
  1049. :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** |const|
  1050. Returns the drag data from the GUI, that was previously returned by :ref:`Control._get_drag_data<class_Control_method__get_drag_data>`.
  1051. .. rst-class:: classref-item-separator
  1052. ----
  1053. .. _class_Viewport_method_gui_get_focus_owner:
  1054. .. rst-class:: classref-method
  1055. :ref:`Control<class_Control>` **gui_get_focus_owner** **(** **)** |const|
  1056. Returns the :ref:`Control<class_Control>` having the focus within this viewport. If no :ref:`Control<class_Control>` has the focus, returns null.
  1057. .. rst-class:: classref-item-separator
  1058. ----
  1059. .. _class_Viewport_method_gui_is_drag_successful:
  1060. .. rst-class:: classref-method
  1061. :ref:`bool<class_bool>` **gui_is_drag_successful** **(** **)** |const|
  1062. Returns ``true`` if the drag operation is successful.
  1063. .. rst-class:: classref-item-separator
  1064. ----
  1065. .. _class_Viewport_method_gui_is_dragging:
  1066. .. rst-class:: classref-method
  1067. :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** |const|
  1068. Returns ``true`` if the viewport is currently performing a drag operation.
  1069. 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.
  1070. .. rst-class:: classref-item-separator
  1071. ----
  1072. .. _class_Viewport_method_gui_release_focus:
  1073. .. rst-class:: classref-method
  1074. void **gui_release_focus** **(** **)**
  1075. 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.
  1076. .. rst-class:: classref-item-separator
  1077. ----
  1078. .. _class_Viewport_method_is_input_handled:
  1079. .. rst-class:: classref-method
  1080. :ref:`bool<class_bool>` **is_input_handled** **(** **)** |const|
  1081. 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>`.
  1082. 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.
  1083. 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.
  1084. .. rst-class:: classref-item-separator
  1085. ----
  1086. .. _class_Viewport_method_push_input:
  1087. .. rst-class:: classref-method
  1088. void **push_input** **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)**
  1089. 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.
  1090. 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.
  1091. 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>`.
  1092. Calling this method will propagate calls to child nodes for following methods in the given order:
  1093. - :ref:`Node._input<class_Node_method__input>`\
  1094. - :ref:`Control._gui_input<class_Control_method__gui_input>` for :ref:`Control<class_Control>` nodes
  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_push_text_input:
  1103. .. rst-class:: classref-method
  1104. void **push_text_input** **(** :ref:`String<class_String>` text **)**
  1105. Helper method which calls the ``set_text()`` method on the currently focused :ref:`Control<class_Control>`, provided that it is defined (e.g. if the focused Control is :ref:`Button<class_Button>` or :ref:`LineEdit<class_LineEdit>`).
  1106. .. rst-class:: classref-item-separator
  1107. ----
  1108. .. _class_Viewport_method_push_unhandled_input:
  1109. .. rst-class:: classref-method
  1110. void **push_unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` event, :ref:`bool<class_bool>` in_local_coords=false **)**
  1111. 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.
  1112. 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.
  1113. 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>`.
  1114. Calling this method will propagate calls to child nodes for following methods in the given order:
  1115. - :ref:`Node._shortcut_input<class_Node_method__shortcut_input>`\
  1116. - :ref:`Node._unhandled_input<class_Node_method__unhandled_input>`\
  1117. - :ref:`Node._unhandled_key_input<class_Node_method__unhandled_key_input>`\
  1118. 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.
  1119. 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.
  1120. \ **Note:** This method doesn't propagate input events to embedded :ref:`Window<class_Window>`\ s or :ref:`SubViewport<class_SubViewport>`\ s.
  1121. \ *Deprecated.* Use :ref:`push_input<class_Viewport_method_push_input>` instead.
  1122. .. rst-class:: classref-item-separator
  1123. ----
  1124. .. _class_Viewport_method_set_canvas_cull_mask_bit:
  1125. .. rst-class:: classref-method
  1126. void **set_canvas_cull_mask_bit** **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enable **)**
  1127. Set/clear individual bits on the rendering layer mask. This simplifies editing this **Viewport**'s layers.
  1128. .. rst-class:: classref-item-separator
  1129. ----
  1130. .. _class_Viewport_method_set_input_as_handled:
  1131. .. rst-class:: classref-method
  1132. void **set_input_as_handled** **(** **)**
  1133. Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
  1134. \ **Note:** This does not affect the methods in :ref:`Input<class_Input>`, only the way events are propagated.
  1135. .. rst-class:: classref-item-separator
  1136. ----
  1137. .. _class_Viewport_method_set_positional_shadow_atlas_quadrant_subdiv:
  1138. .. rst-class:: classref-method
  1139. void **set_positional_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`PositionalShadowAtlasQuadrantSubdiv<enum_Viewport_PositionalShadowAtlasQuadrantSubdiv>` subdiv **)**
  1140. 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.
  1141. .. rst-class:: classref-item-separator
  1142. ----
  1143. .. _class_Viewport_method_update_mouse_cursor_state:
  1144. .. rst-class:: classref-method
  1145. void **update_mouse_cursor_state** **(** **)**
  1146. Force instantly updating the display based on the current mouse cursor position. This includes updating the mouse cursor shape and sending necessary :ref:`Control.mouse_entered<class_Control_signal_mouse_entered>`, :ref:`CollisionObject2D.mouse_entered<class_CollisionObject2D_signal_mouse_entered>`, :ref:`CollisionObject3D.mouse_entered<class_CollisionObject3D_signal_mouse_entered>` and :ref:`Window.mouse_entered<class_Window_signal_mouse_entered>` signals and their respective ``mouse_exited`` counterparts.
  1147. .. rst-class:: classref-item-separator
  1148. ----
  1149. .. _class_Viewport_method_warp_mouse:
  1150. .. rst-class:: classref-method
  1151. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` position **)**
  1152. Moves the mouse pointer to the specified position in this **Viewport** using the coordinate system of this **Viewport**.
  1153. \ **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.
  1154. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1155. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1156. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1157. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1158. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1159. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1160. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`