diff --git a/.gitattributes b/.gitattributes index dfa988f58..561239540 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,3 +5,5 @@ *.glb filter=lfs diff=lfs merge=lfs -text *.occ filter=lfs diff=lfs merge=lfs -text *.dds filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text diff --git a/Terrain3D.vcxproj b/Terrain3D.vcxproj index 9e4759249..4d9da591c 100644 --- a/Terrain3D.vcxproj +++ b/Terrain3D.vcxproj @@ -186,6 +186,7 @@ + @@ -210,6 +211,7 @@ + diff --git a/doc/_static/video/nav_code_demo.mp4 b/doc/_static/video/nav_code_demo.mp4 new file mode 100644 index 000000000..2c15d9486 --- /dev/null +++ b/doc/_static/video/nav_code_demo.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60b878cc0f00de8a88eb7abc1bd1e8ae11a74550b56d12414e43ccbacf0d6c2b +size 2270067 diff --git a/doc/_static/video/nav_demo.mp4 b/doc/_static/video/nav_demo.mp4 new file mode 100644 index 000000000..4d9f29d3a --- /dev/null +++ b/doc/_static/video/nav_demo.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6fef283e0ade6ef5b713e8dceae42fe0b30a3e47433baa982ea275be4f0c7e7 +size 3136549 diff --git a/doc/_static/video/oc_demo.mp4 b/doc/_static/video/oc_demo.mp4 index f8033b093..1bf45a144 100644 Binary files a/doc/_static/video/oc_demo.mp4 and b/doc/_static/video/oc_demo.mp4 differ diff --git a/doc/api/class_terrain3d.rst b/doc/api/class_terrain3d.rst index fe46720b4..cff4c56a2 100644 --- a/doc/api/class_terrain3d.rst +++ b/doc/api/class_terrain3d.rst @@ -22,10 +22,6 @@ Properties .. table:: :widths: auto - +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ - | :ref:`int` | :ref:`clipmap_levels` | ``7`` | - +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ - | :ref:`int` | :ref:`clipmap_size` | ``48`` | +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ | :ref:`bool` | :ref:`collision_enabled` | ``true`` | +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ @@ -41,6 +37,10 @@ Properties +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ | :ref:`Terrain3DMaterial` | :ref:`material` | | +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ + | :ref:`int` | :ref:`mesh_lods` | ``7`` | + +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ + | :ref:`int` | :ref:`mesh_size` | ``48`` | + +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ | :ref:`ShadowCastingSetting` | :ref:`render_cast_shadows` | ``1`` | +---------------------------------------------------------------------------+----------------------------------------------------------------------------+-----------------+ | :ref:`float` | :ref:`render_cull_margin` | ``0.0`` | @@ -62,27 +62,29 @@ Methods .. table:: :widths: auto - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Mesh` | :ref:`bake_mesh` **(** :ref:`int` lod, :ref:`HeightFilter` filter **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Camera3D` | :ref:`get_camera` **(** **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Image` | :ref:`get_filled_image` **(** :ref:`Vector2i` size, :ref:`Color` color, :ref:`bool` create_mipmaps, :ref:`Format` format **)** |static| | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Vector3` | :ref:`get_intersection` **(** :ref:`Vector3` position, :ref:`Vector3` direction **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Vector2` | :ref:`get_min_max` **(** :ref:`Image` image **)** |static| | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`EditorPlugin` | :ref:`get_plugin` **(** **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Image` | :ref:`get_thumbnail` **(** :ref:`Image` image, :ref:`Vector2i` size=Vector2i(256, 256) **)** |static| | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_camera` **(** :ref:`Camera3D` camera **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_plugin` **(** :ref:`EditorPlugin` plugin **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`update_aabbs` **(** **)** | - +-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Mesh` | :ref:`bake_mesh` **(** :ref:`int` lod, :ref:`HeightFilter` filter **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`PackedVector3Array` | :ref:`generate_nav_mesh_source_geometry` **(** :ref:`AABB` global_aabb, :ref:`bool` require_nav=true **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Camera3D` | :ref:`get_camera` **(** **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Image` | :ref:`get_filled_image` **(** :ref:`Vector2i` size, :ref:`Color` color, :ref:`bool` create_mipmaps, :ref:`Format` format **)** |static| | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Vector3` | :ref:`get_intersection` **(** :ref:`Vector3` position, :ref:`Vector3` direction **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Vector2` | :ref:`get_min_max` **(** :ref:`Image` image **)** |static| | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`EditorPlugin` | :ref:`get_plugin` **(** **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Image` | :ref:`get_thumbnail` **(** :ref:`Image` image, :ref:`Vector2i` size=Vector2i(256, 256) **)** |static| | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_camera` **(** :ref:`Camera3D` camera **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_plugin` **(** :ref:`EditorPlugin` plugin **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`update_aabbs` **(** **)** | + +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -140,16 +142,16 @@ Signals Property Descriptions --------------------- -.. _class_Terrain3D_property_clipmap_levels: +.. _class_Terrain3D_property_collision_enabled: .. rst-class:: classref-property -:ref:`int` **clipmap_levels** = ``7`` +:ref:`bool` **collision_enabled** = ``true`` .. rst-class:: classref-property-setget -- void **set_clipmap_levels** **(** :ref:`int` value **)** -- :ref:`int` **get_clipmap_levels** **(** **)** +- void **set_collision_enabled** **(** :ref:`bool` value **)** +- :ref:`bool` **get_collision_enabled** **(** **)** .. container:: contribute @@ -159,16 +161,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_clipmap_size: +.. _class_Terrain3D_property_collision_layer: .. rst-class:: classref-property -:ref:`int` **clipmap_size** = ``48`` +:ref:`int` **collision_layer** = ``1`` .. rst-class:: classref-property-setget -- void **set_clipmap_size** **(** :ref:`int` value **)** -- :ref:`int` **get_clipmap_size** **(** **)** +- void **set_collision_layer** **(** :ref:`int` value **)** +- :ref:`int` **get_collision_layer** **(** **)** .. container:: contribute @@ -178,16 +180,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_collision_enabled: +.. _class_Terrain3D_property_collision_mask: .. rst-class:: classref-property -:ref:`bool` **collision_enabled** = ``true`` +:ref:`int` **collision_mask** = ``1`` .. rst-class:: classref-property-setget -- void **set_collision_enabled** **(** :ref:`bool` value **)** -- :ref:`bool` **get_collision_enabled** **(** **)** +- void **set_collision_mask** **(** :ref:`int` value **)** +- :ref:`int` **get_collision_mask** **(** **)** .. container:: contribute @@ -197,16 +199,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_collision_layer: +.. _class_Terrain3D_property_collision_priority: .. rst-class:: classref-property -:ref:`int` **collision_layer** = ``1`` +:ref:`float` **collision_priority** = ``1.0`` .. rst-class:: classref-property-setget -- void **set_collision_layer** **(** :ref:`int` value **)** -- :ref:`int` **get_collision_layer** **(** **)** +- void **set_collision_priority** **(** :ref:`float` value **)** +- :ref:`float` **get_collision_priority** **(** **)** .. container:: contribute @@ -216,16 +218,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_collision_mask: +.. _class_Terrain3D_property_debug_level: .. rst-class:: classref-property -:ref:`int` **collision_mask** = ``1`` +:ref:`int` **debug_level** = ``0`` .. rst-class:: classref-property-setget -- void **set_collision_mask** **(** :ref:`int` value **)** -- :ref:`int` **get_collision_mask** **(** **)** +- void **set_debug_level** **(** :ref:`int` value **)** +- :ref:`int` **get_debug_level** **(** **)** .. container:: contribute @@ -235,16 +237,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_collision_priority: +.. _class_Terrain3D_property_debug_show_collision: .. rst-class:: classref-property -:ref:`float` **collision_priority** = ``1.0`` +:ref:`bool` **debug_show_collision** = ``false`` .. rst-class:: classref-property-setget -- void **set_collision_priority** **(** :ref:`float` value **)** -- :ref:`float` **get_collision_priority** **(** **)** +- void **set_show_debug_collision** **(** :ref:`bool` value **)** +- :ref:`bool` **get_show_debug_collision** **(** **)** .. container:: contribute @@ -254,16 +256,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_debug_level: +.. _class_Terrain3D_property_material: .. rst-class:: classref-property -:ref:`int` **debug_level** = ``0`` +:ref:`Terrain3DMaterial` **material** .. rst-class:: classref-property-setget -- void **set_debug_level** **(** :ref:`int` value **)** -- :ref:`int` **get_debug_level** **(** **)** +- void **set_material** **(** :ref:`Terrain3DMaterial` value **)** +- :ref:`Terrain3DMaterial` **get_material** **(** **)** .. container:: contribute @@ -273,16 +275,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_debug_show_collision: +.. _class_Terrain3D_property_mesh_lods: .. rst-class:: classref-property -:ref:`bool` **debug_show_collision** = ``false`` +:ref:`int` **mesh_lods** = ``7`` .. rst-class:: classref-property-setget -- void **set_show_debug_collision** **(** :ref:`bool` value **)** -- :ref:`bool` **get_show_debug_collision** **(** **)** +- void **set_mesh_lods** **(** :ref:`int` value **)** +- :ref:`int` **get_mesh_lods** **(** **)** .. container:: contribute @@ -292,16 +294,16 @@ Property Descriptions ---- -.. _class_Terrain3D_property_material: +.. _class_Terrain3D_property_mesh_size: .. rst-class:: classref-property -:ref:`Terrain3DMaterial` **material** +:ref:`int` **mesh_size** = ``48`` .. rst-class:: classref-property-setget -- void **set_material** **(** :ref:`Terrain3DMaterial` value **)** -- :ref:`Terrain3DMaterial` **get_material** **(** **)** +- void **set_mesh_size** **(** :ref:`int` value **)** +- :ref:`int` **get_mesh_size** **(** **)** .. container:: contribute @@ -443,6 +445,20 @@ Method Descriptions ---- +.. _class_Terrain3D_method_generate_nav_mesh_source_geometry: + +.. rst-class:: classref-method + +:ref:`PackedVector3Array` **generate_nav_mesh_source_geometry** **(** :ref:`AABB` global_aabb, :ref:`bool` require_nav=true **)** + +.. container:: contribute + + There is currently no description for this method. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + .. _class_Terrain3D_method_get_camera: .. rst-class:: classref-method diff --git a/doc/api/class_terrain3dmaterial.rst b/doc/api/class_terrain3dmaterial.rst index e01a2ad47..a12472fce 100644 --- a/doc/api/class_terrain3dmaterial.rst +++ b/doc/api/class_terrain3dmaterial.rst @@ -33,41 +33,47 @@ Properties .. table:: :widths: auto - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`Dictionary` | :ref:`_shader_parameters` | ``{}`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`Shader` | :ref:`shader_override` | | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`shader_override_enabled` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_autoshader` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_checkered` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_colormap` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_control_blend` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_control_texture` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_grey` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_heightmap` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_navigation` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_roughmap` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_texture_height` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_texture_normal` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_texture_rough` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`bool` | :ref:`show_vertex_grid` | ``false`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ - | :ref:`WorldBackground` | :ref:`world_background` | ``1`` | - +----------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`Dictionary` | :ref:`_shader_parameters` | ``{}`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`auto_shader` | ``true`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`dual_scaling` | ``true`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`Shader` | :ref:`shader_override` | | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`shader_override_enabled` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_autoshader` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_checkered` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_colormap` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_control_blend` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_control_texture` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_grey` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_heightmap` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_navigation` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_roughmap` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_texture_height` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_texture_normal` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_texture_rough` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`show_vertex_grid` | ``false`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`TextureFiltering` | :ref:`texture_filtering` | ``0`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ + | :ref:`WorldBackground` | :ref:`world_background` | ``1`` | + +------------------------------------------------------------------+------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group @@ -86,6 +92,8 @@ Methods +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_shader_rid` **(** **)** | +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`save` **(** **)** | + +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_shader_param` **(** :ref:`StringName` name, :ref:`Variant` value **)** | +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -128,6 +136,32 @@ Outside of the defined regions, show a flat terrain. Outside of the defined regions, generate visual-only hills. +.. rst-class:: classref-item-separator + +---- + +.. _enum_Terrain3DMaterial_TextureFiltering: + +.. rst-class:: classref-enumeration + +enum **TextureFiltering**: + +.. _class_Terrain3DMaterial_constant_LINEAR: + +.. rst-class:: classref-enumeration-constant + +:ref:`TextureFiltering` **LINEAR** = ``0`` + + + +.. _class_Terrain3DMaterial_constant_NEAREST: + +.. rst-class:: classref-enumeration-constant + +:ref:`TextureFiltering` **NEAREST** = ``1`` + + + .. rst-class:: classref-section-separator ---- @@ -151,6 +185,44 @@ Property Descriptions ---- +.. _class_Terrain3DMaterial_property_auto_shader: + +.. rst-class:: classref-property + +:ref:`bool` **auto_shader** = ``true`` + +.. rst-class:: classref-property-setget + +- void **set_auto_shader** **(** :ref:`bool` value **)** +- :ref:`bool` **get_auto_shader** **(** **)** + +.. container:: contribute + + There is currently no description for this property. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + +.. _class_Terrain3DMaterial_property_dual_scaling: + +.. rst-class:: classref-property + +:ref:`bool` **dual_scaling** = ``true`` + +.. rst-class:: classref-property-setget + +- void **set_dual_scaling** **(** :ref:`bool` value **)** +- :ref:`bool` **get_dual_scaling** **(** **)** + +.. container:: contribute + + There is currently no description for this property. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + .. _class_Terrain3DMaterial_property_shader_override: .. rst-class:: classref-property @@ -408,6 +480,25 @@ Show a grid on the vertices, overlaying any above shader. ---- +.. _class_Terrain3DMaterial_property_texture_filtering: + +.. rst-class:: classref-property + +:ref:`TextureFiltering` **texture_filtering** = ``0`` + +.. rst-class:: classref-property-setget + +- void **set_texture_filtering** **(** :ref:`TextureFiltering` value **)** +- :ref:`TextureFiltering` **get_texture_filtering** **(** **)** + +.. container:: contribute + + There is currently no description for this property. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + .. _class_Terrain3DMaterial_property_world_background: .. rst-class:: classref-property @@ -478,6 +569,20 @@ Returns the RID of the built in shader used with the Rendering Server. This is d ---- +.. _class_Terrain3DMaterial_method_save: + +.. rst-class:: classref-method + +void **save** **(** **)** + +.. container:: contribute + + There is currently no description for this method. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + .. _class_Terrain3DMaterial_method_set_shader_param: .. rst-class:: classref-method diff --git a/doc/api/class_terrain3dtexturelist.rst b/doc/api/class_terrain3dtexturelist.rst index 6e554f832..389893bdb 100644 --- a/doc/api/class_terrain3dtexturelist.rst +++ b/doc/api/class_terrain3dtexturelist.rst @@ -41,6 +41,8 @@ Methods +-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_texture_count` **(** **)** | +-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`save` **(** **)** | + +-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture` **(** :ref:`int` index, :ref:`Terrain3DTexture` texture **)** | +-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -141,6 +143,20 @@ Method Descriptions ---- +.. _class_Terrain3DTextureList_method_save: + +.. rst-class:: classref-method + +void **save** **(** **)** + +.. container:: contribute + + There is currently no description for this method. Please help us by :ref:`contributing one `! + +.. rst-class:: classref-item-separator + +---- + .. _class_Terrain3DTextureList_method_set_texture: .. rst-class:: classref-method diff --git a/doc/classes/Terrain3D.xml b/doc/classes/Terrain3D.xml index ff894805d..6aacba7e0 100644 --- a/doc/classes/Terrain3D.xml +++ b/doc/classes/Terrain3D.xml @@ -15,6 +15,13 @@ + + + + + + + @@ -73,10 +80,6 @@ - - - - @@ -91,6 +94,10 @@ + + + + diff --git a/doc/classes/Terrain3DMaterial.xml b/doc/classes/Terrain3DMaterial.xml index 7f5466df4..daaaec4f7 100644 --- a/doc/classes/Terrain3DMaterial.xml +++ b/doc/classes/Terrain3DMaterial.xml @@ -36,6 +36,11 @@ Returns the RID of the built in shader used with the Rendering Server. This is different from any shader override which has its own RID. + + + + + @@ -48,6 +53,10 @@ + + + + If shader_override_enabled is true and this Shader is valid, the material will use this custom shader code. If this is blank when you enable the override, the system will generate a shader with the current settings. So if you have a debug view enabled, the generated shader will have all of that code. A visual shader will also work here. However we only generate a text based shader so currently a visual shader needs to be constructed with the base code before it can work. @@ -94,6 +103,8 @@ Show a grid on the vertices, overlaying any above shader. + + See the [enum WorldBackground] for options. @@ -108,5 +119,9 @@ Outside of the defined regions, generate visual-only hills. + + + + diff --git a/doc/classes/Terrain3DTextureList.xml b/doc/classes/Terrain3DTextureList.xml index 7b497d8a8..41468949a 100644 --- a/doc/classes/Terrain3DTextureList.xml +++ b/doc/classes/Terrain3DTextureList.xml @@ -18,6 +18,11 @@ + + + + + diff --git a/doc/docs/building_from_source.md b/doc/docs/building_from_source.md index 458ddc823..c592cf148 100644 --- a/doc/docs/building_from_source.md +++ b/doc/docs/building_from_source.md @@ -46,6 +46,12 @@ remote: Total 125 (delta 56), reused 94 (delta 36), pack-reused 0 Receiving objects: 100% (125/125), 42.20 KiB | 194.00 KiB/s, done. Resolving deltas: 100% (56/56), done. +$ git lfs install +Updated Git hooks. +Git LFS initialized. + +$ git lfs pull + $ cd Terrain3D Terrain3D$ git submodule init diff --git a/doc/docs/images/nav_baking.png b/doc/docs/images/nav_baking.png new file mode 100644 index 000000000..2eff9f51f --- /dev/null +++ b/doc/docs/images/nav_baking.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bc8bf1c30546189fc8418eadfbfd3e50445006114c5e016598d4d5e13ca0bb3 +size 89864 diff --git a/doc/docs/images/nav_painting.png b/doc/docs/images/nav_painting.png new file mode 100644 index 000000000..f53e6ebc1 --- /dev/null +++ b/doc/docs/images/nav_painting.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be03538efa09375a0f57242c6c28eca8f66e3b1cf76ca6a8b78a0489145c5589 +size 527876 diff --git a/doc/docs/images/oc_t3d_menu.png b/doc/docs/images/oc_t3d_menu.png deleted file mode 100644 index d0e3122fa..000000000 Binary files a/doc/docs/images/oc_t3d_menu.png and /dev/null differ diff --git a/doc/docs/images/terrain3d_tools.png b/doc/docs/images/terrain3d_tools.png new file mode 100644 index 000000000..d230419a7 --- /dev/null +++ b/doc/docs/images/terrain3d_tools.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6132929fc5eeb884d49962a8de30d8426cfdc1a4c1408e7b027b351961155875 +size 9851 diff --git a/doc/docs/import_export.md b/doc/docs/import_export.md index 088ea4d27..4e761bae9 100644 --- a/doc/docs/import_export.md +++ b/doc/docs/import_export.md @@ -32,7 +32,7 @@ Currently importing and exporting is possible via code or our import tool. We wi 7) Click `Run Import` and wait 10-30 seconds. Look at the console for activity or errors. If the `Terrain3D.debug_level` is set to `debug`, you'll also see progress. -8) When you are happy with the import, scroll down in the inspector (half of it is hidden by the `Surfaces` panel) until you see `Terrain3D, Storage`. +8) When you are happy with the import, scroll down in the inspector (half of it is hidden by the `Textures` panel) until you see `Terrain3D, Storage`. 9) Click the right arrow next to the Terrain3DStorage file and save the file wherever you wish. Make sure to save it as `.res` which is a binary Godot resource file. @@ -47,7 +47,7 @@ You can now load this `res` file into a Terrain3D in any of your scenes. You can We can import raw plus any supported image format Godot can read into any of the map types. These include: * [Image formats for external files](https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/importing_images.html#supported-image-formats): `bmp`, `dds`, `exr`, `hdr`, `jpg`, `jpeg`, `png`, `tga`, `svg`, `webp` * [Image formats stored in a Godot resource file](https://docs.godotengine.org/en/stable/classes/class_image.html#enum-image-format): `tres`, `res` -* R16 Height map aka RAW: For 16-bit heightmaps read/writable by World Machine, Unity, Krita, Photoshop, etc. The extension should be `r16` or `raw`. Min/Max heights and image size are not stored in the file, so you must keep track of them elsewhere (such as in the name) +* R16 Height map aka RAW: For 16-bit heightmaps read/writable by World Machine, Unity, Krita, etc. The extension should be `r16` or `raw`. Min/Max heights and image size are not stored in the file, so you must keep track of them elsewhere (such as in the name). `Photoshop Raw` is a different format. Use [exr](https://www.exr-io.com/) for photoshop. Only `exr` or `r16/raw` are recommended for heightmaps. Godot PNG only supports 8-bit per channel, so don't use it for heightmaps. It is fine for external editing of control and color maps which are RGBA. See [Terrain3DStorage](../api/class_terrain3dstorage.rst) for details on internal storage. @@ -88,7 +88,7 @@ Notes: We can export raw plus any supported image format Godot can write. These include: * [Image save functions for external files](https://docs.godotengine.org/en/stable/classes/class_image.html#class-image-method-save-exr): `exr`, `png`, `jpg`, `webp` * Images stored in a Godot resource file: `tres` for text, `res` for binary (with `ResourceSaver::FLAG_COMPRESS` enabled) -* R16 Height map aka RAW: For 16-bit heightmaps read/writable by World Machine, Unity, Krita, Photoshop, etc. Save with the extension `r16` or `raw`. Min/Max heights and image size are not stored in the file, so you must keep track of them elsewhere. See below to acquire the dimensions. +* R16 Height map aka RAW: For 16-bit heightmaps read/writable by World Machine, Unity, Krita, etc. Save with the extension `r16` or `raw`. Min/Max heights and image size are not stored in the file, so you must keep track of them elsewhere. See below to acquire the dimensions. `Photoshop Raw` is a different format. Use [exr](https://www.exr-io.com/) for photoshop. For heightmaps, use `exr` or `r16/raw` for external tools, or `res` for Godot only use. Godot PNG only supports 8-bit per channel, so it will give you blocky heightmaps. diff --git a/doc/docs/navigation.md b/doc/docs/navigation.md new file mode 100644 index 000000000..1215aba8b --- /dev/null +++ b/doc/docs/navigation.md @@ -0,0 +1,102 @@ +# Navigation + +Navigation in games is quite a broad and sometimes complex topic. A full description can't be provided here, so it's recommended to familiarize yourself with the basic concepts in the [official Godot documentation](https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_introduction_3d.html) first. + +This page describes how to bake a nav mesh (navigation mesh) for your terrain. + + +## Setting Up Navigation + +Nav meshes take a long time to bake, and in most games, it would be wasteful to generate vast amounts of navigation data for areas that navigation agents aren't going to use. So by default, all terrain is un-navigable. To make parts of it navigable, you must use the Navigable terrain tool. Navigable areas appear in dark magenta when this tool is selected. + +```{image} images/nav_painting.png +:target: ../_images/nav_painting.png +``` + +Next, you will need a `NavigationRegion3D` node. If you don't already have one, Terrain3D provides a convenient tool to set one up for you. Select your `Terrain3D` node, then in the `Terrain3D Tools` menu on top, click `Set up Navigation`. + +```{image} images/terrain3d_tools.png +:target: ../_images/terrain3d_tools.png +``` + +The same steps can be performed manually if you prefer: + +1. Create a `NavigationRegion3D` node. +2. Assign it a blank `NavigationMesh` resource. Review and adjust the settings on it if you need to. +3. If using the default source geometry mode, move the `Terrain3D` node to be a child of the new `NavigationRegion3D` node. Otherwise, if you selected one of the group-based modes, add the Terrain3D node to the group. + + +## Baking a Nav Mesh + +Once navigation has been set up, baking and re-baking it is straight-forward: + +1. Select the `Terrain3D` node. +2. In Terrain3D Tools, click `Bake NavMesh`. This can take a long time to complete. + +Note that the standard `Bake NavMesh` button that `NavigationRegion3D` provides will not generate a nav mesh for Terrain3D (see [godot-proposals#5138](https://github.com/godotengine/godot-proposals/issues/5138)). Only use the Terrain3D Tools baker, which appears whenever you click the `Terrain3D` node or any `NavigationRegion3D` nodes. + +```{image} images/nav_baking.png +:target: ../_images/nav_baking.png +``` + +If this is your first time setting up and baking a nav mesh, the only thing left to do is add your navigation agents. See [Godot's very clear and thorough documentation on navigation agents](https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_using_navigationagents.html), which provides several handy template scripts you can use. + +You can also play with the NavigationDemo.tscn and CodeGenerated.tscn scenes which both demonstrate navigation. + +
+ +
+ + +## Tips + +### Save NavigationMesh resources to disk + +NavigationMesh resources can bloat the size of your scene. It's recommended to save these resources to disk in binary format with the `.res` extension. + +### Use multiple nav meshes in large scenes + +As mentioned, in many games, large areas of terrain are generally unreachable to agents. The 'Navigable Areas' tool is used to reduce the amount of geometry coming from the `Terrain3D` node, however having lots of other meshes in unreachable areas can also lead to long bake times. + +If you have a very large scene in, for example, an open world RPG, it's better to have multiple small nav meshes that cover only what you need, rather than one giant one covering the entire world. In said example, each RPG town could have its own nav mesh. To do this, you would need to: + +1. Create a NavigationRegion3D node for each town, each with their own NavigationMesh resources (i.e. unique, not shared). +2. Define the [`filter_baking_aabb`](https://docs.godotengine.org/en/stable/classes/class_navigationmesh.html#class-navigationmesh-property-filter-baking-aabb) on each nav mesh, so that it only bakes objects within its own area. +3. To use the same Terrain3D node with multiple NavigationRegion3D, set up the nav meshes to use one of the [`SOURCE_GEOMETRY_GROUPS_*` modes](https://docs.godotengine.org/en/stable/classes/class_navigationmesh.html#class-navigationmesh-property-geometry-source-geometry-mode) instead of the default `SOURCE_GEOMETRY_ROOT_NODE_CHILDREN`, and add the Terrain3D node to the group. + + +## Common Issues + +### NavigationMeshSourceGeometryData3D is empty. Parse source geometry first. + +The engine produces this error if there's nothing for a NavigationRegion3D to generate a nav mesh from. The most likely cause, if you're using Terrain3D, is that you haven't painted any parts of the terrain as navigable. + +### Navigation map synchronization error + +`Navigation map synchronization error. Attempted to merge a navigation mesh polygon edge with another already-merged edge. This is usually caused by crossing edges, overlapping polygons, or a mismatch of the NavigationMesh / NavigationPolygon baked 'cell_size' and navigation map 'cell_size'` + +There are several possible causes for this. If the `cell_size` of your nav mesh matches the `cell_size` in your project settings, it's currently believed to be caused by [an engine bug](https://github.com/godotengine/godot/issues/85548). This error message shouldn't affect the usability of your nav meshes. + +### Agents get stuck on collisions, run in circles, go off the nav mesh, or fail to find obvious paths + +Developing good path-following behaviors is a very complex topic, far beyond the scope of this article. In general, make sure your NavigationMesh settings, NavigationAgent3D settings, and collisions are all consistent with each other. If a NavigationAgent3D is using a NavigationMesh that was baked for smaller agents than itself, for instance, then it's going to get stuck. + +You can try repainting an area and regenerating the nav mesh. + +Making reasonable fallback behaviors, when you're able to detect in a script that something has gone awry, can also help. + + +## Baking a Nav Mesh at Runtime + +If your project has dynamic, or generated terrain, or if the traversable area of your terrain is so gigantic that it can't be baked in the editor, then you might need to use runtime navmesh baking. + +Terrain3D contains an example script that shows how to bake terrain nav meshes at runtime, which you can find in the `CodeGenerated.tscn` demo scene. The script periodically re-bakes a nav mesh in the area around the player as they move through the scene. + +
+ +
+ diff --git a/doc/docs/occlusion_culling.md b/doc/docs/occlusion_culling.md index d07f9ccc0..15589936e 100644 --- a/doc/docs/occlusion_culling.md +++ b/doc/docs/occlusion_culling.md @@ -15,10 +15,11 @@ First, enable `use_occlusion_culling` in the project settings. Then in the editor: * Select Terrain3D. -* Click `Bake Occluder3D` in the top menu. On the popup window accept the default, LOD 4. +* Click `Terrain3D Tools`, then `Bake Occluder3D` in the top menu. +* On the popup window accept the default, LOD 4. -```{image} images/oc_t3d_menu.png -:target: ../_images/oc_t3d_menu.png +```{image} images/terrain3d_tools.png +:target: ../_images/terrain3d_tools.png ``` * Select the OccluderInstance3D child node. diff --git a/doc/docs/project_status.md b/doc/docs/project_status.md index ce7709825..48005351f 100644 --- a/doc/docs/project_status.md +++ b/doc/docs/project_status.md @@ -8,7 +8,7 @@ See the [Roadmap](https://github.com/users/TokisanGames/projects/3/views/1) for | Feature | Status | | ------------- | ------------- | -| **Platforms** | Terrain editing and exported games work on Windows, Linux, macOS. Other export platforms are pending: [IOS](https://github.com/TokisanGames/Terrain3D/issues/218), [Android](https://github.com/TokisanGames/Terrain3D/issues/197), [Steam Deck](https://github.com/TokisanGames/Terrain3D/issues/220), [WebGL](https://github.com/TokisanGames/Terrain3D/issues/217) +| **Platforms** | Terrain editing and exported games work on Windows, Linux, macOS. Experimental in 4.2: [Steam Deck](https://github.com/TokisanGames/Terrain3D/issues/220#issuecomment-1837552459), [Android](https://github.com/TokisanGames/Terrain3D/issues/197#issuecomment-1815513064). Pending: [IOS](https://github.com/TokisanGames/Terrain3D/pull/219), [WebGL](https://github.com/TokisanGames/Terrain3D/issues/217) | **Languages** | GDScript, C++, C# all work, as should any language Godot supports. See [Integrating With Terrain3D](integrating.md) | **Editing** | | Sculpting Operations | Raise, Lower, Flatten, Expand (Multiply away from 0), Reduce (Divide towards 0), Smooth. Needs refinement @@ -25,7 +25,7 @@ See the [Roadmap](https://github.com/users/TokisanGames/projects/3/views/1) for | **Physics** | | Godot | Works within regions you define in your world. No collision outside of those. | Jolt | [Godot-Jolt](https://github.com/godot-jolt/godot-jolt) v0.6+ works as a drop-in replacement for Godot Physics. The above restriction applies. -| **Navigation Server** | Pending. See [#46](https://github.com/TokisanGames/Terrain3D/issues/46), [#176](https://github.com/TokisanGames/Terrain3D/pull/176), [#253](https://github.com/TokisanGames/Terrain3D/pull/253) +| **Navigation Server** | Supported. See [Navigation](navigation.md) | **Data** | | Large terrains | 8k^2 works, maybe a little more, though [collision will take up ~3GB RAM](https://github.com/TokisanGames/Terrain3D/issues/161). 16k x 8k up to 16k^2 works in memory, but cannot be saved due to an [engine bug](https://github.com/TokisanGames/Terrain3D/issues/159). | Importing / Exporting | Works. See [Importing data](import_export.md) diff --git a/doc/docs/tips.md b/doc/docs/tips.md index 34be67bf3..723d63345 100644 --- a/doc/docs/tips.md +++ b/doc/docs/tips.md @@ -21,62 +21,29 @@ Tips * Example: Use the Paint tool for a grass field and a dirt pathway, then use the Spray tool and repeatedly switch between grass and dirt to blend the edges of the path randomly until it looks realistic. * Use the [control texture](../api/class_terrain3dmaterial.rst#class-terrain3dmaterial-property-show-control-texture) and [control blend](../api/class_terrain3dmaterial.rst#class-terrain3dmaterial-property-show-control-blend) debug views to understand how your textures are painted and blended. -## Shaders - -### Debug shaders -Enabling the shader override will give you a copy of the shader you currently see on the terrain. If you turn on the various debug views, such as the vertex grid, then clear any existing shader override, then enable it, you'll get a copy of that debug shader. Debug shaders are typically inserted at the end with all of the normal shader parameters included but overwritten. - -### Remove the mesh outside of regions -*This is built into v0.9, labeled `World Background`* +## Performance +* The Terrain3DMaterial shader has some advanced features that look nice but consume some performance. You can get better performance by disabling them: + * Set `WorldNoise` to `Flat` or `None` + * Disable `Auto Shader` + * Disable `Dual Scaling` +* Reduce the size of the mesh and levels of detail by reducing `Mesh/Size` (`mesh_size`) or `Mesh/Lods` (`mesh_lods`) in the `Terrain3D` node. -You can hide the terrain outside of your active regions by modifying the override shader. Add this to the end of `vertex()`. All of these options work on an NVidia card, you only need one: - -```glsl -if(get_region_uv2(UV2).z < 0.) { - VERTEX.x=0./0.; - //VERTEX=vec3(0./0.); - //VERTEX=vec3(sqrt(-1)); -} -``` +## Shaders ### Make a region smaller than 1024^2 -You can use the above technique, changing the conditional test from regions to world coordinates for VERTEX. eg. Discard vertices that are < 0 or > 256. It will still build collision and consume memory for 1024 x 1024 maps, but this will allow you to control the visual world until alternate region sizes are supported. - +Make a custom shader, then look in `vertex()` where it sets the vertex to an invalid number `VERTEX.x = 0./0.;`. Edit the conditional above it to filter out vertices that are < 0 or > 256 for instance. It will still build collision and consume memory for 1024 x 1024 maps, but this will allow you to control the visual aspect until alternate region sizes are supported. ### Regarding day/night cycles The terrain shader is set to `cull_back`, meaning back faces are not rendered. Nor do they block light. If you have a day/night cycle and the sun sets below the horizon, it will shine through the terrain. Enable the shader override and change the second line to `cull_disabled` and the horizon will block sunlight. This does cost performance. - -### Branching - -Using conditionals (if/while/for) creates multiple branches or paths of code execution. An if a statement, which can be true or false, creates two separate branches. - -Historically it has been taught that using branches in shaders is a bad practice and will kill GPU performance. This is not true. Branches by themselves won't slow down modern cards. - -GPUs are designed to create a large group of cores that will execute the same code path, or branch. If there is an if statement that turns the left side of the screen blue and the right side red, then half of the cores will execute each branch. Having two code paths is perfectly fine. - -The problem with branches comes in where the conditions for branching changes dynamically and cores will variably select different paths to execute. If a pixel: -* feeds time into a random number generator -* then if that value is above or below 0.5 -* then if time is even or odd -* then depending on those 4 permutations decides to read texture 1, 2, 3 or 4 - -then it's going to be very difficult for the GPU to optimize. It can't identify four groups of cores to execute the four paths since the conditions are constantly changing. It doesn't have to be extreme like this. Even two nested conditionals comparing lookup values up will slow a modern GPU. And that might only mean 10-20% slower, rather than entirely killing performance. - -If our shader exposes a boolean checkbox to select between alpha blending or height blending, it will change the code path. But it has no impact on performance because all cores execute the same branch. We could also apply effects to one specific texture, and any cores processing that texture will be grouped. - -Sometimes we think it would be more optimal to create a branch to not perform certain operations if a condition is false. Yet when we test it, we find that performing the wasteful operations in the same branch is actually more optimal than creating a branch. - -So, the old rule of thumb about not using branches and structuring your code so that all cores use the same code path is still the best practice. However, limited use of branching with static conditions is fine and may be more optimal. Just consider if your conditions allow the GPU to group large sections of core down the same branch. Avoid dynamic conditions altogether and test any branches you create for optimization to ensure they actually have a performance benefit. - - ### Add a custom texture map Here's an example of using a custom texture map for one texture, such as adding an emissive texture for lava. Note, avoid sub branches: an if statement within an if statement. As shown below, I wanted a sub branch to avoid processing the emissive when not used, but this slowed down my GPU. So, I refactored it in a way that didn't cause a performance hit. Add the uniforms for the emissive texture id and a texture: ```glsl -uniform uint emissive_id = 0; +uniform int emissive_id : hint_range(0,31) = 0; +uniform float emissive_strength = 1.0; uniform sampler2D emissive_tex : source_color, filter_linear_mipmap_anisotropic; ``` @@ -92,18 +59,18 @@ struct Material { Modify `get_material()` to read the emissive texture. ```glsl // Add the initial value for emissive, adding the last vec3 -out_mat = Material(vec4(0.), vec4(0.), 0u, 0u, 0.0, vec3(0.)); +out_mat = Material(vec4(0.), vec4(0.), 0, 0, 0.0, vec3(0.)); -// After reading albedo and normal, before the blending block +// After reading albedo and normal, before the blending block: `if (out_mat.blend > 0.f)` vec4 emissive = vec4(0.); -if(base_tex == emissive_id) { +if(out_mat.base == emissive_id) { emissive = texture(emissive_tex, matUV); } -// Within the overlay block: `if (blend > 0.f)`, after reading albedo/normal, but before the albedo/normal height_blend() calls +// Within the overlay block: `if (blend > 0.f)`, right before the albedo/normal height_blend() calls vec4 emissive2 = vec4(0.); -emissive2 = texture(emissive_tex, matUV2) * float(over_tex == emissive_id); -emissive = height_blend(emissive, albedo_ht.a, emissive2, albedo_ht2.a, blend); +emissive2 = texture(emissive_tex, matUV2) * float(out_mat.over == emissive_id); +emissive = height_blend(emissive, albedo_ht.a, emissive2, albedo_ht2.a, out_mat.blend); // At the bottom of the function, before `return`. out_mat.emissive = emissive.rgb; @@ -116,7 +83,6 @@ vec3 emissive = weight_inv * ( mat[1].emissive * weights.y + mat[2].emissive * weights.z + mat[3].emissive * weights.w ); -EMISSION = emissive; - +EMISSION = emissive * emissive_strength; ``` diff --git a/doc/index.rst b/doc/index.rst index 82f8248f4..9aafb846c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -98,6 +98,7 @@ Geometry clipmap mesh code created by `Mike J. Savage