瞎子卧室门口水盆互动水波与叠化效果
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://crev0svowqla"
|
||||
path="res://.godot/imported/前景.png-4cb64b4ed3bd1ffff28f24c7c6572696.ctex"
|
||||
path="res://.godot/imported/fg_前景.png-6e236f11245e0041b5047b56dd703ced.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/前景.png"
|
||||
dest_files=["res://.godot/imported/前景.png-4cb64b4ed3bd1ffff28f24c7c6572696.ctex"]
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/fg_前景.png"
|
||||
dest_files=["res://.godot/imported/fg_前景.png-6e236f11245e0041b5047b56dd703ced.ctex"]
|
||||
|
||||
[params]
|
||||
|
BIN
asset/art/scene/c02/s06_二楼楼道/ux_水中倒影幼年.png
Normal file
After Width: | Height: | Size: 16 KiB |
34
asset/art/scene/c02/s06_二楼楼道/ux_水中倒影幼年.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0o1bgwdn6tcn"
|
||||
path="res://.godot/imported/ux_水中倒影幼年.png-9b8cff4fd9a38b7a640abbab3a37c1c8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影幼年.png"
|
||||
dest_files=["res://.godot/imported/ux_水中倒影幼年.png-9b8cff4fd9a38b7a640abbab3a37c1c8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
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=1
|
BIN
asset/art/scene/c02/s06_二楼楼道/ux_水中倒影成年.png
Normal file
After Width: | Height: | Size: 18 KiB |
34
asset/art/scene/c02/s06_二楼楼道/ux_水中倒影成年.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bfum7jdjilgif"
|
||||
path="res://.godot/imported/ux_水中倒影成年.png-23c0a97f87da300cfa51ff9b6d6f4efe.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影成年.png"
|
||||
dest_files=["res://.godot/imported/ux_水中倒影成年.png-23c0a97f87da300cfa51ff9b6d6f4efe.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
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=1
|
BIN
asset/art/scene/c02/s06_二楼楼道/ux_水盆波纹.png
Normal file
After Width: | Height: | Size: 54 KiB |
@ -2,16 +2,16 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://oixbn6pmn2do"
|
||||
path="res://.godot/imported/原色背景测试.png-aeb9296f4fcf168f7fc1898455fde349.ctex"
|
||||
uid="uid://s1c6gytu0gbx"
|
||||
path="res://.godot/imported/ux_水盆波纹.png-4d0811c21e738add0239f8c61fc87db4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/原色背景测试.png"
|
||||
dest_files=["res://.godot/imported/原色背景测试.png-aeb9296f4fcf168f7fc1898455fde349.ctex"]
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆波纹.png"
|
||||
dest_files=["res://.godot/imported/ux_水盆波纹.png-4d0811c21e738add0239f8c61fc87db4.ctex"]
|
||||
|
||||
[params]
|
||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://oiswtv7jqcqy"
|
||||
path="res://.godot/imported/水盆特写.png-18dcef2b274ca5d5520264a0fb265000.ctex"
|
||||
path="res://.godot/imported/ux_水盆特写.png-9a8266a5ee14433350463892caaade8e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/水盆特写.png"
|
||||
dest_files=["res://.godot/imported/水盆特写.png-18dcef2b274ca5d5520264a0fb265000.ctex"]
|
||||
source_file="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆特写.png"
|
||||
dest_files=["res://.godot/imported/ux_水盆特写.png-9a8266a5ee14433350463892caaade8e.ctex"]
|
||||
|
||||
[params]
|
||||
|
Before Width: | Height: | Size: 123 KiB |
@ -12,7 +12,8 @@ uniform float ripple_rate : hint_range(0, 20.0, 1) = 5;
|
||||
uniform float wave_amplitude: hint_range(0.001, 0.1, 0.001) = 0.05;
|
||||
uniform float wave_frequency: hint_range(0, 15, 0.01) = 4.0;
|
||||
|
||||
uniform sampler2D noise;
|
||||
uniform sampler2D boarder;
|
||||
uniform vec2 offset;
|
||||
|
||||
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap;
|
||||
|
||||
@ -24,14 +25,15 @@ vec2 wave(vec2 uv, float time) {
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 center_position = -1.0 + 2.0 * UV / (1.0 / TEXTURE_PIXEL_SIZE);
|
||||
vec2 center_position = -1.0 + 2.0 * (UV + offset) / (1.0 / TEXTURE_PIXEL_SIZE);
|
||||
float center_distance = length(center_position);
|
||||
|
||||
float ripple = sin(center_distance * -frequency * PI + ripple_rate * TIME) * amplitude / (center_distance + 1.0);
|
||||
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy + (center_position/center_distance) * ripple * wave_amplitude;
|
||||
if (texture(boarder, UV).a == 1.0){
|
||||
vec2 background_wave = wave(uv, TIME);
|
||||
vec4 background_texture = texture(SCREEN_TEXTURE,background_wave) * sqrt(amplitude);
|
||||
vec4 background_texture = texture(SCREEN_TEXTURE, background_wave) * sqrt(amplitude);
|
||||
|
||||
float alpha_scalar = (1.0 - min(center_distance, 1.0)) * background_texture.x * 2.5;
|
||||
|
||||
@ -39,5 +41,8 @@ void fragment() {
|
||||
background_texture.a = max(background_texture.a - (background_texture.y * 0.45), 0.0);
|
||||
|
||||
COLOR = vec4(background_texture.xyz, background_texture.a);
|
||||
|
||||
} else {
|
||||
// 直接从屏幕纹理取样当前像素的原色
|
||||
COLOR = texture(SCREEN_TEXTURE, UV);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://ce3p55nnts4v5" path="res://asset/audio/effect/action/cloth2.ogg" id="4_58e26"]
|
||||
[ext_resource type="PackedScene" uid="uid://61pis75a8fdq" path="res://scene/entity/portal.tscn" id="4_haidv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxw5rovg5mu1a" path="res://scene/ground/script/c02/s00_煤油灯.tscn" id="5_3p5ta"]
|
||||
[ext_resource type="Texture2D" uid="uid://crev0svowqla" path="res://asset/art/scene/c02/s06_二楼楼道/前景.png" id="5_26mqt"]
|
||||
[ext_resource type="Texture2D" uid="uid://crev0svowqla" path="res://asset/art/scene/c02/s06_二楼楼道/fg_前景.png" id="5_26mqt"]
|
||||
[ext_resource type="Texture2D" uid="uid://b78jbthcfkod7" path="res://asset/art/scene/c02/s03_公寓一楼院子/地面物品反光/地反光3.png" id="6_vbvbc"]
|
||||
[ext_resource type="PackedScene" uid="uid://cw3q5pvciumil" path="res://scene/entity/interactable.tscn" id="7_0d746"]
|
||||
[ext_resource type="Texture2D" uid="uid://b7uo33bdiwpl3" path="res://asset/art/scene/c02/s03_公寓一楼院子/地面物品反光/地反光4.png" id="8_7x2h6"]
|
||||
|
68
scene/ground/script/c02/水盆特写.gd
Normal file
@ -0,0 +1,68 @@
|
||||
extends CanvasLayer
|
||||
|
||||
signal exit(success: bool)
|
||||
|
||||
|
||||
@onready var ripple = $"水波" as Sprite2D
|
||||
@onready var shader = $"水波Shader" as ColorRect
|
||||
@onready var timer = $RippleTimer as Timer
|
||||
@onready var child_sprite = $"人像幼年"
|
||||
@onready var grownup_sprite = $"人像成年"
|
||||
|
||||
var image: Image
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
layer = GlobalConfig.CANVAS_LAYER_LITTLE_GAME
|
||||
image = ripple.texture.get_image()
|
||||
shader.gui_input.connect(_shader_input)
|
||||
timer.timeout.connect(_try_ripple)
|
||||
shader.material.set("shader_parameter/amplitude", 0.0)
|
||||
# 幼年 -> 成年
|
||||
var tween = create_tween() as Tween
|
||||
tween.tween_interval(1.5)
|
||||
tween.tween_property(child_sprite, "modulate:a", 0.0, 0.5)
|
||||
_try_ripple()
|
||||
|
||||
func _try_ripple():
|
||||
if ripple_tween and ripple_tween.is_valid():
|
||||
return
|
||||
# 先尝试 mouse 位置
|
||||
var mouse_pos = shader.get_global_mouse_position()
|
||||
if not _make_ripple(mouse_pos):
|
||||
var rand_pos = Vector2(randf_range(140, 425), randf_range(80, 250))
|
||||
_make_ripple(rand_pos)
|
||||
|
||||
|
||||
var ripple_tween: Tween
|
||||
|
||||
|
||||
func _shader_input(event: InputEvent) -> void:
|
||||
if event.is_pressed():
|
||||
var pos = ripple.get_global_mouse_position()
|
||||
_make_ripple(pos)
|
||||
|
||||
|
||||
func _make_ripple(pos:Vector2) -> bool:
|
||||
var p_pos = pos / ripple.scale.x
|
||||
var image_size = image.get_size()
|
||||
# return false if out of image
|
||||
if p_pos.x < 0 or p_pos.x > image_size.x or p_pos.y < 0 or p_pos.y > image_size.y:
|
||||
return false
|
||||
if image.get_pixelv(p_pos).a > 0:
|
||||
# setup shader_parameter/offset
|
||||
var m_offset = -Vector2(pos.x / 564 - 0.5, pos.y / 316 - 0.5)
|
||||
shader.material.set("shader_parameter/offset", m_offset)
|
||||
if GlobalConfig.DEBUG:
|
||||
print("水波特写 m_offset=", m_offset)
|
||||
if ripple_tween and ripple_tween.is_valid():
|
||||
ripple_tween.kill()
|
||||
ripple_tween = create_tween()
|
||||
ripple_tween.tween_property(shader.material, "shader_parameter/amplitude", 2.0, 0.3)
|
||||
ripple_tween.parallel().tween_property(child_sprite, "modulate:a", 1.0, 0.2)
|
||||
ripple_tween.parallel().tween_property(grownup_sprite, "modulate:a", 0.5, 0.2)
|
||||
ripple_tween.tween_property(shader.material, "shader_parameter/amplitude", 0.0, 2.0)
|
||||
ripple_tween.parallel().tween_property(child_sprite, "modulate:a", 0.0, 1.0)
|
||||
ripple_tween.parallel().tween_property(grownup_sprite, "modulate:a", 1.0, 1.5)
|
||||
return true
|
||||
return false
|
1
scene/ground/script/c02/水盆特写.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bica4jcy2w6ta
|
@ -1,17 +1,78 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://trkypc4gox20"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://trkypc4gox20"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dnrql1t0j6v8i" path="res://scene/ground/script/c02/通用特写脚本.gd" id="1_rdtwt"]
|
||||
[ext_resource type="Texture2D" uid="uid://oiswtv7jqcqy" path="res://asset/art/scene/c02/s06_二楼楼道/水盆特写.png" id="2_h4mql"]
|
||||
[ext_resource type="Script" uid="uid://bica4jcy2w6ta" path="res://scene/ground/script/c02/水盆特写.gd" id="1_qtddk"]
|
||||
[ext_resource type="Texture2D" uid="uid://oiswtv7jqcqy" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆特写.png" id="2_h4mql"]
|
||||
[ext_resource type="Texture2D" uid="uid://bfum7jdjilgif" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影成年.png" id="3_31ty5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0o1bgwdn6tcn" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水中倒影幼年.png" id="3_ekkoo"]
|
||||
[ext_resource type="Texture2D" uid="uid://s1c6gytu0gbx" path="res://asset/art/scene/c02/s06_二楼楼道/ux_水盆波纹.png" id="3_rdtwt"]
|
||||
[ext_resource type="Shader" uid="uid://hxcx4sbqtniu" path="res://asset/shader/ripple.gdshader" id="4_qtddk"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_qtddk"]
|
||||
load_path = "res://.godot/imported/ux_水盆波纹.png-4d0811c21e738add0239f8c61fc87db4.ctex"
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_31ty5"]
|
||||
shader = ExtResource("4_qtddk")
|
||||
shader_parameter/frequency = 8.0
|
||||
shader_parameter/amplitude = 2.0
|
||||
shader_parameter/ripple_rate = 5.0
|
||||
shader_parameter/wave_amplitude = 0.05
|
||||
shader_parameter/wave_frequency = 4.0
|
||||
shader_parameter/boarder = SubResource("CompressedTexture2D_qtddk")
|
||||
shader_parameter/offset = Vector2(0, 0)
|
||||
|
||||
[node name="水盆特写" type="CanvasLayer"]
|
||||
script = ExtResource("1_rdtwt")
|
||||
script = ExtResource("1_qtddk")
|
||||
metadata/_edit_vertical_guides_ = [424.0]
|
||||
metadata/_edit_horizontal_guides_ = [253.0]
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
[node name="背景" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("2_h4mql")
|
||||
expand_mode = 5
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="人像成年" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("3_31ty5")
|
||||
expand_mode = 5
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="人像幼年" type="TextureRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("3_ekkoo")
|
||||
expand_mode = 5
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="水波" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.223103, 0.223103, 0.223103, 0.215686)
|
||||
position = Vector2(283, 158)
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("3_rdtwt")
|
||||
|
||||
[node name="水波Shader" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_31ty5")
|
||||
custom_minimum_size = Vector2(350, 220)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="RippleTimer" type="Timer" parent="."]
|
||||
wait_time = 2.5
|
||||
autostart = true
|
||||
|