From 885276de464f1ff02fa3de05a5839bded3ff7ee7 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 4 Feb 2024 00:03:25 +0100 Subject: [PATCH] Improved graphics --- client/Main.tscn | 32 +++++++++++++++++++----------- client/enemy/slime/Slime.tscn | 2 +- client/grass/grass_material.tres | 11 ++++++++++ client/grass/grass_shader.gdshader | 28 ++++++++++++++++++++++++++ client/player/Player.tscn | 9 +++++++-- client/project.godot | 4 ++++ client/ui/theme/theme.tres | 10 +++++----- client/world/CameraPractical.tres | 4 ++++ client/world/Environment.tres | 8 ++++---- 9 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 client/grass/grass_material.tres create mode 100644 client/grass/grass_shader.gdshader diff --git a/client/Main.tscn b/client/Main.tscn index 27e28ed..de63e5f 100644 --- a/client/Main.tscn +++ b/client/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://b40y7iuskv1ar"] +[gd_scene load_steps=25 format=3 uid="uid://b40y7iuskv1ar"] [ext_resource type="Script" path="res://Main.gd" id="1_cw3ws"] [ext_resource type="Script" path="res://network/Client.gd" id="2_8hxcx"] @@ -13,19 +13,21 @@ [ext_resource type="Script" path="res://network/Chat.gd" id="10_y3len"] [ext_resource type="Script" path="res://world/Sun.gd" id="11_4jb08"] [ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="12_cscto"] -[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://assets/models/tree/Tree.blend" id="14_7jtdl"] +[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://assets/tree/Tree.blend" id="14_7jtdl"] [ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://world/CameraPractical.tres" id="14_e2m00"] [ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="15_hgl78"] [ext_resource type="Script" path="res://world/PlayerManager.gd" id="16_dp6bj"] [ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="17_43qhq"] +[ext_resource type="Material" uid="uid://bdsblfaxbipaa" path="res://grass/grass_material.tres" id="18_tja64"] [ext_resource type="Script" path="res://camera/Camera.gd" id="18_wogcj"] +[ext_resource type="MultiMesh" uid="uid://dog5aq5n2q025" path="res://assets/grass/grass.multimesh" id="19_ae26a"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lp0k7"] -albedo_color = Color(0.184314, 0.113725, 0, 1) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_he5c5"] +albedo_color = Color(0.0156863, 0.654902, 0.501961, 1) -[sub_resource type="BoxMesh" id="BoxMesh_j5fsa"] -material = SubResource("StandardMaterial3D_lp0k7") -size = Vector3(100, 1, 100) +[sub_resource type="PlaneMesh" id="PlaneMesh_lb6xk"] +material = SubResource("StandardMaterial3D_he5c5") +size = Vector2(25, 25) [sub_resource type="BoxShape3D" id="BoxShape3D_yg2lt"] size = Vector3(100, 1, 100) @@ -88,10 +90,10 @@ autostart = true [node name="World" type="Node3D" parent="."] -[node name="CameraPivot" type="Node3D" parent="World"] +[node name="Pivot" type="Node3D" parent="World"] -[node name="Camera" type="Camera3D" parent="World/CameraPivot" node_paths=PackedStringArray("center")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 15, 15) +[node name="Camera" type="Camera3D" parent="World/Pivot" node_paths=PackedStringArray("center")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7, 15) current = true fov = 30.0 size = 10.0 @@ -102,6 +104,7 @@ follow_speed = 5.0 [node name="Sun" type="DirectionalLight3D" parent="World"] transform = Transform3D(0.984808, 0.122788, -0.122788, 0, 0.707107, 0.707107, 0.173648, -0.696364, 0.696364, 0, 3, 0) +light_energy = 0.1 shadow_enabled = true script = ExtResource("11_4jb08") @@ -129,14 +132,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.00829, 1.28057, -1.95247) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.53558, 1.28057, -0.306177) [node name="Floor" type="MeshInstance3D" parent="World"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0) -mesh = SubResource("BoxMesh_j5fsa") +mesh = SubResource("PlaneMesh_lb6xk") [node name="StaticBody3D" type="StaticBody3D" parent="World/Floor"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0) [node name="CollisionShape3D" type="CollisionShape3D" parent="World/Floor/StaticBody3D"] shape = SubResource("BoxShape3D_yg2lt") +[node name="Grass" type="MultiMeshInstance3D" parent="World"] +material_override = ExtResource("18_tja64") +cast_shadow = 0 +multimesh = ExtResource("19_ae26a") + [node name="Players" type="Node3D" parent="."] unique_name_in_owner = true script = ExtResource("16_dp6bj") diff --git a/client/enemy/slime/Slime.tscn b/client/enemy/slime/Slime.tscn index e090f8c..534cf3f 100644 --- a/client/enemy/slime/Slime.tscn +++ b/client/enemy/slime/Slime.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=8 format=3 uid="uid://cb2t7bvvf3gwh"] -[ext_resource type="PackedScene" uid="uid://b358op5h1y83m" path="res://assets/models/slime/Slime.blend" id="1_1h1hj"] +[ext_resource type="PackedScene" uid="uid://b358op5h1y83m" path="res://assets/slime/Slime.blend" id="1_1h1hj"] [ext_resource type="Script" path="res://enemy/Enemy.gd" id="1_r5888"] [ext_resource type="PackedScene" uid="uid://2bbycjulf00g" path="res://character/health/HealthComponent.tscn" id="2_fsqxc"] diff --git a/client/grass/grass_material.tres b/client/grass/grass_material.tres new file mode 100644 index 0000000..c5d7ec9 --- /dev/null +++ b/client/grass/grass_material.tres @@ -0,0 +1,11 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bdsblfaxbipaa"] + +[ext_resource type="Shader" path="res://grass/grass_shader.gdshader" id="1_7qi6v"] + +[resource] +render_priority = 0 +shader = ExtResource("1_7qi6v") +shader_parameter/color_bottom = Color(0.0156863, 0.654902, 0.501961, 1) +shader_parameter/color_top = Color(0.592157, 0.917647, 0.368627, 1) +shader_parameter/wind = Vector3(0.1, 0, 0.1) +shader_parameter/wind_speed = Vector3(1, 0, 1) diff --git a/client/grass/grass_shader.gdshader b/client/grass/grass_shader.gdshader new file mode 100644 index 0000000..aa9148a --- /dev/null +++ b/client/grass/grass_shader.gdshader @@ -0,0 +1,28 @@ +shader_type spatial; +render_mode shadows_disabled, cull_disabled; + +uniform vec3 color_bottom : source_color; +uniform vec3 color_top : source_color; +uniform vec3 wind = vec3(0.1, 0.0, 0.1); +uniform vec3 wind_speed = vec3(1.0, 0.0, 1.0); + +void vertex() { + float distance_to_ground = 1.0 - UV.y; + + vec4 sway = vec4( + sin(NODE_POSITION_WORLD.x + TIME * wind_speed.x) * distance_to_ground * wind.x, + 0.0, + cos(NODE_POSITION_WORLD.z + TIME * wind_speed.z) * distance_to_ground * wind.z, + 1.0 + ); + + VERTEX += (sway * MODEL_MATRIX).xyz; +} + +void fragment() { + ALBEDO = mix(color_top, color_bottom, UV.y); + + if (!FRONT_FACING) { + NORMAL = -NORMAL; + } +} diff --git a/client/player/Player.tscn b/client/player/Player.tscn index 9aa0763..d9e5fbe 100644 --- a/client/player/Player.tscn +++ b/client/player/Player.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=8 format=3 uid="uid://2lcnu3dy54lx"] [ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"] -[ext_resource type="PackedScene" uid="uid://dnr3o1rbkqpgu" path="res://assets/models/female/Female.blend" id="2_8nah6"] +[ext_resource type="PackedScene" uid="uid://dnr3o1rbkqpgu" path="res://assets/female/Female.blend" id="2_8nah6"] [ext_resource type="PackedScene" uid="uid://2bbycjulf00g" path="res://character/health/HealthComponent.tscn" id="2_np5ag"] -[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/ui/font/ubuntu_nf_regular.ttf" id="4_76ehj"] +[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/font/ubuntu_nf_regular.ttf" id="4_76ehj"] [ext_resource type="Script" path="res://player/Animation.gd" id="5_d4uw4"] [ext_resource type="AnimationLibrary" uid="uid://c355hn01ye2hd" path="res://assets/animations/human.blend" id="6_fl6or"] @@ -25,9 +25,14 @@ shape = SubResource("CapsuleShape3D_2f50n") [node name="Label" type="Label3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +pixel_size = 0.001 billboard = 1 +render_priority = 1 +outline_modulate = Color(0, 0.498039, 1, 0.498039) text = "Player" font = ExtResource("4_76ehj") +font_size = 128 +outline_size = 6 [node name="Animation" type="Node" parent="." node_paths=PackedStringArray("character", "animation_player")] script = ExtResource("5_d4uw4") diff --git a/client/project.godot b/client/project.godot index 0e7a160..3ed4713 100644 --- a/client/project.godot +++ b/client/project.godot @@ -108,3 +108,7 @@ open_chat={ 3d/run_on_separate_thread=true common/physics_ticks_per_second=100 + +[rendering] + +anti_aliasing/quality/use_taa=true diff --git a/client/ui/theme/theme.tres b/client/ui/theme/theme.tres index aa679cd..7c5d203 100644 --- a/client/ui/theme/theme.tres +++ b/client/ui/theme/theme.tres @@ -1,10 +1,10 @@ [gd_resource type="Theme" load_steps=2 format=3 uid="uid://caqphxkvcu3tb"] -[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/ui/font/ubuntu_nf_regular.ttf" id="1_1unma"] +[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/font/ubuntu_nf_regular.ttf" id="1_1unma"] [resource] default_font = ExtResource("1_1unma") -MarginContainer/constants/margin_bottom = 5 -MarginContainer/constants/margin_left = 5 -MarginContainer/constants/margin_right = 5 -MarginContainer/constants/margin_top = 5 +MarginContainer/constants/margin_bottom = 12 +MarginContainer/constants/margin_left = 12 +MarginContainer/constants/margin_right = 12 +MarginContainer/constants/margin_top = 12 diff --git a/client/world/CameraPractical.tres b/client/world/CameraPractical.tres index f3539e6..7d1aa10 100644 --- a/client/world/CameraPractical.tres +++ b/client/world/CameraPractical.tres @@ -1,3 +1,7 @@ [gd_resource type="CameraAttributesPractical" format=3 uid="uid://b835orxyqq6w5"] [resource] +dof_blur_far_enabled = true +dof_blur_far_distance = 25.0 +dof_blur_far_transition = 25.0 +dof_blur_near_enabled = true diff --git a/client/world/Environment.tres b/client/world/Environment.tres index 74acbb2..63b6d55 100644 --- a/client/world/Environment.tres +++ b/client/world/Environment.tres @@ -1,7 +1,8 @@ [gd_resource type="Environment" load_steps=3 format=3 uid="uid://dixa0yso2s1u3"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_4vcsp"] -ground_bottom_color = Color(0.568627, 0.501961, 0.423529, 1) +sky_horizon_color = Color(0.647059, 0.654902, 0.670588, 1) +ground_bottom_color = Color(0.647059, 0.654902, 0.670588, 1) [sub_resource type="Sky" id="Sky_bq3yo"] sky_material = SubResource("ProceduralSkyMaterial_4vcsp") @@ -13,9 +14,8 @@ sky = SubResource("Sky_bq3yo") ambient_light_source = 3 reflected_light_source = 2 tonemap_mode = 2 -ssao_intensity = 16.0 -glow_bloom = 0.5 -volumetric_fog_density = 0.0 +glow_enabled = true +glow_bloom = 0.2 adjustment_enabled = true adjustment_contrast = 1.1 adjustment_saturation = 1.1