Delightful writhing & warping of the grunk

This commit is contained in:
Rob Kelly 2025-03-02 18:01:47 -07:00
parent e0e5fdae2e
commit 8b6ca73e54
10 changed files with 119 additions and 13 deletions

Binary file not shown.

View File

@ -28,7 +28,7 @@ shader = ExtResource("1_euy6e")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1) shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 1) shader_parameter/color_2 = Color(0, 0.1, 0.3, 1)
shader_parameter/emission_color = Color(0.25, 0.875, 1, 1) shader_parameter/emission_color = Color(0.25, 0.875, 1, 1)
shader_parameter/pixellation = 50.0 shader_parameter/pixellation = 100.0
shader_parameter/roughness = 0.15 shader_parameter/roughness = 0.15
shader_parameter/specular_contribution = 0.8 shader_parameter/specular_contribution = 0.8
shader_parameter/emission_strength = 0.02 shader_parameter/emission_strength = 0.02

View File

@ -3,20 +3,19 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bdnurvg7xe6k7" uid="uid://bdnurvg7xe6k7"
path.s3tc="res://.godot/imported/reticle.png-0a9f831dae57a5cb1ef00786d2ed0e86.s3tc.ctex" path="res://.godot/imported/reticle.png-0a9f831dae57a5cb1ef00786d2ed0e86.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "vram_texture": false
"vram_texture": true
} }
[deps] [deps]
source_file="res://assets/ui/hud/reticle.png" source_file="res://assets/ui/hud/reticle.png"
dest_files=["res://.godot/imported/reticle.png-0a9f831dae57a5cb1ef00786d2ed0e86.s3tc.ctex"] dest_files=["res://.godot/imported/reticle.png-0a9f831dae57a5cb1ef00786d2ed0e86.ctex"]
[params] [params]
compress/mode=2 compress/mode=0
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1

BIN
assets/ui/hud/reticle_large.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bn0gcsy37ahto"
path.s3tc="res://.godot/imported/reticle_large.png-a42ebbd3708980136abe85bbfa9ef8bb.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/ui/hud/reticle_large.png"
dest_files=["res://.godot/imported/reticle_large.png-a42ebbd3708980136abe85bbfa9ef8bb.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

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://cc102xko0u6yj"] [gd_scene load_steps=5 format=3 uid="uid://cc102xko0u6yj"]
[ext_resource type="Script" path="res://src/equipment/point_spray/point_spray.gd" id="1_2yl2v"] [ext_resource type="Script" path="res://src/equipment/point_spray/point_spray.gd" id="1_2yl2v"]
[ext_resource type="Texture2D" uid="uid://bdnurvg7xe6k7" path="res://assets/ui/hud/reticle.png" id="1_f2scl"] [ext_resource type="Texture2D" uid="uid://bn0gcsy37ahto" path="res://assets/ui/hud/reticle_large.png" id="2_qcl8j"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ng43h"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ng43h"]
transparency = 1 transparency = 1
@ -31,5 +31,5 @@ skeleton = NodePath("../../../..")
[node name="Decal" type="Decal" parent="."] [node name="Decal" type="Decal" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.47035e-08, -1, 0, 1, -4.47035e-08, 0, 0, -1) transform = Transform3D(1, 0, 0, 0, -4.47035e-08, -1, 0, 1, -4.47035e-08, 0, 0, -1)
size = Vector3(0.2, 2, 0.2) size = Vector3(0.2, 2, 0.2)
texture_albedo = ExtResource("1_f2scl") texture_albedo = ExtResource("2_qcl8j")
cull_mask = 1048573 cull_mask = 1048573

View File

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/player/player.gd" id="1_npueo"] [ext_resource type="Script" path="res://src/player/player.gd" id="1_npueo"]
[ext_resource type="Script" path="res://src/player/camera_controller.gd" id="2_veeqv"] [ext_resource type="Script" path="res://src/player/camera_controller.gd" id="2_veeqv"]
[ext_resource type="PackedScene" uid="uid://d2hnxr5l6w2x4" path="res://src/equipment/wide_spray/wide_spray.tscn" id="3_ibq07"] [ext_resource type="PackedScene" uid="uid://cc102xko0u6yj" path="res://src/equipment/point_spray/point_spray.tscn" id="3_ybw6c"]
[sub_resource type="BoxMesh" id="BoxMesh_ua7a2"] [sub_resource type="BoxMesh" id="BoxMesh_ua7a2"]
size = Vector3(0.05, 0.05, 0.3) size = Vector3(0.05, 0.05, 0.3)
@ -30,7 +30,7 @@ mesh = SubResource("BoxMesh_ua7a2")
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.997564, -0.0697565, 0, 0.0697565, 0.997564, 0, 0, -0.15) transform = Transform3D(1, 0, 0, 0, 0.997564, -0.0697565, 0, 0.0697565, 0.997564, 0, 0, -0.15)
[node name="WideSpray" parent="CameraPivot/SprayNozzle/SprayMuzzle" instance=ExtResource("3_ibq07")] [node name="PointSpray" parent="CameraPivot/SprayNozzle/SprayMuzzle" instance=ExtResource("3_ybw6c")]
[node name="Camera3D" type="Camera3D" parent="CameraPivot"] [node name="Camera3D" type="Camera3D" parent="CameraPivot"]
current = true current = true

View File

@ -31,7 +31,13 @@ float hardstep(float value) {
void fragment() { void fragment() {
vec2 local_uv = floor(UV * uv_scale * pixellation) / pixellation; vec2 local_uv = floor(UV * uv_scale * pixellation) / pixellation;
// swirl
vec3 uvt = vec3(local_uv.x, local_uv.y, TIME * time_scale); vec3 uvt = vec3(local_uv.x, local_uv.y, TIME * time_scale);
uvt.x += sin(uvt.y * 1.54 * PI + uvt.z) * cos(uvt.y * 1.31 * PI + uvt.z) * 0.2;
uvt.y += cos(uvt.x * 1.74 * PI + uvt.z) * -sin(uvt.y * 1.64 * PI + uvt.z) * 0.3;
float value = texture(gunk_noise, uvt).r; float value = texture(gunk_noise, uvt).r;
vec3 color = mix(color_1, color_2, value); vec3 color = mix(color_1, color_2, value);

View File

@ -0,0 +1,66 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, sss_mode_skin;
uniform vec3 color_1: source_color = vec3(0.0, 0.03, 0.1);
uniform vec3 color_2: source_color = vec3(0.0, 0.1, 0.3);
uniform vec3 emission_color: source_color = vec3(0.25, 0.88, 1.0);
uniform float pixellation = 50.0;
uniform float roughness: hint_range(0.0, 1.0) = 0.15;
uniform float specular_contribution = 0.8;
uniform float emission_strength = 0.05;
// Used ONLY by the gunk, does not affect the gunk mask.
uniform vec2 uv_scale = vec2(1.0);
uniform float time_scale = 1.0;
uniform float edge_bleed = 0.1;
uniform sampler2D gunk_mask;
uniform highp sampler3D gunk_noise;
uniform highp sampler3D gunk_normal_map;
float hardstep(float value) {
float x = clamp(value, 0.0, 1.0);
return 0.5 * tanh( (20.0 * x - 10.0) * inversesqrt(x - x * x) ) + 0.5;
}
void fragment() {
vec2 local_uv = floor(UV * uv_scale * pixellation) / pixellation;
// wave
vec3 uvt = vec3(local_uv.x, local_uv.y, TIME * time_scale);
uvt.x += sin(uvt.y * 1.54 * PI + uvt.z) * cos(uvt.y * 1.31 * PI + uvt.z);
uvt.y += cos(uvt.x * 1.74 * PI + uvt.z) * -sin(uvt.y * 1.64 * PI + uvt.z);
float value = texture(gunk_noise, uvt).r;
vec3 color = mix(color_1, color_2, value);
ALBEDO = color.rgb;
ROUGHNESS = value * roughness;
EMISSION = (1.0 - value) * emission_color * emission_strength;
SPECULAR = 0.5 * inversesqrt(specular_contribution);
NORMAL_MAP = texture(gunk_normal_map, uvt).xyz;
float mask = texture(gunk_mask, UV).r;
// soften edges
NORMAL_MAP *= smoothstep(1.0, 0.0, mask);
/*
// Hard edge
if(mask + edge_bleed < 0.5) {
ALPHA = 1.0;
} else {
ALPHA = 0.0;
}
*/
// Hardish edge
ALPHA = hardstep(1.0 - mask + edge_bleed);
}

View File

@ -9,9 +9,6 @@ script = ExtResource("1_qqbpr")
[node name="MaskViewport" type="SubViewport" parent="."] [node name="MaskViewport" type="SubViewport" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
handle_input_locally = false handle_input_locally = false
msaa_2d = 3
canvas_item_default_texture_filter = 0
canvas_item_default_texture_repeat = 1
size = Vector2i(1024, 1024) size = Vector2i(1024, 1024)
render_target_clear_mode = 1 render_target_clear_mode = 1
render_target_update_mode = 4 render_target_update_mode = 4