F O G
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 16s
Create tag and build when new code gets to main / Export (push) Successful in 5m14s

This commit is contained in:
2025-10-15 13:57:44 +02:00
parent 7312b2b22b
commit e39620ce52
41 changed files with 944 additions and 1151 deletions

View File

@@ -0,0 +1,88 @@
shader_type spatial;
uniform vec3 albedo : source_color;
uniform vec3 albedo2 : source_color;
uniform float metallic : hint_range(0.0, 1.0, 0.01) = 0;
uniform float roughness : hint_range(0.0, 1.0, 0.01) = 0.02;
uniform sampler2D texture_normal;
uniform sampler2D texture_normal2;
uniform vec2 wave_direction = vec2(0.0, 0.0);
uniform vec2 wave_direction2 = vec2(0.0, 0.0);
uniform float time_scale : hint_range(0.0, 0.2, 0.005) = 0.025;
uniform sampler2D depth_texture : hint_depth_texture, repeat_disable, filter_nearest;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
uniform vec4 color_deep : source_color;
uniform vec4 color_shallow : source_color;
uniform float beers_law = 2.0;
uniform float depth_offset = -0.75;
uniform float depth_color_change = 5.0;
uniform float edge_scale = 0.1;
uniform float near = 1.0;
uniform float far = 100.0;
uniform vec3 edge_color : source_color;
uniform sampler2D waves;
uniform float noise_scale = 10.0;
uniform float height_scale = 0.15;
varying float height;
varying vec3 world_pos;
float fresnel(float amount, vec3 normal, vec3 view)
{
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0)), amount);
}
float edge(float depth)
{
depth = 1.0 - 2.0*depth;
return near * far / (far + depth * (near - far));
}
void vertex() {
world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
height = texture(waves, world_pos.xz / noise_scale + TIME * time_scale).r;
VERTEX.y += height * height_scale;
}
void fragment() {
float depth_tex = clamp(pow(texture(depth_texture, SCREEN_UV).r * depth_color_change, 5.0), 0.0, 1.0);
float depth = PROJECTION_MATRIX[3][2] / (clamp(depth_tex, 0.0, 1.0) + PROJECTION_MATRIX[2][2]);
float depth_blend = exp((depth+VERTEX.z + depth_offset) * -beers_law);
depth_blend = clamp(1.0 - depth_blend, 0.0, 1.0);
float depth_blend_power = clamp(pow(depth_blend, 2.5), 0.0, 1.0);
vec3 screen_color = textureLod(screen_texture, SCREEN_UV, 0.0).rgb;
vec3 depth_color = mix(color_shallow.rgb, color_deep.rgb, depth_blend_power);
vec3 color = mix(screen_color*depth_color, depth_color*0.25, depth_blend_power*0.5);
float z_depth = edge(texture(depth_texture, SCREEN_UV).x);
float z_pos = edge(FRAGCOORD.z);
float z_dif = z_depth - z_pos;
vec2 time = (TIME * wave_direction) * time_scale;
vec2 time2 = (TIME * wave_direction2) * time_scale;
vec3 normal = mix(texture(texture_normal, world_pos.xz/(noise_scale*2.0) + time).rgb, texture(texture_normal2, world_pos.xz/noise_scale + time2).rgb, 0.5);
float fresnel_alpha = fresnel(5.0, NORMAL, VIEW);
vec3 surface_color = mix(albedo, albedo2, fresnel_alpha);
vec3 surface_and_depth_color = mix(surface_color, color, 0.75);
vec3 with_edges = mix(edge_color, surface_color, step(edge_scale, z_dif));
ALBEDO = vec3(surface_color);
METALLIC = metallic;
ROUGHNESS = roughness;
NORMAL_MAP = normal;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

@@ -0,0 +1 @@
uid://l11jog608jo1

56
assets/water/water.tres Normal file
View File

@@ -0,0 +1,56 @@
[gd_resource type="ShaderMaterial" load_steps=8 format=3 uid="uid://bibpkiinj8gq7"]
[ext_resource type="Shader" uid="uid://l11jog608jo1" path="res://assets/water/water.gdshader" id="1_441rt"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_441rt"]
noise_type = 3
fractal_type = 2
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_qceba"]
noise = SubResource("FastNoiseLite_441rt")
seamless = true
as_normal_map = true
bump_strength = 6.9
[sub_resource type="FastNoiseLite" id="FastNoiseLite_v5uja"]
noise_type = 3
seed = 10
fractal_type = 2
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_oqpjr"]
noise = SubResource("FastNoiseLite_v5uja")
seamless = true
as_normal_map = true
bump_strength = 2.4
[sub_resource type="FastNoiseLite" id="FastNoiseLite_qceba"]
fractal_octaves = 3
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_v5uja"]
noise = SubResource("FastNoiseLite_qceba")
seamless = true
[resource]
render_priority = 0
shader = ExtResource("1_441rt")
shader_parameter/albedo = Color(0, 0.32156864, 0.43137255, 1)
shader_parameter/albedo2 = Color(0.23849446, 0.558395, 0.6758933, 1)
shader_parameter/metallic = 0.01999999955296
shader_parameter/roughness = 0.01999999955296
shader_parameter/texture_normal = SubResource("NoiseTexture2D_qceba")
shader_parameter/texture_normal2 = SubResource("NoiseTexture2D_oqpjr")
shader_parameter/wave_direction = Vector2(2, 0)
shader_parameter/wave_direction2 = Vector2(0, 1)
shader_parameter/time_scale = 0.0249999994412
shader_parameter/color_deep = Color(0, 0.32156864, 0.43137255, 1)
shader_parameter/color_shallow = Color(0.37512296, 0.8792228, 0.9831924, 1)
shader_parameter/beers_law = 0.01
shader_parameter/depth_offset = -0.75
shader_parameter/depth_color_change = 73.16
shader_parameter/edge_scale = 0.395
shader_parameter/near = 1.0
shader_parameter/far = 100.0
shader_parameter/edge_color = Color(0.816028, 0.99999994, 0.9852888, 1)
shader_parameter/waves = SubResource("NoiseTexture2D_v5uja")
shader_parameter/noise_scale = 10.0
shader_parameter/height_scale = 0.1

13
assets/water/water.tscn Normal file
View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://c066hc7yu36wx"]
[ext_resource type="Material" uid="uid://bibpkiinj8gq7" path="res://assets/water/water.tres" id="1_6nw2d"]
[sub_resource type="PlaneMesh" id="PlaneMesh_i6g1k"]
size = Vector2(1, 1)
subdivide_width = 200
subdivide_depth = 200
[node name="Water" type="MeshInstance3D"]
cast_shadow = 0
mesh = SubResource("PlaneMesh_i6g1k")
surface_material_override/0 = ExtResource("1_6nw2d")