Added footsteps, new tree, various other tweaks

This commit is contained in:
derek
2024-12-05 11:47:34 -06:00
parent 816ae85938
commit 023879ea9f
389 changed files with 20484 additions and 234 deletions

View File

@@ -0,0 +1,62 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_disabled;
// Texture settings
uniform sampler2D texture_albedo : hint_default_white, repeat_disable;
uniform sampler2D texture_gradient : hint_default_white, repeat_disable;
uniform sampler2D texture_noise : hint_default_white;
uniform float alpha_scissor_threshold : hint_range(0.0, 1.0);
uniform vec4 transmission : source_color;
uniform vec4 secondary_color : source_color;
uniform float secondary_attenuation = 0.2;
uniform float grass_height = 1.0;
// Wind settings
uniform vec2 wind_direction = vec2(1, -0.5);
uniform float wind_speed = 1.0;
uniform float wind_strength = 2.0;
uniform float noise_scale = 20.0;
instance uniform float camera_bend_strength : hint_range(0.0, 3.0) = 0.2;
varying float color;
varying float height;
void vertex() {
height = VERTEX.y;
float influence = smoothstep(0, 1, height / 2.0);
vec4 world_pos = MODEL_MATRIX * vec4(VERTEX, 1.0);
vec2 uv = world_pos.xz / (noise_scale + 1e-2);
vec2 panning_uv = uv + fract(TIME * wind_direction * wind_speed);
float wind = texture(texture_noise, panning_uv).r * 2.0 - 0.4;
color = texture(texture_noise, uv).r;
vec2 wind_offset = -wind_direction * wind_strength * influence * wind;
world_pos.xz += wind_offset;
world_pos.y -= wind * influence * smoothstep(0.0, height, wind_strength);
//Push the top vertex away from the camera to bend the grass clump
float ndotv = 1.0 - dot(vec3(0.0, 1.0, 0.0), normalize(INV_VIEW_MATRIX[1].xyz));
world_pos.xz += INV_VIEW_MATRIX[1].xz * camera_bend_strength * height * ndotv;
vec4 local_pos = inverse(MODEL_MATRIX) * world_pos;
local_pos.x += wind_strength * influence * cos(TIME * 1.0) / 8.0;
local_pos.z += wind_strength * influence * sin(TIME * 1.5) / 8.0;
VERTEX = local_pos.xyz;
//NORMAL = vec3(0.0, 1.0, 0.0);
}
void fragment() {
vec4 tex = texture(texture_albedo, UV);
if (tex.a < alpha_scissor_threshold) {
discard;
}
BACKLIGHT = transmission.rgb;
vec4 gradient = texture(texture_gradient, vec2(height / grass_height, 0.0));
float secondary_weight = smoothstep(0.0, 1.0, color - secondary_attenuation);
ALBEDO = tex.rbg * gradient.rgb;
//ALBEDO = mix(ALBEDO, secondary_color.rgb, secondary_weight);
}

View File

@@ -0,0 +1,51 @@
shader_type spatial;
render_mode depth_draw_opaque, cull_disabled;
// Texture settings
uniform sampler2D texture_albedo : hint_default_white, repeat_disable;
uniform sampler2D texture_gradient : hint_default_white;
uniform sampler2D texture_noise : hint_default_white;
uniform float alpha_scissor_threshold : hint_range(0.0, 1.0);
uniform vec4 transmission : source_color;
uniform float total_height = 1.0;
// Wind settings
uniform vec2 wind_direction = vec2(1, -0.5);
uniform float wind_speed = 1.0;
uniform float wind_strength = 2.0;
uniform float noise_scale = 20.0;
varying float color;
varying float height;
void vertex() {
height = VERTEX.y;
vec4 world_pos = MODEL_MATRIX * vec4(VERTEX, 1.0);
vec2 uv = (world_pos.xz + VERTEX.yy) / (noise_scale + 1e-2) ;
vec2 panning_uv = uv + fract(TIME * wind_direction * wind_speed);
float wind = texture(texture_noise, panning_uv).r * 2.0 - 0.4;
color = texture(texture_noise, uv).r;
float wind_influence = smoothstep(0, 1, 1.0 - UV.y);
vec2 wind_offset = -wind_direction * wind_strength * wind_influence * wind;
world_pos.xz += wind_offset;
world_pos.y -= wind * wind_influence * wind_strength * 0.45;
vec4 local_pos = inverse(MODEL_MATRIX) * world_pos;
VERTEX = local_pos.xyz;
//NORMAL = vec3(0.0, 1.0, 0.0);
}
void fragment() {
vec4 tex = texture(texture_albedo, UV);
if (tex.a < alpha_scissor_threshold) {
discard;
}
BACKLIGHT = transmission.rgb;
vec4 gradient = texture(texture_gradient, vec2(height / total_height, 0.0));
ALBEDO = tex.rbg * gradient.rgb;
}

View File

@@ -0,0 +1,37 @@
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://bn3fr3m3glrnp"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/grass.gdshader" id="1_peshr"]
[ext_resource type="Texture2D" uid="uid://b2a6ylo2enm4g" path="res://addons/proton_scatter/demos/assets/textures/t_bush.png" id="2_mbhvd"]
[sub_resource type="Gradient" id="Gradient_122hb"]
offsets = PackedFloat32Array(0, 0.5, 1)
colors = PackedColorArray(0.179688, 0.0759602, 0.0183228, 1, 0.386532, 0.390625, 0.0230687, 1, 1, 0.693237, 0.0687054, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_i0bw2"]
gradient = SubResource("Gradient_122hb")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_eeqpx"]
seed = 1
frequency = 0.002
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_7l0n1"]
in_3d_space = true
seamless = true
seamless_blend_skirt = 0.65
noise = SubResource("FastNoiseLite_eeqpx")
[resource]
render_priority = 0
shader = ExtResource("1_peshr")
shader_parameter/alpha_scissor_threshold = 0.25
shader_parameter/transmission = Color(0.619608, 0.541176, 0.101961, 1)
shader_parameter/secondary_color = Color(0, 0, 0, 1)
shader_parameter/secondary_attenuation = 0.2
shader_parameter/grass_height = 0.829
shader_parameter/wind_direction = Vector2(1, -0.5)
shader_parameter/wind_speed = 0.5
shader_parameter/wind_strength = 0.15
shader_parameter/noise_scale = 6.0
shader_parameter/texture_albedo = ExtResource("2_mbhvd")
shader_parameter/texture_gradient = SubResource("GradientTexture1D_i0bw2")
shader_parameter/texture_noise = SubResource("NoiseTexture2D_7l0n1")

View File

@@ -0,0 +1,6 @@
[gd_resource type="SpatialMaterial" format=2]
[resource]
resource_name = "wood"
vertex_color_use_as_albedo = true
albedo_color = Color( 0.568627, 0.466667, 0.372549, 1 )

View File

@@ -0,0 +1,37 @@
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://c4mot1fo3siox"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/grass.gdshader" id="1_fntgl"]
[ext_resource type="Texture2D" uid="uid://d23p13yi7asw0" path="res://addons/proton_scatter/demos/assets/textures/t_grass_2.png" id="2_1odx0"]
[sub_resource type="Gradient" id="Gradient_122hb"]
offsets = PackedFloat32Array(0, 0.473451, 1)
colors = PackedColorArray(0.179688, 0.0855483, 0.00322032, 1, 0.251693, 0.390625, 0.0117187, 1, 1, 0.964706, 0.129412, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_i0bw2"]
gradient = SubResource("Gradient_122hb")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_eeqpx"]
seed = 1
frequency = 0.002
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_7l0n1"]
in_3d_space = true
seamless = true
seamless_blend_skirt = 0.65
noise = SubResource("FastNoiseLite_eeqpx")
[resource]
render_priority = 0
shader = ExtResource("1_fntgl")
shader_parameter/alpha_scissor_threshold = 0.3
shader_parameter/transmission = Color(0.737255, 0.72549, 0, 1)
shader_parameter/secondary_color = Color(0, 0, 0, 1)
shader_parameter/secondary_attenuation = 0.2
shader_parameter/grass_height = 0.6
shader_parameter/wind_direction = Vector2(1, -0.5)
shader_parameter/wind_speed = 0.5
shader_parameter/wind_strength = 0.15
shader_parameter/noise_scale = 6.0
shader_parameter/texture_albedo = ExtResource("2_1odx0")
shader_parameter/texture_gradient = SubResource("GradientTexture1D_i0bw2")
shader_parameter/texture_noise = SubResource("NoiseTexture2D_7l0n1")

View File

@@ -0,0 +1,38 @@
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://djo80ucamk643"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/grass.gdshader" id="1_8py1k"]
[ext_resource type="Texture2D" uid="uid://cgenco43aneod" path="res://addons/proton_scatter/demos/assets/textures/t_leaves_1.png" id="2_l2uea"]
[sub_resource type="Gradient" id="Gradient_yy7fg"]
offsets = PackedFloat32Array(0, 0.726872, 0.934272)
colors = PackedColorArray(0.333333, 0.486275, 0.556863, 1, 0.496467, 0.55, 0.1485, 1, 0.898039, 0.670588, 0.0196078, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_rwvaq"]
gradient = SubResource("Gradient_yy7fg")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wpihy"]
seed = 1
frequency = 0.002
[sub_resource type="NoiseTexture2D" id="NoiseTexture_tgrrr"]
in_3d_space = true
seamless = true
seamless_blend_skirt = 0.65
noise = SubResource("FastNoiseLite_wpihy")
[resource]
render_priority = 0
shader = ExtResource("1_8py1k")
shader_parameter/alpha_scissor_threshold = 0.5
shader_parameter/camera_bend_strength = 0.0
shader_parameter/grass_height = 1.0
shader_parameter/noise_scale = 12.0
shader_parameter/secondary_attenuation = 0.2
shader_parameter/secondary_color = Color(0, 0.305882, 0.211765, 1)
shader_parameter/texture_albedo = ExtResource("2_l2uea")
shader_parameter/texture_gradient = SubResource("GradientTexture1D_rwvaq")
shader_parameter/texture_noise = SubResource("NoiseTexture_tgrrr")
shader_parameter/transmission = Color(1, 0.975296, 0.943663, 1)
shader_parameter/wind_direction = Vector2(1, -0.5)
shader_parameter/wind_speed = 0.5
shader_parameter/wind_strength = 0.05

View File

@@ -0,0 +1,6 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://ds2hjlo70hglg"]
[ext_resource type="Texture2D" uid="uid://bjdgw8o5tr1a3" path="res://addons/proton_scatter/demos/assets/textures/mushroom.png" id="1_y0tuv"]
[resource]
albedo_texture = ExtResource("1_y0tuv")

View File

@@ -0,0 +1,35 @@
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://d28lq2qtgdyie"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/leaves.gdshader" id="1_hlncd"]
[ext_resource type="Texture2D" uid="uid://ctpb1w0cr8tqc" path="res://addons/proton_scatter/demos/assets/textures/t_pine_branch.png" id="2_yef44"]
[sub_resource type="Gradient" id="Gradient_pookg"]
offsets = PackedFloat32Array(0.38342, 0.694301, 1)
colors = PackedColorArray(0.059375, 0.078125, 0.07, 1, 0.628287, 0.73, 0.1752, 1, 0.897921, 1, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_n86jv"]
gradient = SubResource("Gradient_pookg")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_t7o5y"]
seed = 1
frequency = 0.002
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_03p8g"]
in_3d_space = true
seamless = true
seamless_blend_skirt = 0.65
noise = SubResource("FastNoiseLite_t7o5y")
[resource]
render_priority = 0
shader = ExtResource("1_hlncd")
shader_parameter/alpha_scissor_threshold = 0.3
shader_parameter/transmission = Color(0.745098, 0.741176, 0, 1)
shader_parameter/total_height = 4.046
shader_parameter/wind_direction = Vector2(1, -0.5)
shader_parameter/wind_speed = 0.2
shader_parameter/wind_strength = 0.05
shader_parameter/noise_scale = 12.0
shader_parameter/texture_albedo = ExtResource("2_yef44")
shader_parameter/texture_gradient = SubResource("GradientTexture1D_n86jv")
shader_parameter/texture_noise = SubResource("NoiseTexture2D_03p8g")

View File

@@ -0,0 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://i0jgjmbbl2m5"]
[ext_resource type="Texture2D" uid="uid://drdh36j6mu3ah" path="res://addons/proton_scatter/demos/assets/textures/t_rock_dirty.png" id="1_hx37f"]
[resource]
albedo_color = Color(0.439216, 0.407843, 0.388235, 1)
albedo_texture = ExtResource("1_hx37f")
metallic_specular = 0.3
uv1_triplanar = true
uv1_world_triplanar = true

View File

@@ -0,0 +1,7 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://d01d0h08lqqn6"]
[ext_resource type="Texture2D" uid="uid://c7pop5xgpxtiv" path="res://addons/proton_scatter/demos/assets/textures/t_tree_bark_rough.png" id="1_g4son"]
[resource]
albedo_color = Color(0.470588, 0.376471, 0.309804, 1)
albedo_texture = ExtResource("1_g4son")

View File

@@ -0,0 +1,90 @@
// Source: https://godotshaders.com/shader/toon-water-shader/
shader_type spatial;
const float SMOOTHSTEP_AA = 0.01;
uniform sampler2D surfaceNoise;
uniform sampler2D distortNoise;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform float beer_factor = 0.8;
uniform float foam_distance = 0.01;
uniform float foam_max_distance = 0.4;
uniform float foam_min_distance = 0.04;
uniform vec4 foam_color: source_color = vec4(1.0);
uniform vec2 surface_noise_tiling = vec2(1.0, 4.0);
uniform vec3 surface_noise_scroll = vec3(0.03, 0.03, 0.0);
uniform float surface_noise_cutoff: hint_range(0, 1) = 0.777;
uniform float surface_distortion_amount: hint_range(0, 1) = 0.27;
uniform vec4 _DepthGradientShallow: source_color = vec4(0.325, 0.807, 0.971, 0.725);
uniform vec4 _DepthGradientDeep: source_color = vec4(0.086, 0.407, 1, 0.749);
uniform float _DepthMaxDistance: hint_range(0, 1) = 1.0;
uniform float _DepthFactor = 1.0;
uniform float roughness = 0.25;
uniform float specular = 0.75;
varying vec2 noiseUV;
varying vec2 distortUV;
varying vec3 viewNormal;
vec4 alphaBlend(vec4 top, vec4 bottom)
{
vec3 color = (top.rgb * top.a) + (bottom.rgb * (1.0 - top.a));
float alpha = top.a + bottom.a * (1.0 - top.a);
return vec4(color, alpha);
}
void vertex() {
viewNormal = (MODELVIEW_MATRIX * vec4(NORMAL, 0.0)).xyz;
noiseUV = UV * surface_noise_tiling;
distortUV = UV;
}
void fragment(){
// https://www.youtube.com/watch?v=Jq3he9Lbj7M
float depthVal = texture(DEPTH_TEXTURE, SCREEN_UV).r;
float depth = PROJECTION_MATRIX[3][2] / (depthVal + PROJECTION_MATRIX[2][2]);
depth = depth + VERTEX.z;
depth = exp(-depth * beer_factor);
depth = 1.0 - depth;
// Still unsure how to get properly the NORMAL from the camera
// This was generated by ChatGPT xD
vec4 view_pos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, depthVal, 1.0);
view_pos /= view_pos.w;
vec3 existingNormal = normalize(cross( dFdx(view_pos.xyz), dFdy(view_pos.xyz)));
float normalDot = clamp(dot(existingNormal.xyz, viewNormal), 0.0, 1.0);
float foamDistance = mix(foam_max_distance, foam_min_distance, normalDot);
float foamDepth = clamp(depth / foamDistance, 0.0, 1.0);
float surfaceNoiseCutoff = foamDepth * surface_noise_cutoff;
vec4 distortNoiseSample = texture(distortNoise, distortUV);
vec2 distortAmount = (distortNoiseSample.xy * 2.0 -1.0) * surface_distortion_amount;
vec2 noise_uv = vec2(
(noiseUV.x + TIME * surface_noise_scroll.x) + distortAmount.x ,
(noiseUV.y + TIME * surface_noise_scroll.y + distortAmount.y)
);
float surfaceNoiseSample = texture(surfaceNoise, noise_uv).r;
float surfaceNoiseAmount = smoothstep(surfaceNoiseCutoff - SMOOTHSTEP_AA, surfaceNoiseCutoff + SMOOTHSTEP_AA, surfaceNoiseSample);
float waterDepth = clamp(depth / _DepthMaxDistance, 0.0, 1.0) * _DepthFactor;
vec4 waterColor = mix(_DepthGradientShallow, _DepthGradientDeep, waterDepth);
vec4 surfaceNoiseColor = foam_color;
surfaceNoiseColor.a *= surfaceNoiseAmount;
vec4 color = alphaBlend(surfaceNoiseColor, waterColor);
ALBEDO = color.rgb;
ALPHA = color.a;
ROUGHNESS = roughness;
SPECULAR = specular;
}

View File

@@ -0,0 +1,40 @@
[gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://c7mw5tryqfggw"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/m_water.gdshader" id="1_j8rl3"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_7bjdc"]
noise_type = 2
fractal_type = 3
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_wxuht"]
seamless = true
noise = SubResource("FastNoiseLite_7bjdc")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_dx86n"]
noise_type = 2
domain_warp_enabled = true
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_1j0ob"]
seamless = true
noise = SubResource("FastNoiseLite_dx86n")
[resource]
render_priority = 0
shader = ExtResource("1_j8rl3")
shader_parameter/beer_factor = 4.0
shader_parameter/foam_distance = 0.01
shader_parameter/foam_max_distance = 0.345
shader_parameter/foam_min_distance = 0.05
shader_parameter/foam_color = Color(1, 1, 1, 0.784314)
shader_parameter/surface_noise_tiling = Vector2(1, 4)
shader_parameter/surface_noise_scroll = Vector3(0.03, 0.03, 0)
shader_parameter/surface_noise_cutoff = 0.875
shader_parameter/surface_distortion_amount = 0.65
shader_parameter/_DepthGradientShallow = Color(0.435294, 0.647059, 0.972549, 0.72549)
shader_parameter/_DepthGradientDeep = Color(0.0823529, 0.392157, 0.701961, 0.862745)
shader_parameter/_DepthMaxDistance = 1.0
shader_parameter/_DepthFactor = 1.0
shader_parameter/roughness = 0.001
shader_parameter/specular = 0.5
shader_parameter/surfaceNoise = SubResource("NoiseTexture2D_1j0ob")
shader_parameter/distortNoise = SubResource("NoiseTexture2D_wxuht")