Skip to content

Commit

Permalink
Adjust default mesh visibility distance
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Dec 8, 2024
1 parent 81b7807 commit 66cfa2d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions doc/api/class_terrain3dmeshasset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Properties
+---------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------+
| :ref:`PackedScene<class_PackedScene>` | :ref:`scene_file<class_Terrain3DMeshAsset_property_scene_file>` | |
+---------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`visibility_range<class_Terrain3DMeshAsset_property_visibility_range>` | ``64.0`` |
| :ref:`float<class_float>` | :ref:`visibility_range<class_Terrain3DMeshAsset_property_visibility_range>` | ``100.0`` |
+---------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------+

.. rst-class:: classref-reftable-group
Expand Down Expand Up @@ -360,7 +360,7 @@ A packed scene to load the mesh from. See the top description.

.. rst-class:: classref-property

:ref:`float<class_float>` **visibility_range** = ``64.0`` :ref:`🔗<class_Terrain3DMeshAsset_property_visibility_range>`
:ref:`float<class_float>` **visibility_range** = ``100.0`` :ref:`🔗<class_Terrain3DMeshAsset_property_visibility_range>`

.. rst-class:: classref-property-setget

Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Terrain3DMeshAsset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<member name="scene_file" type="PackedScene" setter="set_scene_file" getter="get_scene_file">
A packed scene to load the mesh from. See the top description.
</member>
<member name="visibility_range" type="float" setter="set_visibility_range" getter="get_visibility_range" default="64.0">
<member name="visibility_range" type="float" setter="set_visibility_range" getter="get_visibility_range" default="100.0">
Sets [code skip-lint]GeometryInstance3D.visibility_range_end[/code] on all MultiMeshInstances used by this mesh. Allows the renderer to cull MMIs beyond this distance. Set to 0 to disable culling.
</member>
</members>
Expand Down
1 change: 1 addition & 0 deletions doc/docs/games.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Terrain3D is being used in the following games. To add yours, submit it to the #

| Game | Studio | Description |
|------|--------|-------------|
| [Landscape Demo](https://github.com/OverfortGames/LandscapeDemo) | [Overfort Games](https://x.com/OverfortGames) | Island demo w/ source
| [Jungle Demo](https://wrobot.itch.io/jungledemo) | [WrobotGames](https://x.com/wrobot123) | Godot rendering demo in a jungle
13 changes: 7 additions & 6 deletions project/demo/data/assets.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
[ext_resource type="Texture2D" uid="uid://ddprscrpsofah" path="res://demo/assets/textures/ground037_alb_ht.png" id="3_g8f2m"]
[ext_resource type="Texture2D" uid="uid://c1ots7w6i0i1q" path="res://demo/assets/textures/ground037_nrm_rgh.png" id="4_aw5y1"]

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_aubfq"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mapyw"]
transparency = 4
cull_mode = 2
vertex_color_use_as_albedo = true
backlight_enabled = true
backlight = Color(0.5, 0.5, 0.5, 1)
distance_fade_mode = 1
distance_fade_min_distance = 960.0
distance_fade_max_distance = 480.0
distance_fade_min_distance = 85.0
distance_fade_max_distance = 75.0

[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_dw1mh"]
[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_2qf8x"]
height_offset = 0.5
density = 10.0
material_override = SubResource("StandardMaterial3D_aubfq")
visibility_range = 100.0
material_override = SubResource("StandardMaterial3D_mapyw")
generated_type = 1

[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_mup2f"]
Expand All @@ -35,5 +36,5 @@ albedo_texture = ExtResource("3_g8f2m")
normal_texture = ExtResource("4_aw5y1")

[resource]
mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_dw1mh")])
mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_2qf8x")])
texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_mup2f"), SubResource("Terrain3DTextureAsset_od0q7")])
6 changes: 3 additions & 3 deletions src/terrain_3d_mesh_asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ Ref<Material> Terrain3DMeshAsset::_get_material() {
mat->set_backlight(Color(.5f, .5f, .5f));
mat->set_flag(BaseMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
mat->set_distance_fade(BaseMaterial3D::DISTANCE_FADE_PIXEL_ALPHA);
mat->set_distance_fade_min_distance(960.f);
mat->set_distance_fade_max_distance(480.f);
mat->set_distance_fade_min_distance(85.f);
mat->set_distance_fade_max_distance(75.f);
return mat;
} else {
return _material_override;
Expand All @@ -153,7 +153,7 @@ void Terrain3DMeshAsset::clear() {
_name = "New Mesh";
_id = 0;
_height_offset = 0.f;
_visibility_range = 64.f;
_visibility_range = 100.f;
_visibility_margin = 0.f;
_cast_shadows = GeometryInstance3D::SHADOW_CASTING_SETTING_ON;
_generated_faces = 2.f;
Expand Down
2 changes: 1 addition & 1 deletion src/terrain_3d_mesh_asset.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Terrain3DMeshAsset : public Terrain3DAssetResource {
private:
// Saved data
real_t _height_offset = 0.f;
real_t _visibility_range = 64.f;
real_t _visibility_range = 100.f;
real_t _visibility_margin = 0.f;
GeometryInstance3D::ShadowCastingSetting _cast_shadows = GeometryInstance3D::SHADOW_CASTING_SETTING_ON;
GenType _generated_type = TYPE_NONE;
Expand Down

0 comments on commit 66cfa2d

Please sign in to comment.