Rework island water and shop character
This commit is contained in:
parent
0d50c324e9
commit
352350157b
65 changed files with 1144 additions and 1120 deletions
|
|
@ -1,16 +1,16 @@
|
|||
shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_never, cull_disabled, unshaded;
|
||||
|
||||
uniform vec4 lead_color : source_color = vec4(0.620, 0.875, 0.855, 1.0);
|
||||
uniform vec4 trail_color : source_color = vec4(0.430, 0.780, 0.770, 1.0);
|
||||
uniform float ribbon_width : hint_range(0.2, 2.0, 0.01) = 0.85;
|
||||
uniform float land_inset : hint_range(0.0, 0.4, 0.01) = 0.10;
|
||||
uniform vec4 lead_color : source_color = vec4(0.780, 0.960, 0.930, 1.0);
|
||||
uniform vec4 trail_color : source_color = vec4(0.500, 0.840, 0.820, 1.0);
|
||||
uniform float ribbon_width : hint_range(0.2, 2.0, 0.01) = 1.35;
|
||||
uniform float land_inset : hint_range(0.0, 0.4, 0.01) = 0.12;
|
||||
uniform float tide_speed : hint_range(0.1, 3.0, 0.01) = 1.42;
|
||||
uniform float tide_distance : hint_range(0.0, 0.6, 0.01) = 0.30;
|
||||
uniform float lead_width : hint_range(0.01, 0.2, 0.005) = 0.065;
|
||||
uniform float trail_width : hint_range(0.02, 0.4, 0.005) = 0.18;
|
||||
uniform float lead_strength : hint_range(0.0, 1.0, 0.01) = 0.48;
|
||||
uniform float trail_strength : hint_range(0.0, 1.0, 0.01) = 0.25;
|
||||
uniform float tide_distance : hint_range(0.0, 0.6, 0.01) = 0.42;
|
||||
uniform float lead_width : hint_range(0.01, 0.2, 0.005) = 0.14;
|
||||
uniform float trail_width : hint_range(0.02, 0.4, 0.005) = 0.32;
|
||||
uniform float lead_strength : hint_range(0.0, 1.0, 0.01) = 0.88;
|
||||
uniform float trail_strength : hint_range(0.0, 1.0, 0.01) = 0.52;
|
||||
uniform float phase_scale : hint_range(0.001, 0.2, 0.001) = 0.035;
|
||||
uniform float phase_strength : hint_range(0.0, 2.0, 0.01) = 0.55;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
[resource]
|
||||
render_priority = 1
|
||||
shader = ExtResource("1_shader")
|
||||
shader_parameter/lead_color = Color(0.619608, 0.87451, 0.854902, 1)
|
||||
shader_parameter/trail_color = Color(0.431373, 0.780392, 0.768627, 1)
|
||||
shader_parameter/ribbon_width = 0.85
|
||||
shader_parameter/land_inset = 0.1
|
||||
shader_parameter/lead_color = Color(0.78, 0.96, 0.93, 1)
|
||||
shader_parameter/trail_color = Color(0.5, 0.84, 0.82, 1)
|
||||
shader_parameter/ribbon_width = 1.35
|
||||
shader_parameter/land_inset = 0.12
|
||||
shader_parameter/tide_speed = 1.42
|
||||
shader_parameter/tide_distance = 0.3
|
||||
shader_parameter/lead_width = 0.065
|
||||
shader_parameter/trail_width = 0.18
|
||||
shader_parameter/lead_strength = 0.48
|
||||
shader_parameter/trail_strength = 0.25
|
||||
shader_parameter/tide_distance = 0.42
|
||||
shader_parameter/lead_width = 0.14
|
||||
shader_parameter/trail_width = 0.32
|
||||
shader_parameter/lead_strength = 0.88
|
||||
shader_parameter/trail_strength = 0.52
|
||||
shader_parameter/phase_scale = 0.035
|
||||
shader_parameter/phase_strength = 0.55
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/grass_lite.png" id="1_texture"]
|
||||
[ext_resource type="Shader" path="res://world/materials/terrain_surface_projection.gdshader" id="2_shader"]
|
||||
|
||||
[resource]
|
||||
resource_name = "Starter Island Grass"
|
||||
shader = ExtResource("2_shader")
|
||||
shader_parameter/albedo_texture = ExtResource("1_texture")
|
||||
shader_parameter/albedo_tint = Color(1, 1, 1, 1)
|
||||
shader_parameter/tile_world_size = 2.5
|
||||
shader_parameter/blend_sharpness = 6.0
|
||||
shader_parameter/top_projection_bias = 2.0
|
||||
shader_parameter/roughness = 1.0
|
||||
shader_parameter/specular = 0.5
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/sand.png" id="1_texture"]
|
||||
[ext_resource type="Shader" path="res://world/materials/terrain_surface_projection.gdshader" id="2_shader"]
|
||||
|
||||
[resource]
|
||||
resource_name = "Starter Island Sand"
|
||||
shader = ExtResource("2_shader")
|
||||
shader_parameter/albedo_texture = ExtResource("1_texture")
|
||||
shader_parameter/albedo_tint = Color(1, 1, 1, 1)
|
||||
shader_parameter/tile_world_size = 2.5
|
||||
shader_parameter/blend_sharpness = 6.0
|
||||
shader_parameter/top_projection_bias = 2.0
|
||||
shader_parameter/roughness = 1.0
|
||||
shader_parameter/specular = 0.5
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/sandstone_heavy.png" id="1_texture"]
|
||||
[ext_resource type="Shader" path="res://world/materials/terrain_surface_projection.gdshader" id="2_shader"]
|
||||
|
||||
[resource]
|
||||
resource_name = "Starter Island Sandstone"
|
||||
shader = ExtResource("2_shader")
|
||||
shader_parameter/albedo_texture = ExtResource("1_texture")
|
||||
shader_parameter/albedo_tint = Color(1, 1, 1, 1)
|
||||
shader_parameter/tile_world_size = 2.5
|
||||
shader_parameter/blend_sharpness = 6.0
|
||||
shader_parameter/top_projection_bias = 2.0
|
||||
shader_parameter/roughness = 1.0
|
||||
shader_parameter/specular = 0.0
|
||||
|
|
@ -29,9 +29,29 @@ uniform float contour_corner_variation : hint_range(0.0, 0.15, 0.005) = 0.045;
|
|||
uniform float contour_smoothing_pixels : hint_range(0.0, 2.5, 0.05) = 1.0;
|
||||
uniform float contour_smoothing_strength : hint_range(0.0, 1.0, 0.01) = 0.72;
|
||||
uniform float contour_depth_reject : hint_range(0.05, 2.0, 0.01) = 0.60;
|
||||
uniform float shoreline_horizontal_reach : hint_range(0.05, 1.5, 0.01) = 0.32;
|
||||
uniform float contact_fade_depth : hint_range(0.0, 0.1, 0.001) = 0.018;
|
||||
uniform float open_water_drift_scale : hint_range(0.001, 0.3, 0.001) = 0.018;
|
||||
uniform vec2 open_water_drift_speed = vec2(0.010, -0.007);
|
||||
uniform float open_water_drift_strength : hint_range(0.0, 0.08, 0.001) = 0.045;
|
||||
uniform vec4 surface_mark_color : source_color = vec4(0.580, 0.850, 0.860, 1.0);
|
||||
uniform vec2 surface_mark_density = vec2(1.30, 0.90);
|
||||
uniform vec2 surface_mark_drift = vec2(0.045, -0.032);
|
||||
uniform float surface_mark_strength : hint_range(0.0, 0.3, 0.005) = 0.12;
|
||||
uniform float surface_mottle_scale : hint_range(0.01, 1.0, 0.01) = 0.11;
|
||||
uniform vec2 surface_mottle_speed = vec2(-0.018, 0.013);
|
||||
uniform float surface_mottle_strength : hint_range(0.0, 0.2, 0.005) = 0.07;
|
||||
uniform vec2 shoreline_mark_density = vec2(4.60, 3.20);
|
||||
uniform vec2 shoreline_mark_drift = vec2(0.085, -0.060);
|
||||
uniform float shoreline_mark_depth : hint_range(0.1, 2.0, 0.01) = 0.95;
|
||||
uniform float shoreline_mark_strength : hint_range(0.0, 1.0, 0.01) = 0.82;
|
||||
uniform float shoreline_base_fill : hint_range(0.0, 1.0, 0.01) = 0.32;
|
||||
uniform float shoreline_opacity_boost : hint_range(0.0, 0.5, 0.01) = 0.26;
|
||||
uniform float surface_highlight_night_floor : hint_range(0.0, 1.0, 0.01) = 0.72;
|
||||
uniform float shoreline_minimum_reach : hint_range(0.1, 1.0, 0.01) = 0.48;
|
||||
uniform float shoreline_crest_width : hint_range(0.02, 0.5, 0.01) = 0.13;
|
||||
uniform float shoreline_trail_spacing : hint_range(0.05, 0.8, 0.01) = 0.28;
|
||||
uniform float shoreline_trail_strength : hint_range(0.0, 1.0, 0.01) = 0.55;
|
||||
|
||||
uniform float distant_alpha_start : hint_range(10.0, 2000.0, 1.0) = 260.0;
|
||||
uniform float distant_alpha_end : hint_range(20.0, 5000.0, 1.0) = 1400.0;
|
||||
|
|
@ -61,7 +81,63 @@ float value_noise(vec2 point) {
|
|||
}
|
||||
|
||||
|
||||
float reconstruct_view_depth(
|
||||
float block_mark(vec2 point, vec2 half_size) {
|
||||
return (
|
||||
step(abs(point.x), half_size.x)
|
||||
* step(abs(point.y), half_size.y)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
float blocky_mark_layer(
|
||||
vec2 flowing_grid,
|
||||
float seed,
|
||||
float occupancy_threshold
|
||||
) {
|
||||
float row = floor(flowing_grid.y);
|
||||
flowing_grid.x += mod(row, 2.0) * 0.43;
|
||||
vec2 cell = floor(flowing_grid);
|
||||
vec2 local = fract(flowing_grid) - vec2(0.5);
|
||||
vec2 jitter = vec2(
|
||||
hash_21(cell + vec2(3.7 + seed, 9.1)),
|
||||
hash_21(cell + vec2(7.3, 2.9 + seed))
|
||||
) - vec2(0.5);
|
||||
local -= jitter * vec2(0.52, 0.46);
|
||||
local = floor((local + vec2(0.5)) * 8.0) / 8.0 - vec2(0.5);
|
||||
float shape_key = hash_21(cell + vec2(13.1 + seed, 5.7));
|
||||
float size_key = hash_21(cell + vec2(1.9, 17.3 + seed));
|
||||
vec2 half_size = mix(vec2(0.10, 0.07), vec2(0.18, 0.12), size_key);
|
||||
float mark = block_mark(local, half_size);
|
||||
if (shape_key < 0.34) {
|
||||
mark = max(
|
||||
mark,
|
||||
block_mark(
|
||||
local - vec2(half_size.x * 0.8, -0.11),
|
||||
vec2(half_size.x * 0.52, 0.045)
|
||||
)
|
||||
);
|
||||
} else if (shape_key < 0.67) {
|
||||
mark *= 1.0 - block_mark(
|
||||
local - vec2(half_size.x * 0.7, 0.0),
|
||||
vec2(0.045)
|
||||
);
|
||||
} else {
|
||||
mark = max(
|
||||
mark,
|
||||
block_mark(
|
||||
local + vec2(half_size.x * 0.75, 0.10),
|
||||
vec2(0.055, 0.04)
|
||||
)
|
||||
);
|
||||
}
|
||||
return mark * step(
|
||||
occupancy_threshold,
|
||||
hash_21(cell + vec2(19.7 + seed, 23.3))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
vec3 reconstruct_view_position(
|
||||
vec2 screen_uv,
|
||||
float raw_depth,
|
||||
mat4 inverse_projection
|
||||
|
|
@ -72,22 +148,39 @@ float reconstruct_view_depth(
|
|||
vec3 ndc = vec3(screen_uv * 2.0 - 1.0, raw_depth);
|
||||
#endif
|
||||
vec4 view_position = inverse_projection * vec4(ndc, 1.0);
|
||||
return -view_position.z / max(abs(view_position.w), 0.00001);
|
||||
return view_position.xyz / max(abs(view_position.w), 0.00001);
|
||||
}
|
||||
|
||||
|
||||
vec3 reconstruct_world_position(
|
||||
vec2 screen_uv,
|
||||
float raw_depth,
|
||||
mat4 inverse_projection,
|
||||
mat4 inverse_view
|
||||
) {
|
||||
vec3 view_position = reconstruct_view_position(
|
||||
screen_uv,
|
||||
raw_depth,
|
||||
inverse_projection
|
||||
);
|
||||
return (inverse_view * vec4(view_position, 1.0)).xyz;
|
||||
}
|
||||
|
||||
|
||||
float sample_water_depth(
|
||||
vec2 screen_uv,
|
||||
float water_surface_depth,
|
||||
mat4 inverse_projection
|
||||
float water_surface_height,
|
||||
mat4 inverse_projection,
|
||||
mat4 inverse_view
|
||||
) {
|
||||
float raw_depth = texture(depth_texture, screen_uv).r;
|
||||
float scene_depth = reconstruct_view_depth(
|
||||
vec3 scene_world_position = reconstruct_world_position(
|
||||
screen_uv,
|
||||
raw_depth,
|
||||
inverse_projection
|
||||
inverse_projection,
|
||||
inverse_view
|
||||
);
|
||||
return scene_depth - water_surface_depth;
|
||||
return water_surface_height - scene_world_position.y;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,12 +211,13 @@ void vertex() {
|
|||
|
||||
void fragment() {
|
||||
float raw_depth = texture(depth_texture, SCREEN_UV).r;
|
||||
float scene_view_depth = reconstruct_view_depth(
|
||||
vec3 scene_world_position = reconstruct_world_position(
|
||||
SCREEN_UV,
|
||||
raw_depth,
|
||||
INV_PROJECTION_MATRIX
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float water_depth = max(scene_view_depth - surface_view_depth, 0.0);
|
||||
float water_depth = max(world_position.y - scene_world_position.y, 0.0);
|
||||
water_depth = min(water_depth, deep_depth * 4.0);
|
||||
|
||||
float contour_depth = water_depth;
|
||||
|
|
@ -137,23 +231,51 @@ void fragment() {
|
|||
float contour_weight_sum = 1.0;
|
||||
float left_depth = sample_water_depth(
|
||||
SCREEN_UV - vec2(contour_texel.x, 0.0),
|
||||
surface_view_depth,
|
||||
INV_PROJECTION_MATRIX
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float right_depth = sample_water_depth(
|
||||
SCREEN_UV + vec2(contour_texel.x, 0.0),
|
||||
surface_view_depth,
|
||||
INV_PROJECTION_MATRIX
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float upper_depth = sample_water_depth(
|
||||
SCREEN_UV - vec2(0.0, contour_texel.y),
|
||||
surface_view_depth,
|
||||
INV_PROJECTION_MATRIX
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float lower_depth = sample_water_depth(
|
||||
SCREEN_UV + vec2(0.0, contour_texel.y),
|
||||
surface_view_depth,
|
||||
INV_PROJECTION_MATRIX
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float upper_left_depth = sample_water_depth(
|
||||
SCREEN_UV - contour_texel,
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float upper_right_depth = sample_water_depth(
|
||||
SCREEN_UV + vec2(contour_texel.x, -contour_texel.y),
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float lower_left_depth = sample_water_depth(
|
||||
SCREEN_UV + vec2(-contour_texel.x, contour_texel.y),
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float lower_right_depth = sample_water_depth(
|
||||
SCREEN_UV + contour_texel,
|
||||
world_position.y,
|
||||
INV_PROJECTION_MATRIX,
|
||||
INV_VIEW_MATRIX
|
||||
);
|
||||
float left_weight = contour_neighbor_weight(
|
||||
water_depth, left_depth, contour_depth_reject
|
||||
|
|
@ -167,11 +289,37 @@ void fragment() {
|
|||
float lower_weight = contour_neighbor_weight(
|
||||
water_depth, lower_depth, contour_depth_reject
|
||||
);
|
||||
float diagonal_scale = 0.70710678;
|
||||
float upper_left_weight = contour_neighbor_weight(
|
||||
water_depth, upper_left_depth, contour_depth_reject
|
||||
) * diagonal_scale;
|
||||
float upper_right_weight = contour_neighbor_weight(
|
||||
water_depth, upper_right_depth, contour_depth_reject
|
||||
) * diagonal_scale;
|
||||
float lower_left_weight = contour_neighbor_weight(
|
||||
water_depth, lower_left_depth, contour_depth_reject
|
||||
) * diagonal_scale;
|
||||
float lower_right_weight = contour_neighbor_weight(
|
||||
water_depth, lower_right_depth, contour_depth_reject
|
||||
) * diagonal_scale;
|
||||
contour_depth_sum += left_depth * left_weight;
|
||||
contour_depth_sum += right_depth * right_weight;
|
||||
contour_depth_sum += upper_depth * upper_weight;
|
||||
contour_depth_sum += lower_depth * lower_weight;
|
||||
float neighbor_support = left_weight + right_weight + upper_weight + lower_weight;
|
||||
contour_depth_sum += upper_left_depth * upper_left_weight;
|
||||
contour_depth_sum += upper_right_depth * upper_right_weight;
|
||||
contour_depth_sum += lower_left_depth * lower_left_weight;
|
||||
contour_depth_sum += lower_right_depth * lower_right_weight;
|
||||
float neighbor_support = (
|
||||
left_weight
|
||||
+ right_weight
|
||||
+ upper_weight
|
||||
+ lower_weight
|
||||
+ upper_left_weight
|
||||
+ upper_right_weight
|
||||
+ lower_left_weight
|
||||
+ lower_right_weight
|
||||
);
|
||||
contour_weight_sum += neighbor_support;
|
||||
float smoothed_contour_depth = contour_depth_sum / contour_weight_sum;
|
||||
contour_depth = mix(
|
||||
|
|
@ -182,6 +330,35 @@ void fragment() {
|
|||
contour_feature_support = smoothstep(0.75, 1.75, neighbor_support);
|
||||
}
|
||||
|
||||
vec2 scene_world_dx = dFdx(scene_world_position.xz);
|
||||
vec2 scene_world_dy = dFdy(scene_world_position.xz);
|
||||
float horizontal_dx = max(length(scene_world_dx), 0.0001);
|
||||
float horizontal_dy = max(length(scene_world_dy), 0.0001);
|
||||
float depth_gradient = length(vec2(
|
||||
dFdx(water_depth) / horizontal_dx,
|
||||
dFdy(water_depth) / horizontal_dy
|
||||
));
|
||||
float estimated_shore_distance = min(
|
||||
water_depth / max(depth_gradient, 0.001),
|
||||
shoreline_horizontal_reach * 4.0
|
||||
);
|
||||
float proximity_center = shoreline_horizontal_reach * 0.86;
|
||||
float proximity_filter_width = max(
|
||||
fwidth(estimated_shore_distance) * 1.5,
|
||||
shoreline_horizontal_reach * 0.12
|
||||
);
|
||||
float shoreline_proximity = 1.0 - smoothstep(
|
||||
max(proximity_center - proximity_filter_width, 0.0),
|
||||
proximity_center + proximity_filter_width,
|
||||
estimated_shore_distance
|
||||
);
|
||||
float contact_filter_width = max(fwidth(water_depth) * 1.5, 0.004);
|
||||
float contact_stability = smoothstep(
|
||||
max(contact_fade_depth - contact_filter_width, 0.0),
|
||||
contact_fade_depth + contact_filter_width,
|
||||
water_depth
|
||||
);
|
||||
|
||||
float shallow_mix = smoothstep(0.0, shallow_depth, water_depth);
|
||||
float deep_mix = smoothstep(shallow_depth, deep_depth, water_depth);
|
||||
vec3 water_color = mix(shore_color.rgb, shallow_color.rgb, shallow_mix);
|
||||
|
|
@ -207,6 +384,7 @@ void fragment() {
|
|||
contour_depth
|
||||
);
|
||||
tide_wash *= contour_feature_support;
|
||||
tide_wash *= shoreline_proximity;
|
||||
tide_wash *= 1.0 - smoothstep(shallow_depth, deep_depth, water_depth);
|
||||
water_color = mix(
|
||||
water_color,
|
||||
|
|
@ -220,6 +398,148 @@ void fragment() {
|
|||
);
|
||||
}
|
||||
|
||||
vec2 flowing_grid = (
|
||||
world_position.xz * surface_mark_density
|
||||
+ TIME * surface_mark_drift
|
||||
);
|
||||
float surface_row = floor(flowing_grid.y);
|
||||
flowing_grid.x += mod(surface_row, 2.0) * 0.43;
|
||||
vec2 surface_cell = floor(flowing_grid);
|
||||
vec2 surface_local = fract(flowing_grid) - vec2(0.5);
|
||||
vec2 surface_jitter = vec2(
|
||||
hash_21(surface_cell + vec2(3.7, 9.1)),
|
||||
hash_21(surface_cell + vec2(7.3, 2.9))
|
||||
) - vec2(0.5);
|
||||
surface_local -= surface_jitter * vec2(0.52, 0.46);
|
||||
surface_local = (
|
||||
floor((surface_local + vec2(0.5)) * 8.0) / 8.0
|
||||
- vec2(0.5)
|
||||
);
|
||||
float surface_shape = hash_21(surface_cell + vec2(13.1, 5.7));
|
||||
float surface_size = hash_21(surface_cell + vec2(1.9, 17.3));
|
||||
vec2 surface_half_size = mix(
|
||||
vec2(0.10, 0.07),
|
||||
vec2(0.18, 0.12),
|
||||
surface_size
|
||||
);
|
||||
float surface_mark = block_mark(surface_local, surface_half_size);
|
||||
if (surface_shape < 0.34) {
|
||||
surface_mark = max(
|
||||
surface_mark,
|
||||
block_mark(
|
||||
surface_local - vec2(surface_half_size.x * 0.8, -0.11),
|
||||
vec2(surface_half_size.x * 0.52, 0.045)
|
||||
)
|
||||
);
|
||||
} else if (surface_shape < 0.67) {
|
||||
surface_mark *= 1.0 - block_mark(
|
||||
surface_local - vec2(surface_half_size.x * 0.7, 0.0),
|
||||
vec2(0.045)
|
||||
);
|
||||
} else {
|
||||
surface_mark = max(
|
||||
surface_mark,
|
||||
block_mark(
|
||||
surface_local + vec2(surface_half_size.x * 0.75, 0.10),
|
||||
vec2(0.055, 0.04)
|
||||
)
|
||||
);
|
||||
}
|
||||
surface_mark *= step(
|
||||
0.22,
|
||||
hash_21(surface_cell + vec2(19.7, 23.3))
|
||||
);
|
||||
float mark_visibility = mix(1.0, 0.68, deep_mix);
|
||||
float surface_highlight = (
|
||||
surface_mark * surface_mark_strength * mark_visibility
|
||||
);
|
||||
|
||||
vec2 shoreline_phase_coordinates = world_position.xz * phase_noise_scale;
|
||||
float shoreline_phase = (
|
||||
value_noise(shoreline_phase_coordinates)
|
||||
+ value_noise(
|
||||
shoreline_phase_coordinates * 0.47 + vec2(9.7, 3.1)
|
||||
) * 0.5
|
||||
- 0.75
|
||||
) * phase_noise_strength;
|
||||
float shoreline_cycle = (
|
||||
sin(TIME * tide_speed + shoreline_phase) * 0.5 + 0.5
|
||||
);
|
||||
float animated_shoreline_depth = shoreline_mark_depth * mix(
|
||||
shoreline_minimum_reach,
|
||||
1.0,
|
||||
shoreline_cycle
|
||||
);
|
||||
float shoreline_mask = 1.0 - smoothstep(
|
||||
max(animated_shoreline_depth * 0.08, 0.01),
|
||||
max(animated_shoreline_depth, 0.02),
|
||||
contour_depth
|
||||
);
|
||||
float shoreline_depth_visibility = 1.0 - smoothstep(
|
||||
shallow_depth,
|
||||
deep_depth,
|
||||
water_depth
|
||||
);
|
||||
shoreline_mask *= shoreline_depth_visibility;
|
||||
float shoreline_lead_depth = animated_shoreline_depth * 0.82;
|
||||
float shoreline_lead_crest = 1.0 - smoothstep(
|
||||
shoreline_crest_width * 0.25,
|
||||
shoreline_crest_width,
|
||||
abs(contour_depth - shoreline_lead_depth)
|
||||
);
|
||||
float shoreline_trail_depth = max(
|
||||
shoreline_lead_depth - shoreline_trail_spacing,
|
||||
shoreline_crest_width
|
||||
);
|
||||
float shoreline_trail_crest = 1.0 - smoothstep(
|
||||
shoreline_crest_width * 0.40,
|
||||
shoreline_crest_width * 1.45,
|
||||
abs(contour_depth - shoreline_trail_depth)
|
||||
);
|
||||
shoreline_lead_crest *= shoreline_depth_visibility;
|
||||
shoreline_trail_crest *= (
|
||||
shoreline_depth_visibility * shoreline_trail_strength
|
||||
);
|
||||
float shoreline_marks = max(
|
||||
blocky_mark_layer(
|
||||
world_position.xz * shoreline_mark_density
|
||||
+ TIME * shoreline_mark_drift,
|
||||
17.0,
|
||||
0.04
|
||||
),
|
||||
blocky_mark_layer(
|
||||
world_position.xz * shoreline_mark_density * 1.37
|
||||
- TIME * shoreline_mark_drift.yx * 0.73,
|
||||
41.0,
|
||||
0.08
|
||||
)
|
||||
);
|
||||
float shoreline_foam = shoreline_mask * mix(
|
||||
shoreline_base_fill,
|
||||
1.0,
|
||||
shoreline_marks
|
||||
);
|
||||
float moving_crests = max(
|
||||
shoreline_lead_crest,
|
||||
shoreline_trail_crest
|
||||
) * mix(0.68, 1.0, shoreline_marks);
|
||||
shoreline_foam = max(shoreline_foam, moving_crests);
|
||||
shoreline_foam *= shoreline_proximity;
|
||||
water_alpha = min(
|
||||
water_alpha + shoreline_foam * shoreline_opacity_boost,
|
||||
0.98
|
||||
);
|
||||
water_alpha *= contact_stability;
|
||||
|
||||
float surface_mottle = value_noise(
|
||||
world_position.xz * surface_mottle_scale
|
||||
+ TIME * surface_mottle_speed
|
||||
);
|
||||
surface_mottle = floor(surface_mottle * 6.0) / 5.0;
|
||||
water_color *= 1.0 + (
|
||||
surface_mottle * 2.0 - 1.0
|
||||
) * surface_mottle_strength;
|
||||
|
||||
vec2 drift_coordinates = (
|
||||
world_position.xz * open_water_drift_scale
|
||||
+ TIME * open_water_drift_speed
|
||||
|
|
@ -236,6 +556,19 @@ void fragment() {
|
|||
water_alpha = mix(water_alpha, 0.96, distant_mix);
|
||||
|
||||
water_color *= environment_tint.rgb * environment_brightness;
|
||||
vec3 visible_highlight_color = surface_mark_color.rgb * max(
|
||||
environment_tint.rgb * environment_brightness,
|
||||
vec3(surface_highlight_night_floor)
|
||||
);
|
||||
float visible_highlight = max(
|
||||
surface_highlight,
|
||||
shoreline_foam * shoreline_mark_strength
|
||||
);
|
||||
water_color = mix(
|
||||
water_color,
|
||||
visible_highlight_color,
|
||||
clamp(visible_highlight, 0.0, 1.0)
|
||||
);
|
||||
|
||||
ALBEDO = water_color;
|
||||
ALPHA = clamp(water_alpha, 0.1, 0.96);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=2 format=3]
|
||||
[gd_resource type="ShaderMaterial" format=3 uid="uid://6lafg0ac2qul"]
|
||||
|
||||
[ext_resource type="Shader" path="res://world/materials/stylized_water.gdshader" id="1_water_shader"]
|
||||
[ext_resource type="Shader" uid="uid://lvo7xyr3c1k3" path="res://world/materials/stylized_water.gdshader" id="1_water_shader"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
|
|
@ -11,25 +11,45 @@ shader_parameter/deep_color = Color(0.109804, 0.345098, 0.435294, 1)
|
|||
shader_parameter/tide_wash_color = Color(0.360784, 0.721569, 0.733333, 1)
|
||||
shader_parameter/shallow_depth = 0.7
|
||||
shader_parameter/deep_depth = 3.6
|
||||
shader_parameter/shore_depth_width = 0.16
|
||||
shader_parameter/shore_alpha = 0.44
|
||||
shader_parameter/shallow_alpha = 0.6
|
||||
shader_parameter/deep_alpha = 0.82
|
||||
shader_parameter/shore_depth_width = 0.1
|
||||
shader_parameter/shore_alpha = 0.68
|
||||
shader_parameter/shallow_alpha = 0.78
|
||||
shader_parameter/deep_alpha = 0.9
|
||||
shader_parameter/tide_effect_enabled = true
|
||||
shader_parameter/tide_speed = 1.42
|
||||
shader_parameter/tide_distance = 0.3
|
||||
shader_parameter/tide_wash_width = 0.38
|
||||
shader_parameter/tide_distance = 0.11
|
||||
shader_parameter/tide_wash_width = 0.16
|
||||
shader_parameter/tide_wash_strength = 0.11
|
||||
shader_parameter/tide_wash_alpha_shift = 0.045
|
||||
shader_parameter/phase_noise_scale = 0.055
|
||||
shader_parameter/phase_noise_strength = 0.68
|
||||
shader_parameter/contour_corner_variation = 0.045
|
||||
shader_parameter/contour_smoothing_pixels = 1.0
|
||||
shader_parameter/contour_smoothing_strength = 0.72
|
||||
shader_parameter/contour_corner_variation = 0.025
|
||||
shader_parameter/contour_smoothing_pixels = 1.35
|
||||
shader_parameter/contour_smoothing_strength = 0.88
|
||||
shader_parameter/contour_depth_reject = 0.6
|
||||
shader_parameter/shoreline_horizontal_reach = 0.32
|
||||
shader_parameter/contact_fade_depth = 0.018
|
||||
shader_parameter/open_water_drift_scale = 0.018
|
||||
shader_parameter/open_water_drift_speed = Vector2(0.01, -0.007)
|
||||
shader_parameter/open_water_drift_strength = 0.045
|
||||
shader_parameter/surface_mark_color = Color(0.58, 0.85, 0.86, 1)
|
||||
shader_parameter/surface_mark_density = Vector2(1.5, 1.05)
|
||||
shader_parameter/surface_mark_drift = Vector2(0.045, -0.032)
|
||||
shader_parameter/surface_mark_strength = 0.12
|
||||
shader_parameter/surface_mottle_scale = 0.11
|
||||
shader_parameter/surface_mottle_speed = Vector2(-0.018, 0.013)
|
||||
shader_parameter/surface_mottle_strength = 0.07
|
||||
shader_parameter/shoreline_mark_density = Vector2(4.6, 3.2)
|
||||
shader_parameter/shoreline_mark_drift = Vector2(0.085, -0.06)
|
||||
shader_parameter/shoreline_mark_depth = 0.55
|
||||
shader_parameter/shoreline_mark_strength = 0.95
|
||||
shader_parameter/shoreline_base_fill = 0.58
|
||||
shader_parameter/shoreline_opacity_boost = 0.38
|
||||
shader_parameter/surface_highlight_night_floor = 0.72
|
||||
shader_parameter/shoreline_minimum_reach = 0.22
|
||||
shader_parameter/shoreline_crest_width = 0.08
|
||||
shader_parameter/shoreline_trail_spacing = 0.13
|
||||
shader_parameter/shoreline_trail_strength = 0.55
|
||||
shader_parameter/distant_alpha_start = 260.0
|
||||
shader_parameter/distant_alpha_end = 1400.0
|
||||
shader_parameter/environment_tint = Color(1, 1, 1, 1)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=2 format=3]
|
||||
[gd_resource type="ShaderMaterial" format=3 uid="uid://d27er7sx5bcqw"]
|
||||
|
||||
[ext_resource type="Shader" path="res://world/materials/stylized_water.gdshader" id="1_water_shader"]
|
||||
[ext_resource type="Shader" uid="uid://lvo7xyr3c1k3" path="res://world/materials/stylized_water.gdshader" id="1_water_shader"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
|
|
@ -11,14 +11,45 @@ shader_parameter/deep_color = Color(0.109804, 0.345098, 0.435294, 1)
|
|||
shader_parameter/tide_wash_color = Color(0.360784, 0.721569, 0.733333, 1)
|
||||
shader_parameter/shallow_depth = 0.7
|
||||
shader_parameter/deep_depth = 3.6
|
||||
shader_parameter/shore_depth_width = 0.16
|
||||
shader_parameter/shore_alpha = 0.44
|
||||
shader_parameter/shallow_alpha = 0.6
|
||||
shader_parameter/deep_alpha = 0.82
|
||||
shader_parameter/shore_depth_width = 0.1
|
||||
shader_parameter/shore_alpha = 0.68
|
||||
shader_parameter/shallow_alpha = 0.78
|
||||
shader_parameter/deep_alpha = 0.9
|
||||
shader_parameter/tide_effect_enabled = false
|
||||
shader_parameter/tide_speed = 1.42
|
||||
shader_parameter/tide_distance = 0.3
|
||||
shader_parameter/tide_wash_width = 0.38
|
||||
shader_parameter/tide_wash_strength = 0.11
|
||||
shader_parameter/tide_wash_alpha_shift = 0.045
|
||||
shader_parameter/phase_noise_scale = 0.055
|
||||
shader_parameter/phase_noise_strength = 0.68
|
||||
shader_parameter/contour_corner_variation = 0.045
|
||||
shader_parameter/contour_smoothing_pixels = 1.35
|
||||
shader_parameter/contour_smoothing_strength = 0.88
|
||||
shader_parameter/contour_depth_reject = 0.6
|
||||
shader_parameter/shoreline_horizontal_reach = 0.32
|
||||
shader_parameter/contact_fade_depth = 0.018
|
||||
shader_parameter/open_water_drift_scale = 0.018
|
||||
shader_parameter/open_water_drift_speed = Vector2(0.01, -0.007)
|
||||
shader_parameter/open_water_drift_strength = 0.045
|
||||
shader_parameter/surface_mark_color = Color(0.58, 0.85, 0.86, 1)
|
||||
shader_parameter/surface_mark_density = Vector2(1.5, 1.05)
|
||||
shader_parameter/surface_mark_drift = Vector2(0.045, -0.032)
|
||||
shader_parameter/surface_mark_strength = 0.12
|
||||
shader_parameter/surface_mottle_scale = 0.11
|
||||
shader_parameter/surface_mottle_speed = Vector2(-0.018, 0.013)
|
||||
shader_parameter/surface_mottle_strength = 0.07
|
||||
shader_parameter/shoreline_mark_density = Vector2(4.6, 3.2)
|
||||
shader_parameter/shoreline_mark_drift = Vector2(0.085, -0.06)
|
||||
shader_parameter/shoreline_mark_depth = 0.55
|
||||
shader_parameter/shoreline_mark_strength = 0.95
|
||||
shader_parameter/shoreline_base_fill = 0.58
|
||||
shader_parameter/shoreline_opacity_boost = 0.38
|
||||
shader_parameter/surface_highlight_night_floor = 0.72
|
||||
shader_parameter/shoreline_minimum_reach = 0.22
|
||||
shader_parameter/shoreline_crest_width = 0.08
|
||||
shader_parameter/shoreline_trail_spacing = 0.13
|
||||
shader_parameter/shoreline_trail_strength = 0.55
|
||||
shader_parameter/distant_alpha_start = 260.0
|
||||
shader_parameter/distant_alpha_end = 1400.0
|
||||
shader_parameter/environment_tint = Color(1, 1, 1, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue