class_viewport.rst 106 KB

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