From c18409a2f2aa29500d78f4513e3e24e1301b36a3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 30 Mar 2020 23:18:28 +0200 Subject: [PATCH] Implemented lod for mobs. Also Updated HEADS to grab a crash fix from Voxelman, and the update to Skeleton3D from ESS. --- HEADS | 2 +- .../9_standard_character_material_notex.tres | 7 ++ game/data/models/armature_model_orig_v2.tscn | 54 ++++++++---- .../7_standard_character_shader_notex.tres | 12 +++ game/player/CharacterSkeletonGD.gd | 83 ++++++++++++++++--- game/player/Mob.gd | 9 ++ game/player/Mob.tscn | 2 +- game/player/NetworkedPlayer.tscn | 1 - game/scenes/World.tscn | 3 +- 9 files changed, 141 insertions(+), 32 deletions(-) create mode 100644 game/data/materials/9_standard_character_material_notex.tres create mode 100644 game/data/shaders/7_standard_character_shader_notex.tres diff --git a/HEADS b/HEADS index ec848378..3fbf32c0 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "da4eb7101d986af0ba6a15efaaed3dee77370d80", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "533c25e96fe0e5c46f68e6a532da6583cf86f4e2"}, "entity_spell_system": {"master": "0bc136962658731bac3e9e1b23bd9677f4dea9de"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "f26fe74fc47bc1c448c9d3888caf67aa53e8f5a4"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "ea3b34d972fb5f76474daabd7c1e192419811348"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "16d0ff1ed1e986202ed7f743d3c70666e0859b28"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "dc598c59322185032835f964db069964244e58bc"}} \ No newline at end of file +{"engine": {"3.2": "da4eb7101d986af0ba6a15efaaed3dee77370d80", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "533c25e96fe0e5c46f68e6a532da6583cf86f4e2"}, "entity_spell_system": {"master": "b5bd583e8ec0bf5160b506a0d90d418191175153"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "3969e0ba5f64761c893b50103c7efa3a10f06cac"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "ea3b34d972fb5f76474daabd7c1e192419811348"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "16d0ff1ed1e986202ed7f743d3c70666e0859b28"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "dc598c59322185032835f964db069964244e58bc"}} \ No newline at end of file diff --git a/game/data/materials/9_standard_character_material_notex.tres b/game/data/materials/9_standard_character_material_notex.tres new file mode 100644 index 00000000..d9572745 --- /dev/null +++ b/game/data/materials/9_standard_character_material_notex.tres @@ -0,0 +1,7 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=2] + +[ext_resource path="res://data/shaders/7_standard_character_shader_notex.tres" type="Shader" id=1] + +[resource] +shader = ExtResource( 1 ) +shader_param/albedo = Color( 1, 1, 1, 1 ) diff --git a/game/data/models/armature_model_orig_v2.tscn b/game/data/models/armature_model_orig_v2.tscn index 48c8f5b0..2847f45a 100644 --- a/game/data/models/armature_model_orig_v2.tscn +++ b/game/data/models/armature_model_orig_v2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=37 format=2] +[gd_scene load_steps=38 format=2] [ext_resource path="res://data/models/armature.dae" type="PackedScene" id=1] [ext_resource path="res://data/materials/3_standard_character_material.tres" type="Material" id=2] @@ -7,69 +7,101 @@ [ext_resource path="res://test_weapons/sword_i.mesh" type="ArrayMesh" id=5] [ext_resource path="res://data/item_visuals/test_base_v3.tres" type="ItemVisual" id=6] [ext_resource path="res://test_weapons/shield_d.mesh" type="ArrayMesh" id=7] +[ext_resource path="res://data/materials/9_standard_character_material_notex.tres" type="Material" id=8] [sub_resource type="Skin" id=1] bind_count = 31 +bind/0/name = "" bind/0/bone = 0 bind/0/pose = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0010334, -1.32424, 0.004403 ) +bind/1/name = "" bind/1/bone = 1 bind/1/pose = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 3.23883e-05, -0.000216131, 0 ) +bind/2/name = "" bind/2/bone = 2 bind/2/pose = Transform( 1, 0, 0, 0, 4.71856e-07, 1, 0, -1, 4.71856e-07, 0, -3.6933e-07, 0.782716 ) +bind/3/name = "" bind/3/bone = 3 bind/3/pose = Transform( 0.999745, -0.00621639, 0.0217112, -0.0215977, 0.0177767, 0.999609, -0.00659991, -0.999823, 0.0176379, 0.0051749, -0.0147984, 0.832313 ) +bind/4/name = "" bind/4/bone = 4 bind/4/pose = Transform( 1, -9.35914e-10, 1.36474e-09, -3.07044e-09, -0.00336038, 0.999994, 1.03179e-11, -0.999994, -0.00336038, -0.00103352, 0.00608556, 0.989014 ) +bind/5/name = "" bind/5/bone = 5 bind/5/pose = Transform( 1, 6.39974e-07, -8.89245e-07, 8.80181e-07, 0.0113912, 0.999935, 6.50979e-07, -0.999935, 0.0113912, -0.00103425, -0.0106821, 1.13661 ) +bind/6/name = "" bind/6/bone = 6 bind/6/pose = Transform( 1, -0.000269678, 0.00012004, -9.65309e-05, 0.0855512, 0.996334, -0.000278958, -0.996334, 0.0855512, -0.000675752, -0.108904, 1.31976 ) +bind/7/name = "" bind/7/bone = 7 bind/7/pose = Transform( 1, 8.17762e-05, -0.000263342, 0.000258866, 0.0505959, 0.998719, 9.49964e-05, -0.998719, 0.0505959, -0.00116505, -0.0605734, 1.38071 ) +bind/8/name = "" bind/8/bone = 8 bind/8/pose = Transform( 0.0070114, 0.0774383, 0.996973, 0.0774384, 0.993961, -0.077749, -0.996973, 0.0777491, 0.00097251, -0.089079, -1.27734, -0.0279526 ) +bind/9/name = "" bind/9/bone = 9 bind/9/pose = Transform( -0.0450563, 0.0440544, 0.998013, 0.0597335, 0.997358, -0.0413288, -0.997197, 0.0577527, -0.0475687, -0.0365657, -1.27782, 0.120299 ) +bind/10/name = "" bind/10/bone = 10 bind/10/pose = Transform( 0.018514, 0.0309238, 0.99935, 0.0309247, 0.999025, -0.0314866, -0.99935, 0.0314876, 0.0175398, -0.0484489, -1.26707, 0.406214 ) +bind/11/name = "" bind/11/bone = 11 bind/11/pose = Transform( -0.0261653, 0.130666, -0.991081, 0.130703, -0.982463, -0.132981, -0.991077, -0.133017, 0.00862807, -0.147772, 1.13499, 0.846311 ) +bind/12/name = "" bind/12/bone = 12 bind/12/pose = Transform( -0.475656, 0.00430247, 0.879621, 0.00321757, 0.99999, -0.0031513, -0.879626, 0.00133118, -0.475665, 0.317761, -1.25084, 0.691578 ) +bind/13/name = "" bind/13/bone = 13 bind/13/pose = Transform( -0.000220652, -0.000277915, 1, -0.000336948, 1, 0.000277923, -1, -0.000336983, -0.000220542, -0.0614699, -1.24824, 0.794416 ) +bind/14/name = "" bind/14/bone = 14 bind/14/pose = Transform( 0.00944622, 0.00316354, 0.999951, 0.0031337, 0.99999, -0.00319322, -0.999951, 0.00316365, 0.00943635, -0.00773189, -1.26399, 0.790859 ) +bind/15/name = "" bind/15/bone = 15 bind/15/pose = Transform( -0.00970715, 0.0022499, 0.999951, 0.00216274, 0.999995, -0.00222896, -0.999951, 0.00214093, -0.00971181, 0.00940531, -1.26319, 0.831785 ) +bind/16/name = "" bind/16/bone = 16 bind/16/pose = Transform( 0.00658963, -0.0806899, -0.996717, -0.0806899, 0.993446, -0.0809585, 0.996717, 0.0809585, 3.54564e-05, 0.0931853, -1.27701, -0.0320576 ) +bind/17/name = "" bind/17/bone = 17 bind/17/pose = Transform( -0.0392234, -0.0752374, -0.996394, -0.0366487, 0.996599, -0.0738102, 0.998558, 0.0336214, -0.0418474, 0.0773441, -1.27236, 0.151474 ) +bind/18/name = "" bind/18/bone = 18 bind/18/pose = Transform( 0.0229175, -0.0602779, -0.997918, -0.0474641, 0.99699, -0.0613119, 0.99861, 0.0487704, 0.0199873, 0.0862036, -1.27767, 0.383885 ) +bind/19/name = "" bind/19/bone = 19 bind/19/pose = Transform( 0.0297753, 0.082978, -0.996106, 0.0950469, 0.991797, 0.0854601, 0.995027, -0.0972214, 0.0216441, -0.0879441, -1.17267, 0.804474 ) +bind/20/name = "" bind/20/bone = 20 bind/20/pose = Transform( -0.487887, -0.0560934, -0.871102, -0.0378187, 0.998354, -0.043106, 0.872087, 0.0119131, -0.489205, -0.265874, -1.2737, 0.672265 ) +bind/21/name = "" bind/21/bone = 21 bind/21/pose = Transform( 0.00472639, -0.0569537, -0.998365, -0.0438079, 0.997406, -0.0571064, 0.999029, 0.0440062, 0.00221883, 0.134012, -1.27645, 0.738441 ) +bind/22/name = "" bind/22/bone = 22 bind/22/pose = Transform( -0.00289686, -0.0125321, -0.999917, 0.000557578, 0.999921, -0.0125338, 0.999995, -0.00059385, -0.00288976, 0.00631499, -1.25873, 0.795846 ) +bind/23/name = "" bind/23/bone = 23 bind/23/pose = Transform( 0.00643236, -0.0318082, -0.999473, -0.0188087, 0.999313, -0.0319242, 0.999802, 0.0190041, 0.00582956, 0.0383794, -1.27427, 0.810817 ) +bind/24/name = "" bind/24/bone = 24 bind/24/pose = Transform( 0.997079, 0.0643905, 0.0415419, 0.0406052, 0.0156588, -0.999053, -0.0649775, 0.997802, 0.0129985, -0.124325, -0.0162939, -0.795408 ) +bind/25/name = "" bind/25/bone = 25 bind/25/pose = Transform( 0.998221, 0.051846, 0.0300808, 0.0276995, 0.0458923, -0.998563, -0.053149, 0.9976, 0.0443741, -0.118691, -0.0290485, -0.456133 ) +bind/26/name = "" bind/26/bone = 26 bind/26/pose = Transform( 0.998432, 0.0379936, -0.0415485, 0.0267438, -0.969472, -0.243743, -0.0495496, 0.242244, -0.968951, -0.119631, 0.0441252, -0.0300586 ) +bind/27/name = "" bind/27/bone = 27 bind/27/pose = Transform( 0.997517, -0.0648327, -0.0280864, -0.0272037, 0.0143568, -0.999527, 0.0652032, 0.997793, 0.0125575, 0.124711, -0.0142854, -0.795383 ) +bind/28/name = "" bind/28/bone = 28 bind/28/pose = Transform( 0.998496, -0.0523874, -0.0171451, -0.0147558, 0.0455334, -0.998855, 0.0531055, 0.997589, 0.0446915, 0.119101, -0.0275243, -0.456326 ) +bind/29/name = "" bind/29/bone = 29 bind/29/pose = Transform( 0.997795, 0.00782497, 0.066146, 0.0235858, -0.970258, -0.240925, 0.0623004, 0.241949, -0.968288, 0.117675, 0.0501108, -0.0285344 ) +bind/30/name = "" bind/30/bone = 30 bind/30/pose = Transform( 1, 0, 0, 0, 1, -2.84217e-14, 0, -4.98108e-09, 1, 0, -0.832461, 2.76188e-08 ) @@ -189,7 +221,7 @@ automatic_build = true use_threads = true mesh_instance_path = NodePath("armature/Armature/Skeleton/MeshInstance") skeleton_path = NodePath("armature/Armature/Skeleton") -material = ExtResource( 2 ) +materials = [ ExtResource( 2 ), ExtResource( 2 ), ExtResource( 8 ) ] left_hand_attach_point_path = NodePath("armature/Armature/Skeleton/LeftHandAttachment/LeftHandAP") right_hand_attach_point_path = NodePath("armature/Armature/Skeleton/RightHandAttachment/RightHandAP") torso_attach_point_path = NodePath("armature/Armature/Skeleton/NeckAttachment/TorsoAP") @@ -198,19 +230,11 @@ viss = [ ExtResource( 6 ) ] [node name="armature" parent="." instance=ExtResource( 1 )] -[node name="Skeleton" parent="armature/Armature" index="0"] -bones/1/bound_children = [ NodePath("RootAttachment") ] -bones/2/bound_children = [ NodePath("RightHipAttachment") ] -bones/5/bound_children = [ NodePath("BoneAttachment") ] -bones/6/bound_children = [ NodePath("NeckAttachment") ] -bones/11/bound_children = [ NodePath("LeftHandAttachment") ] -bones/19/bound_children = [ NodePath("RightHandAttachment") ] - [node name="MeshInstance" type="MeshInstance" parent="armature/Armature/Skeleton" index="0"] skin = SubResource( 1 ) [node name="LeftHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="1"] -transform = Transform( 0.103553, -0.988238, -0.11234, 0.0563584, -0.106903, 0.99262, -0.993022, -0.109123, 0.044628, 0.270796, 0.763348, -0.00915292 ) +transform = Transform( 0.103432, -0.988301, -0.11195, 0.0566146, -0.106499, 0.992661, -0.993021, -0.109013, 0.0449388, 0.267544, 0.764237, -0.0114054 ) bone_name = "left_hand" [node name="LeftHandAP" type="Spatial" parent="armature/Armature/Skeleton/LeftHandAttachment"] @@ -218,7 +242,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04, -0.09 ) script = ExtResource( 4 ) [node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"] -transform = Transform( -0.0415039, -0.998438, 0.0367427, -0.126411, 0.0417122, 0.991033, -0.991123, 0.0364982, -0.127949, -0.273113, 0.764931, -0.00762625 ) +transform = Transform( -0.0428267, -0.998105, 0.0437773, -0.127906, 0.0489211, 0.990529, -0.990872, 0.0368299, -0.129762, -0.274113, 0.764247, -0.00468774 ) bone_name = "right_hand" [node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"] @@ -234,7 +258,7 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 script = ExtResource( 4 ) [node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="4"] -transform = Transform( 0.999966, -0.00104017, 0.00817554, 0.00822331, 0.073102, -0.997213, 0.000439647, 0.997323, 0.0731128, 0.00129018, 1.31429, 9.11438e-05 ) +transform = Transform( 0.999962, -0.000816043, 0.00864644, 0.00867968, 0.0731249, -0.997226, 0.00018152, 0.997322, 0.0731331, 0.000975902, 1.31559, 7.50535e-05 ) bone_name = "neck" [node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"] @@ -242,7 +266,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.04, -0.09 ) script = ExtResource( 4 ) [node name="RightHipAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="5"] -transform = Transform( 0.999802, 1.49329e-08, -0.0198917, -0.0198917, 4.71706e-07, -0.999802, -5.54689e-09, 1, 4.7191e-07, 0.00459351, 0.772787, 1.86265e-09 ) +transform = Transform( 0.999719, 5.70222e-09, -0.0237084, -0.0237084, 4.71787e-07, -0.999719, 5.48469e-09, 1, 4.71789e-07, 0.00308074, 0.774084, -1.8772e-09 ) bone_name = "pelvis" [node name="Spatial" type="Spatial" parent="armature/Armature/Skeleton/RightHipAttachment"] @@ -255,7 +279,7 @@ material/0 = null material/1 = null [node name="BoneAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="6"] -transform = Transform( 0.999964, -0.000312868, 0.00850185, 0.00849509, -0.00108792, -0.999886, 0.0003221, 0.999999, -0.00108623, 0.00288511, 1.12671, -0.000112632 ) +transform = Transform( 0.99996, -5.44234e-05, 0.00895482, 0.00895145, -0.00106593, -0.999901, 6.39674e-05, 1, -0.00106596, 0.0026558, 1.12801, -0.00012492 ) bone_name = "spine_2" [node name="Spatial" type="Spatial" parent="armature/Armature/Skeleton/BoneAttachment"] diff --git a/game/data/shaders/7_standard_character_shader_notex.tres b/game/data/shaders/7_standard_character_shader_notex.tres new file mode 100644 index 00000000..6de398fc --- /dev/null +++ b/game/data/shaders/7_standard_character_shader_notex.tres @@ -0,0 +1,12 @@ +[gd_resource type="Shader" format=2] + +[resource] +code = "shader_type spatial; +render_mode blend_mix,depth_draw_opaque,cull_back,specular_disabled,vertex_lighting; +uniform vec4 albedo : hint_color; + +void fragment() { + vec3 color = albedo.rgb * COLOR.rgb; + ALBEDO = color; +} +" diff --git a/game/player/CharacterSkeletonGD.gd b/game/player/CharacterSkeletonGD.gd index 877605d8..4ee89b20 100644 --- a/game/player/CharacterSkeletonGD.gd +++ b/game/player/CharacterSkeletonGD.gd @@ -28,14 +28,16 @@ export(bool) var refresh_in_editor : bool = false setget editor_build export(bool) var automatic_build : bool = false export(bool) var use_threads : bool = false +export(bool) var use_lod : bool = true + export(NodePath) var mesh_instance_path : NodePath var mesh_instance : MeshInstance = null export(NodePath) var skeleton_path : NodePath var skeleton : Skeleton -export(Material) var material : Material = null -var _material : Material = null +export(Array, Material) var materials : Array +var _materials : Array = Array() export (NodePath) var left_hand_attach_point_path : NodePath var left_hand_attach_point : CharacterSkeketonAttachPoint @@ -48,6 +50,12 @@ var root_attach_point : CharacterSkeketonAttachPoint export(Array, ItemVisual) var viss : Array +var meshes : Array + +var _current_lod_level : int = 0 + +var _generating : bool = false + var bone_names = { 0: "root", 1: "pelvis", @@ -89,7 +97,7 @@ var _texture_packer : TexturePacker var _textures : Array var _texture : Texture -var mesh : ArrayMesh = null +#var mesh : ArrayMesh = null var st : SurfaceTool = null var _thread_done : bool = false @@ -112,8 +120,9 @@ func _enter_tree(): torso_attach_point = get_node(torso_attach_point_path) as CharacterSkeketonAttachPoint root_attach_point = get_node(root_attach_point_path) as CharacterSkeketonAttachPoint - if _material == null: - _material = material.duplicate() + if _materials.size() != materials.size(): + for m in materials: + _materials.append(m.duplicate()) if not OS.can_use_threads(): use_threads = false @@ -135,9 +144,15 @@ func _process(delta): finish_build_mesh() set_process(false) _thread_done = false + _generating = false func _build_model(): + if _generating: + return + + _generating = true + if Engine.is_editor_hint() and not refresh_in_editor: set_process(false) return @@ -172,8 +187,10 @@ func build_mesh(data) -> void: prepare_textures() + meshes.clear() + st.clear() - st.set_material(_material) + st.set_material(_materials[0]) st.begin(Mesh.PRIMITIVE_TRIANGLES) var vertex_count : int = 0 @@ -244,8 +261,27 @@ func build_mesh(data) -> void: vertex_count += len(vertices) - mesh = st.commit() - mesh.surface_set_material(0, _material) + var arr : Array = st.commit_to_arrays() + + var mesh : ArrayMesh = ArrayMesh.new() + mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) + mesh.surface_set_material(0, _materials[0]) + meshes.append(mesh) + + if use_lod: + + arr = merge_mesh_array(arr) + var meshl2 : ArrayMesh = ArrayMesh.new() + meshl2.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) + meshl2.surface_set_material(0, _materials[1]) + meshes.append(meshl2) + + arr = bake_mesh_array_uv(arr, _texture) + arr[VisualServer.ARRAY_TEX_UV] = null + var meshl3 : ArrayMesh = ArrayMesh.new() + meshl3.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) + meshl3.surface_set_material(0, _materials[2]) + meshes.append(meshl3) # finish_build_mesh() _thread_done = true @@ -275,8 +311,13 @@ func prepare_textures() -> void: # var mat : SpatialMaterial = _material as SpatialMaterial # mat.albedo_texture = tex - var mat : ShaderMaterial = _material as ShaderMaterial + var mat : ShaderMaterial = _materials[0] as ShaderMaterial mat.set_shader_param("texture_albedo", tex) + + if use_lod: + var mat2 : ShaderMaterial = _materials[1] as ShaderMaterial + mat2.set_shader_param("texture_albedo", tex) + # mat.albedo_texture = tex _texture = tex @@ -290,14 +331,15 @@ func setup_build_mesh() -> void: get_animation_player().seek(0, true) func finish_build_mesh() -> void: - mesh_instance.mesh = mesh + mesh_instance.mesh = meshes[_current_lod_level] if get_animation_tree() != null: get_animation_tree().active = true - + + _generating = false func clear_mesh() -> void: - mesh = null + meshes.clear() if mesh_instance != null: mesh_instance.mesh = null @@ -326,3 +368,20 @@ func get_bone_name(skele_point : int) -> String: return bone_names[skele_point] return "" + +func set_lod_level(level : int) -> void: + if _current_lod_level == level: + return + + if meshes.size() == 0: + return + + if level < 0: + return + + if level >= meshes.size(): + level = meshes.size() - 1 + + _current_lod_level = level + + mesh_instance.mesh = meshes[_current_lod_level] diff --git a/game/player/Mob.gd b/game/player/Mob.gd index 5ce4c2a1..cb19fa6c 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -95,6 +95,15 @@ func _process(delta : float) -> void: get_body().hide() return else: +# var lod_level : int = int(dst / max_visible_distance_squared * 3.0) + + if dst < 400: #20^2 + get_character_skeleton().set_lod_level(0) + elif dst > 400 and dst < 900: #20^2, 30^2 + get_character_skeleton().set_lod_level(1) + else: + get_character_skeleton().set_lod_level(2) + if not get_body().visible: get_body().show() diff --git a/game/player/Mob.tscn b/game/player/Mob.tscn index eba66c81..a1094a3c 100644 --- a/game/player/Mob.tscn +++ b/game/player/Mob.tscn @@ -17,6 +17,7 @@ extents = Vector3( 0.216228, 0.0681041, 0.183397 ) body_path = NodePath("Body") character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") script = ExtResource( 2 ) +max_visible_distance = 100.0 [node name="NamePlate" parent="." instance=ExtResource( 3 )] max_distance = 50.0 @@ -37,4 +38,3 @@ transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 [node name="Model" type="Spatial" parent="Body/Rotation_Helper"] [node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )] -refresh_in_editor = false diff --git a/game/player/NetworkedPlayer.tscn b/game/player/NetworkedPlayer.tscn index 49630828..2555a695 100644 --- a/game/player/NetworkedPlayer.tscn +++ b/game/player/NetworkedPlayer.tscn @@ -33,7 +33,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) [node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 2 )] -refresh_in_editor = false [node name="NamePlate" parent="." instance=ExtResource( 3 )] max_distance = 50.0 diff --git a/game/scenes/World.tscn b/game/scenes/World.tscn index 6142ef8e..4b477aba 100644 --- a/game/scenes/World.tscn +++ b/game/scenes/World.tscn @@ -57,12 +57,11 @@ glow_hdr_luminance_cap = 1.0 ]] data_margin_start = 1 data_margin_end = 2 -max_concurrent_generations = 4 +max_concurrent_generations = 20 max_frame_chunk_build_steps = 4 library = ExtResource( 2 ) level_generator = SubResource( 1 ) voxel_scale = 3.0 -chunk_spawn_range = 3 script = ExtResource( 8 ) [node name="WorldEnvironment" type="WorldEnvironment" parent="."]