class_viewport.rst 112 KB

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