class_viewport.rst 126 KB

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