Listener idle ping effect

This commit is contained in:
Rob Kelly 2025-08-28 16:28:41 -06:00
parent 5c6d4ce3bb
commit 1265dc2eb7
8 changed files with 800 additions and 599 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=3 uid="uid://kctp5erogwcb"]
[gd_scene load_steps=34 format=3 uid="uid://kctp5erogwcb"]
[ext_resource type="Script" uid="uid://bde7cglaqobkd" path="res://src/world/mechanics/listener/listener.gd" id="1_htscg"]
[ext_resource type="Script" uid="uid://cfsiyhhrcua6o" path="res://src/world/game_sound/game_sound_listener.gd" id="2_htscg"]
@ -36,6 +36,15 @@ height = 32
depth = 128
noise = SubResource("FastNoiseLite_7fplw")
[sub_resource type="Gradient" id="Gradient_ih22n"]
offsets = PackedFloat32Array(0, 0.001, 0.05)
colors = PackedColorArray(0, 0, 0, 1, 0.25098, 0.878431, 1, 1, 0, 0, 0, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_v2pcm"]
gradient = SubResource("Gradient_ih22n")
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pp7wn"]
resource_local_to_scene = true
render_priority = 0
@ -60,7 +69,8 @@ shader_parameter/jitter_time_scale = 0.1
shader_parameter/jitter_noise = SubResource("NoiseTexture3D_omayi")
shader_parameter/vertex_inflation = 0.0
shader_parameter/inflation_pixellation = 10.0
shader_parameter/overlay_emission_scale = 1.0
shader_parameter/overlay_emission = SubResource("GradientTexture2D_v2pcm")
shader_parameter/overlay_emission_scale = 0.02
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_pp7wn"]
width = 256
@ -87,21 +97,21 @@ height = 32
depth = 128
noise = SubResource("FastNoiseLite_c5snp")
[sub_resource type="Gradient" id="Gradient_c5snp"]
[sub_resource type="Gradient" id="Gradient_pp7wn"]
resource_local_to_scene = true
offsets = PackedFloat32Array(0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008)
colors = PackedColorArray(0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_m4i7y"]
[sub_resource type="GradientTexture2D" id="GradientTexture2D_c5snp"]
resource_local_to_scene = true
gradient = SubResource("Gradient_c5snp")
gradient = SubResource("Gradient_pp7wn")
width = 32
height = 32
fill = 1
fill_from = Vector2(0.5, 0.5)
fill_to = Vector2(1, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yuift"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_m4i7y"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("4_pp7wn")
@ -125,7 +135,7 @@ shader_parameter/jitter_time_scale = 0.1
shader_parameter/jitter_noise = SubResource("NoiseTexture3D_q7kpl")
shader_parameter/vertex_inflation = 0.0
shader_parameter/inflation_pixellation = 10.0
shader_parameter/overlay_emission = SubResource("GradientTexture2D_m4i7y")
shader_parameter/overlay_emission = SubResource("GradientTexture2D_c5snp")
shader_parameter/overlay_emission_scale = 6.0
[sub_resource type="Curve" id="Curve_pp7wn"]
@ -207,16 +217,59 @@ shape = SubResource("SphereShape3D_2ibh1")
unique_name_in_owner = true
transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0)
[node name="Skeleton3D" parent="ListenerModel/Armature" index="0"]
bones/0/rotation = Quaternion(-1.51225e-09, 0.130526, 4.05207e-10, 0.991445)
bones/1/rotation = Quaternion(9.2869e-09, 0.130526, -8.10413e-10, 0.991445)
bones/2/rotation = Quaternion(-9.1802e-09, 0.130526, -8.10414e-10, 0.991445)
bones/3/rotation = Quaternion(6.20905e-09, 0.130526, -4.05206e-10, 0.991445)
bones/4/rotation = Quaternion(-8.49624e-09, 0.130526, -9.00455e-11, 0.991445)
bones/5/rotation = Quaternion(0.54585, 0.487268, 0.374478, -0.569548)
bones/6/rotation = Quaternion(0.308353, 2.1709e-08, 1.30586e-08, 0.951272)
bones/7/rotation = Quaternion(0.334237, -0.119529, -0.0427788, 0.9339)
bones/8/rotation = Quaternion(0.247978, -2.40337e-10, -3.8454e-09, 0.968766)
bones/9/rotation = Quaternion(0.148338, 2.82522e-09, -5.65045e-09, 0.988937)
bones/10/rotation = Quaternion(0.237284, 7.34911e-07, -1.96017e-07, 0.97144)
bones/11/rotation = Quaternion(0.285481, 0.70676, 0.597232, -0.249609)
bones/12/rotation = Quaternion(0.308353, 6.75348e-08, -4.55922e-08, 0.951272)
bones/13/rotation = Quaternion(0.334237, -0.119529, -0.0427787, 0.9339)
bones/14/rotation = Quaternion(0.247978, 6.91065e-10, -2.79256e-08, 0.968766)
bones/15/rotation = Quaternion(0.148338, 7.66861e-08, 9.51493e-08, 0.988937)
bones/16/rotation = Quaternion(0.237284, 1.57873e-06, -4.4533e-07, 0.97144)
bones/17/rotation = Quaternion(-0.0513825, 0.736877, 0.659958, 0.137212)
bones/18/rotation = Quaternion(0.308353, -1.71875e-07, -7.09416e-08, 0.951272)
bones/19/rotation = Quaternion(0.334237, -0.119529, -0.0427786, 0.9339)
bones/20/rotation = Quaternion(0.247978, -5.53974e-08, -1.69864e-07, 0.968766)
bones/21/rotation = Quaternion(0.148338, 4.98196e-08, 2.63702e-07, 0.988937)
bones/22/rotation = Quaternion(0.237284, 2.44019e-06, -9.05055e-07, 0.97144)
bones/23/rotation = Quaternion(-0.374478, 0.569548, 0.545849, 0.487268)
bones/24/rotation = Quaternion(0.308353, -3.56631e-08, -1.14694e-08, 0.951272)
bones/25/rotation = Quaternion(0.334237, -0.119529, -0.0427786, 0.9339)
bones/26/rotation = Quaternion(0.247978, -6.25756e-08, -2.50967e-07, 0.968766)
bones/27/rotation = Quaternion(0.148338, 2.83936e-08, 1.69831e-07, 0.988937)
bones/28/rotation = Quaternion(0.237284, 3.38177e-06, -1.02259e-06, 0.97144)
bones/29/rotation = Quaternion(-0.597232, 0.249609, 0.285481, 0.70676)
bones/30/rotation = Quaternion(0.308353, 2.31089e-09, 1.50606e-08, 0.951272)
bones/31/rotation = Quaternion(0.334237, -0.119529, -0.0427785, 0.9339)
bones/32/rotation = Quaternion(0.247978, -3.1123e-08, -2.32956e-07, 0.968766)
bones/33/rotation = Quaternion(0.148338, 5.29717e-08, 2.76084e-07, 0.988937)
bones/34/rotation = Quaternion(0.237284, 4.29037e-06, -1.26097e-06, 0.97144)
bones/35/rotation = Quaternion(-0.659958, -0.137212, -0.0513825, 0.736877)
bones/36/rotation = Quaternion(0.308353, 3.35578e-09, 4.35599e-09, 0.951272)
bones/37/rotation = Quaternion(0.334237, -0.119529, -0.0427785, 0.9339)
bones/38/rotation = Quaternion(0.247978, -1.26717e-07, -3.12779e-07, 0.968766)
bones/39/rotation = Quaternion(0.148338, 2.72959e-08, 3.46469e-07, 0.988937)
bones/40/rotation = Quaternion(0.237284, 5.07144e-06, -1.68211e-06, 0.97144)
[node name="Listener" parent="ListenerModel/Armature/Skeleton3D" index="0"]
surface_material_override/0 = SubResource("ShaderMaterial_pp7wn")
surface_material_override/1 = SubResource("ShaderMaterial_yuift")
surface_material_override/1 = SubResource("ShaderMaterial_m4i7y")
[node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="ListenerModel/Armature/Skeleton3D" index="6"]
[node name="PhysicalBone3D" type="PhysicalBone3D" parent="ListenerModel/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(0.323524, 1.26311e-06, 1.20741, -3.57116e-07, 1.25, -1.21197e-06, -1.20741, -3.12655e-08, 0.323524, -4.8128e-06, 0.800007, -1.25657e-06)
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.38539e-08, -5.72204e-06, 3.9816e-06)
body_offset = Transform3D(1.25, 3.57626e-07, -3.57628e-07, -3.57627e-07, 1.25, -1.22189e-06, 3.57628e-07, 1.22189e-06, 1.25, -2.98139e-08, 7.15256e-06, -4.97699e-06)
transform = Transform3D(0.323524, 1.2631e-06, 1.20741, -3.57116e-07, 1.25, -1.21197e-06, -1.20741, -3.12658e-08, 0.323524, -4.8128e-06, 0.800007, -1.25657e-06)
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.3854e-08, -5.72204e-06, 3.9816e-06)
body_offset = Transform3D(1.25, 3.57627e-07, -3.57628e-07, -3.57627e-07, 1.25, -1.22189e-06, 3.57628e-07, 1.22189e-06, 1.25, -2.9814e-08, 7.15256e-06, -4.97699e-06)
bone_name = "Stem5"
[node name="RemoteTransform3D" type="RemoteTransform3D" parent="ListenerModel/Armature/Skeleton3D/PhysicalBoneSimulator3D/PhysicalBone3D"]
@ -239,7 +292,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.14, 0)
shape = SubResource("CylinderShape3D_dqq13")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
transform = Transform3D(0.258814, 1.01046e-06, 0.96591, -2.85687e-07, 0.999981, -9.69564e-07, -0.965905, -2.50119e-08, 0.258815, -3.61278e-06, 0.875006, -1.01113e-06)
transform = Transform3D(0.258814, 1.01046e-06, 0.96591, -2.85687e-07, 0.999981, -9.69562e-07, -0.965905, -2.50122e-08, 0.258815, -3.61278e-06, 0.875006, -1.01113e-06)
shape = SubResource("CylinderShape3D_r42ft")
[node name="CooldownTimer" type="Timer" parent="."]

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=24 format=3 uid="uid://c2c0ooj1re3dk"]
[gd_scene load_steps=34 format=3 uid="uid://c2c0ooj1re3dk"]
[ext_resource type="PackedScene" uid="uid://coucghe370fff" path="res://assets/grunk/listener/listener.gltf" id="1_lgdkx"]
[ext_resource type="Script" uid="uid://co4gkdwyhdbmc" path="res://src/world/mechanics/listener/listener_model.gd" id="2_yh3g4"]
[ext_resource type="Material" uid="uid://bmab6i16v748m" path="res://assets/materials/grunk_jittery.material" id="3_xijsm"]
[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="4_q7kpl"]
[ext_resource type="Animation" uid="uid://dihyn82xf67ou" path="res://assets/grunk/listener/animations/RESET.res" id="4_y4jww"]
[ext_resource type="Animation" uid="uid://c236lo5xytxaa" path="res://assets/grunk/listener/animations/idle.res" id="5_3vskp"]
@ -11,6 +10,68 @@
[ext_resource type="Animation" uid="uid://bujor2i5icw8c" path="res://assets/grunk/listener/animations/close.res" id="6_ghw47"]
[ext_resource type="Script" uid="uid://cw0vig0h2hpaf" path="res://src/world/mechanics/listener/band_controller.gd" id="7_6cdu3"]
[ext_resource type="Animation" uid="uid://c4juq6vxnnxbe" path="res://assets/grunk/listener/animations/open.res" id="7_c25ju"]
[ext_resource type="Script" uid="uid://ctyyoh8qiyf8t" path="res://src/world/mechanics/listener/ping_band_controller.gd" id="7_ftf52"]
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2roq2"]
width = 256
height = 256
depth = 32
seamless = true
seamless_blend_skirt = 0.5
noise = ExtResource("6_ftf52")
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_fk1xc"]
width = 256
height = 256
depth = 32
seamless = true
seamless_blend_skirt = 0.5
noise = ExtResource("6_ftf52")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_7fplw"]
frequency = 0.0703
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_omayi"]
width = 32
height = 32
depth = 128
noise = SubResource("FastNoiseLite_7fplw")
[sub_resource type="Gradient" id="Gradient_ih22n"]
offsets = PackedFloat32Array(0, 0.05, 0.999)
colors = PackedColorArray(0, 0, 0, 1, 0.25098, 0.878431, 1, 1, 0, 0, 0, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_v2pcm"]
gradient = SubResource("Gradient_ih22n")
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u8t4w"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("4_q7kpl")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 1)
shader_parameter/emission_color = Color(0.25, 0.88, 1, 1)
shader_parameter/pixellation = 128.0
shader_parameter/time_pixellation = 30.0
shader_parameter/roughness = 0.15
shader_parameter/specular_contribution = 0.8
shader_parameter/emission_strength = 0.02
shader_parameter/normal_scale = 1.0
shader_parameter/uv_scale = Vector2(2, 2)
shader_parameter/time_scale = 0.2
shader_parameter/edge_bleed = 0.25
shader_parameter/gunk_mask = ExtResource("5_6cdu3")
shader_parameter/gunk_noise = SubResource("NoiseTexture3D_2roq2")
shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_fk1xc")
shader_parameter/jitter_magnitude = 0.4
shader_parameter/jitter_time_scale = 0.1
shader_parameter/jitter_noise = SubResource("NoiseTexture3D_omayi")
shader_parameter/vertex_inflation = 0.0
shader_parameter/inflation_pixellation = 10.0
shader_parameter/overlay_emission = SubResource("GradientTexture2D_v2pcm")
shader_parameter/overlay_emission_scale = 0.02
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_pp7wn"]
width = 256
@ -175,6 +236,44 @@ _data = {
&"pulse": SubResource("Animation_ftf52")
}
[sub_resource type="Animation" id="Animation_6cdu3"]
resource_name = "ping"
length = 8.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Armature/Skeleton3D/Listener/PingBandController:band_position")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 6),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.2, -0.2]
}
[sub_resource type="Animation" id="Animation_ih22n"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Armature/Skeleton3D/Listener/PingBandController:band_position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [-0.1]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_v2pcm"]
_data = {
&"RESET": SubResource("Animation_ih22n"),
&"ping": SubResource("Animation_6cdu3")
}
[node name="ListenerModel" instance=ExtResource("1_lgdkx")]
script = ExtResource("2_yh3g4")
@ -222,12 +321,16 @@ bones/39/rotation = Quaternion(0.148338, 2.72959e-08, 3.46469e-07, 0.988937)
bones/40/rotation = Quaternion(0.237284, 5.07144e-06, -1.68211e-06, 0.97144)
[node name="Listener" parent="Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("3_xijsm")
surface_material_override/0 = SubResource("ShaderMaterial_u8t4w")
surface_material_override/1 = SubResource("ShaderMaterial_ftf52")
[node name="BandController" type="Node" parent="Armature/Skeleton3D/Listener" index="0"]
script = ExtResource("7_6cdu3")
[node name="PingBandController" type="Node" parent="Armature/Skeleton3D/Listener" index="1"]
script = ExtResource("7_ftf52")
band_color = Color(0.25098, 0.878431, 1, 1)
[node name="StemIK1" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="1"]
unique_name_in_owner = true
influence = 0.0
@ -340,3 +443,9 @@ libraries = {
libraries = {
&"": SubResource("AnimationLibrary_ih22n")
}
[node name="PingLoop" type="AnimationPlayer" parent="." index="6"]
libraries = {
&"": SubResource("AnimationLibrary_v2pcm")
}
autoplay = "ping"

View File

@ -0,0 +1,38 @@
@tool
extends Node
# Controller for the band position for the "ping" effect
const EPSILON: float = 0.001
const MAX_IDX: int = 2
const BG_COLOR: Color = Color.BLACK
@export var band_position := -0.1:
set(value):
band_position = value
_set_band_position(1, value)
@export var head_width := 0.01
@export var tail_width := 0.15
@export var band_color := Color.WHITE
var gradient: Gradient
func _ready() -> void:
var mesh_instance: MeshInstance3D = get_parent()
var material: ShaderMaterial = mesh_instance.get_surface_override_material(0)
var gradient_tex: GradientTexture2D = material.get_shader_parameter("overlay_emission")
gradient = gradient_tex.gradient
func _clamp_offset(idx: int, value: float) -> float:
return clampf(value, 0 + EPSILON * idx, 1 - EPSILON * (MAX_IDX - idx))
func _set_band_position(idx: int, position: float) -> void:
gradient.set_offset(idx + 1, _clamp_offset(idx + 1, position + tail_width))
gradient.set_offset(idx, _clamp_offset(idx, position))
gradient.set_offset(idx - 1, _clamp_offset(idx - 1, position - head_width))
gradient.set_color(idx + 1, BG_COLOR)
gradient.set_color(idx, band_color)
gradient.set_color(idx - 1, BG_COLOR)

View File

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