Added simple warped water.

main
Martin Felis 2024-10-11 11:19:03 +02:00
parent b74328f5b8
commit 12a94d73a8
11 changed files with 319 additions and 122 deletions

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cs2hld5w7r3nc"
path="res://.godot/imported/Pole.glb-e20447a24eb33887a30e1d9dce2d7255.scn"
[deps]
source_file="res://assets/buildings/LogCabin/Pole.glb"
dest_files=["res://.godot/imported/Pole.glb-e20447a24eb33887a30e1d9dce2d7255.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b7xcb0karhxrt"
path="res://.godot/imported/Wall.glb-10c7cc302fcb5aae2ae0fe7e7338f882.scn"
[deps]
source_file="res://assets/buildings/LogCabin/Wall.glb"
dest_files=["res://.godot/imported/Wall.glb-10c7cc302fcb5aae2ae0fe7e7338f882.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

View File

@ -0,0 +1,38 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbpa23uyq6nhf"
path.s3tc="res://.godot/imported/Wall_Wall.png-c61701623f737cff4636106deb172caa.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "333a863235775c1d09b020340ea35966"
}
[deps]
source_file="res://assets/buildings/LogCabin/Wall_Wall.png"
dest_files=["res://.godot/imported/Wall_Wall.png-c61701623f737cff4636106deb172caa.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://dcvf00ymfkdkd"]
[ext_resource type="PackedScene" uid="uid://cs2hld5w7r3nc" path="res://assets/buildings/LogCabin/Pole.glb" id="1_ryxc4"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_xw3l5"]
margin = 0.08
height = 1.0
radius = 0.25
[node name="Pole" instance=ExtResource("1_ryxc4")]
[node name="trunk" parent="." index="0"]
transform = Transform3D(0, -8.49068e-08, 1, 4.21469e-08, 2.01455, 4.21469e-08, -1, 8.49068e-08, 1.77636e-15, 0, 0, 0)
[node name="StaticBody3D" type="StaticBody3D" parent="." index="1"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.498063, 0)
shape = SubResource("CylinderShape3D_xw3l5")

View File

@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://b38ixieurg6db"]
[ext_resource type="PackedScene" uid="uid://b7xcb0karhxrt" path="res://assets/buildings/LogCabin/Wall.glb" id="1_gbwet"]
[sub_resource type="BoxShape3D" id="BoxShape3D_3l8ih"]
size = Vector3(1, 1, 0.333)
[node name="Wall" instance=ExtResource("1_gbwet")]
[node name="StaticBody3D" type="StaticBody3D" parent="." index="1"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"]
transform = Transform3D(-4.37114e-08, -4.21468e-08, 1, 4.21468e-08, 1, 4.21468e-08, -1, 4.21469e-08, -4.37114e-08, 0, 0.5, 0)
shape = SubResource("BoxShape3D_3l8ih")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=3 uid="uid://dmagdl5pi6jdj"]
[gd_scene load_steps=27 format=3 uid="uid://dmagdl5pi6jdj"]
[ext_resource type="MeshLibrary" uid="uid://dcpuitbu16j1a" path="res://assets/mesh_library.tres" id="1_q0eym"]
[ext_resource type="PackedScene" uid="uid://da5r82nvypfk4" path="res://objects/pickup_item.tscn" id="2_ccr0r"]
@ -12,14 +12,16 @@
[ext_resource type="Resource" uid="uid://cwerasgcfgx2p" path="res://data/items/hammer.tres" id="10_wch4q"]
[ext_resource type="PackedScene" uid="uid://ccjcjputsddrd" path="res://assets/scene_props/tree_pine.tscn" id="11_5olon"]
[ext_resource type="Texture2D" uid="uid://bq3b1hxl5ojh6" path="res://assets/icons/npc_emotes/attention.tres" id="12_3vn8y"]
[ext_resource type="PackedScene" uid="uid://dcvf00ymfkdkd" path="res://assets/custom/buildings/LogCabin/pole.tscn" id="12_mmbxl"]
[ext_resource type="PackedScene" uid="uid://b38ixieurg6db" path="res://assets/custom/buildings/LogCabin/wall.tscn" id="13_1kigt"]
[ext_resource type="PackedScene" uid="uid://2q8dhf61a7os" path="res://assets/characters/engineer.tscn" id="13_t16lh"]
[ext_resource type="PackedScene" uid="uid://dhpc2xvlfln7o" path="res://objects/actionable.tscn" id="14_8oq2l"]
[ext_resource type="Shader" uid="uid://4p6c77xksyue" path="res://world/water_simple_warping.tres" id="15_bmq7i"]
[ext_resource type="Resource" uid="uid://qgj4sfugsnav" path="res://dialogue/bridge_builder_missing_tool.dialogue" id="15_mqfyi"]
[ext_resource type="PackedScene" uid="uid://coi5tvcm4emba" path="res://assets/scene_props/tree.tscn" id="16_8m1m6"]
[ext_resource type="Script" path="res://quests/builder_missing_tool_quest.gd" id="16_dr1ca"]
[ext_resource type="Resource" uid="uid://bx2wi6c0f554" path="res://dialogue/default_dialogue.dialogue" id="18_4qvld"]
[ext_resource type="PackedScene" uid="uid://kpyvcyklt68g" path="res://assets/scene_props/bridge.tscn" id="18_yqn1p"]
[ext_resource type="Texture2D" uid="uid://psahbr51jdj6" path="res://assets/textures/water_c.png" id="19_n8o41"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_0soe6"]
height = 0.6
@ -27,12 +29,13 @@ radius = 0.158352
[sub_resource type="SphereShape3D" id="SphereShape3D_ugkqa"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_c4uk7"]
albedo_texture = ExtResource("19_n8o41")
uv1_triplanar = true
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u21xo"]
render_priority = 0
shader = ExtResource("15_bmq7i")
[sub_resource type="PlaneMesh" id="PlaneMesh_6aebw"]
material = SubResource("StandardMaterial3D_c4uk7")
lightmap_size_hint = Vector2i(1002, 1002)
material = SubResource("ShaderMaterial_u21xo")
size = Vector2(200, 200)
[node name="Level" type="Node3D"]
@ -90,6 +93,17 @@ item = ExtResource("9_xhfx0")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.24405, -4.76837e-06, -10.5962)
item = ExtResource("10_wch4q")
[node name="Vegetation" type="Node3D" parent="."]
[node name="TreePine" parent="Vegetation" instance=ExtResource("11_5olon")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.85673, -4.76837e-06, -3.38285)
[node name="TreePine2" parent="Vegetation" instance=ExtResource("16_8m1m6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.99916, -4.76837e-06, -3.04329)
[node name="TreePine3" parent="Vegetation" instance=ExtResource("11_5olon")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.26548, 0, 0)
[node name="Structures" type="Node3D" parent="."]
[node name="BridgeNorth" type="Node3D" parent="Structures"]
@ -101,10 +115,46 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.400034, 0)
[node name="poles3" parent="Structures/BridgeNorth" instance=ExtResource("18_yqn1p")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.398493, 0.670723)
[node name="Decorations" type="Node3D" parent="."]
[node name="LogCabin" type="Node3D" parent="Structures"]
[node name="TreePine" parent="Decorations" instance=ExtResource("11_5olon")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.26548, 0, 0)
[node name="Pole" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")]
transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 8, 0, -0.5)
[node name="Wall" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -1)
[node name="Pole2" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")]
transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 11.2851, 0, -0.5)
[node name="Wall2" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2851, 0, -1)
[node name="Wall3" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 8.65776, 0, -0.485988)
[node name="Wall5" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 10.6823, 0, -0.485988)
[node name="Pole3" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")]
transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 8, 0, -2.76883)
[node name="Pole4" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")]
transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 11.2851, 0, -2.76883)
[node name="Wall6" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 8.65776, 0, -2.75482)
[node name="Wall7" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 9.69133, 0, -2.75482)
[node name="Wall8" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 10.6823, 0, -2.75482)
[node name="Wall9" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -2.00416)
[node name="Wall10" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2851, 0, -2.00416)
[node name="Quests" type="Node" parent="."]
@ -150,12 +200,6 @@ default_dialogue_resource = ExtResource("18_4qvld")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Quests/BuilderMissingTool/Merchant/Actionable"]
shape = SubResource("SphereShape3D_ugkqa")
[node name="TreePine" parent="." instance=ExtResource("11_5olon")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.85673, -4.76837e-06, -3.38285)
[node name="Tree" parent="." instance=ExtResource("16_8m1m6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.99916, -4.76837e-06, -3.04329)
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
[node name="Water" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.239327, 0)
mesh = SubResource("PlaneMesh_6aebw")

View File

@ -1,106 +0,0 @@
shader_type spatial;
//render_mode specular_phong, cull_disabled;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform float speed: hint_range(-1, 1) = 0.0;
uniform sampler2D noise1;
uniform sampler2D noise2;
uniform sampler2D normalmap: hint_normal;
uniform vec4 color = vec4(0.0352941, 0.658824, 0.929412, 0.635294);
uniform vec4 deep_water = vec4(0.14902, 0.329412, 0.501961, 1);
//depth-fade var
uniform float beer_law_factor = 2.0;
uniform float _distance = 0.0;
//foam var
uniform vec4 edge_color = vec4(1);
uniform float edge_scale = 0.25;
uniform float near = 0.1;
uniform float far = 100.f;
// wave var
uniform vec2 wave_strength = vec2(0.5, 0.25);
uniform vec2 wave_frequ = vec2(12.0, 12.0);
uniform vec2 time_factor = vec2(1.0, 2.0);
float waves(vec2 pos, float time) {
return (wave_strength.y * sin(pos.y * wave_frequ.y + time * time_factor.y)) + (wave_strength.x * sin(pos.x * wave_frequ.x + time * time_factor.x));
}
void vertex() {
VERTEX.y += waves(VERTEX.xy, TIME);
}
float rim(float depth) {
depth = 2.0f * depth - 1.0f;
return near * far / (far + depth * (near - far));
}
float calc_depth_fade(float depth, mat4 projection_matrix,
vec4 fragcoord, float beer_factor, float __distance, vec3 vertex) {
float scene_depth = depth;
scene_depth = scene_depth * 2.0 - 1.0;
scene_depth = projection_matrix[3][2] / (scene_depth + projection_matrix[2][2]);
scene_depth = scene_depth + vertex.z; // z is negative
// application of beers law
scene_depth = exp(-scene_depth * beer_factor);
float screen_depth = fragcoord.z;
float depth_fade = (scene_depth - screen_depth) / __distance;
depth_fade = clamp(depth_fade, 0.0, 1.0);
return depth_fade;
}
void fragment() {
float time = TIME * speed;
vec3 n1 = texture(noise1, UV + time).rgb;
vec3 n2 = texture(noise2, UV - time * 0.2).rgb;
vec2 uv_movement = UV * 4.0f;
uv_movement += TIME * speed * 4.0f;
float sum = (n1.r + n2.r) - 1.0f;
float z_depth = rim(texture(DEPTH_TEXTURE, SCREEN_UV).x);
float z_pos = rim(FRAGCOORD.z);
float diff = z_depth - z_pos;
// depth-fade
float z_depth_fade = calc_depth_fade(texture(DEPTH_TEXTURE, SCREEN_UV).x, PROJECTION_MATRIX, FRAGCOORD, beer_law_factor, _distance, VERTEX);
float z_fade = rim(FRAGCOORD.z);
float fade_diff = z_depth_fade - z_fade;
vec4 gradientcolor = mix(color, deep_water, z_depth_fade);
vec2 displacement = vec2(sum * 0.1);
diff += displacement.x * 70.0f;
vec4 col = mix(edge_color, gradientcolor, step(edge_scale, diff));
vec4 alpha = texture(SCREEN_TEXTURE, SCREEN_UV + displacement);
float fin = 0.0;
if (sum > 0.0 && sum < 0.4) fin = 0.1;
if (sum > 0.4 && sum < 0.8) fin = 0.0;
if (sum > 0.8) fin = 1.0f;
// konvertier fin in vec3 um
ALBEDO = vec3(fin) + mix(alpha.rgb, col.rgb, gradientcolor.a);
//NORMALMAP = texture(normalmap, uv_movement).rgb;
ROUGHNESS = 0.1;
}

View File

@ -0,0 +1,116 @@
[gd_resource type="VisualShader" load_steps=12 format=3 uid="uid://4p6c77xksyue"]
[ext_resource type="Texture2D" uid="uid://psahbr51jdj6" path="res://assets/textures/water_c.png" id="1_411gm"]
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_jdsi0"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0.1, 0.1)]
op_type = 0
operator = 2
[sub_resource type="VisualShaderNodeReroute" id="VisualShaderNodeReroute_r45yy"]
default_input_values = [0, Vector2(0, 0)]
port_type = 3
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_l6sy6"]
texture = ExtResource("1_411gm")
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_v5ed2"]
input_name = "uv"
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_qai4c"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(200, 200)]
op_type = 0
operator = 2
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_tj5io"]
default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)]
op_type = 0
[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_ymjaa"]
function = 0
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_wxljw"]
input_name = "time"
[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_p7aqe"]
function = 1
[sub_resource type="VisualShaderNodeVectorCompose" id="VisualShaderNodeVectorCompose_cka31"]
op_type = 0
[resource]
code = "shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
uniform sampler2D tex_frg_2;
void fragment() {
// Input:7
float n_out7p0 = TIME;
// FloatFunc:6
float n_out6p0 = sin(n_out7p0);
// FloatFunc:8
float n_out8p0 = cos(n_out7p0);
// VectorCompose:9
vec2 n_out9p0 = vec2(n_out6p0, n_out8p0);
// VectorOp:10
vec2 n_in10p1 = vec2(0.10000, 0.10000);
vec2 n_out10p0 = n_out9p0 * n_in10p1;
// Input:3
vec2 n_out3p0 = UV;
// VectorOp:4
vec2 n_in4p1 = vec2(200.00000, 200.00000);
vec2 n_out4p0 = n_out3p0 * n_in4p1;
// VectorOp:5
vec2 n_out5p0 = n_out10p0 + n_out4p0;
// Texture2D:2
vec4 n_out2p0 = texture(tex_frg_2, n_out5p0);
// Output:0
ALBEDO = vec3(n_out2p0.xyz);
}
"
graph_offset = Vector2(-535.526, -182.815)
nodes/fragment/0/position = Vector2(720, 140)
nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_l6sy6")
nodes/fragment/2/position = Vector2(520, 140)
nodes/fragment/3/node = SubResource("VisualShaderNodeInput_v5ed2")
nodes/fragment/3/position = Vector2(-840, 460)
nodes/fragment/4/node = SubResource("VisualShaderNodeVectorOp_qai4c")
nodes/fragment/4/position = Vector2(-420, 300)
nodes/fragment/5/node = SubResource("VisualShaderNodeVectorOp_tj5io")
nodes/fragment/5/position = Vector2(40, 120)
nodes/fragment/6/node = SubResource("VisualShaderNodeFloatFunc_ymjaa")
nodes/fragment/6/position = Vector2(-680, 40)
nodes/fragment/7/node = SubResource("VisualShaderNodeInput_wxljw")
nodes/fragment/7/position = Vector2(-1000, 100)
nodes/fragment/8/node = SubResource("VisualShaderNodeFloatFunc_p7aqe")
nodes/fragment/8/position = Vector2(-640, 160)
nodes/fragment/9/node = SubResource("VisualShaderNodeVectorCompose_cka31")
nodes/fragment/9/position = Vector2(-420, 40)
nodes/fragment/10/node = SubResource("VisualShaderNodeVectorOp_jdsi0")
nodes/fragment/10/position = Vector2(-220, 60)
nodes/fragment/11/node = SubResource("VisualShaderNodeReroute_r45yy")
nodes/fragment/11/position = Vector2(188.812, 194.775)
nodes/fragment/connections = PackedInt32Array(2, 0, 0, 0, 3, 0, 4, 0, 4, 0, 5, 1, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 9, 0, 8, 0, 9, 1, 5, 0, 2, 0, 5, 0, 11, 0, 9, 0, 10, 0, 10, 0, 5, 0)