niveau/transitions: shader de transition
Entre les niveaux et à la mort il y a maintenant un fondu au noir qui se met en place pour éviter d'avoir la gerbe sur les mouvements de caméra. la physique est en pause pendant la transition.
This commit is contained in:
BIN
shaders/masks/curtain.png
Normal file
BIN
shaders/masks/curtain.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
35
shaders/masks/curtain.png.import
Normal file
35
shaders/masks/curtain.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b5mne7k2hxq4m"
|
||||
path.s3tc="res://.godot/imported/curtain.png-5dbd4676444a95ae3c4ec4f3e7000c6e.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://shaders/masks/curtain.png"
|
||||
dest_files=["res://.godot/imported/curtain.png-5dbd4676444a95ae3c4ec4f3e7000c6e.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
|
||||
BIN
shaders/masks/shards.png
Normal file
BIN
shaders/masks/shards.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
35
shaders/masks/shards.png.import
Normal file
35
shaders/masks/shards.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dwn3g5smhhcb0"
|
||||
path.s3tc="res://.godot/imported/shards.png-8f1a380663fac4b8c90fd5ea54d3ed72.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://shaders/masks/shards.png"
|
||||
dest_files=["res://.godot/imported/shards.png-8f1a380663fac4b8c90fd5ea54d3ed72.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
|
||||
11
shaders/transition_shader.gd
Normal file
11
shaders/transition_shader.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends ColorRect
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
16
shaders/transition_shader.gdshader
Normal file
16
shaders/transition_shader.gdshader
Normal file
@@ -0,0 +1,16 @@
|
||||
shader_type canvas_item;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform float cutoff: hint_range(0.0, 1.0);
|
||||
uniform float smooth_size: hint_range(0.0, 0.1);
|
||||
uniform sampler2D mask: hint_default_black;
|
||||
|
||||
void fragment() {
|
||||
float value = texture(mask, UV).r;
|
||||
float alpha = smoothstep(
|
||||
cutoff,
|
||||
cutoff + smooth_size,
|
||||
value * (1.0 - smooth_size) + smooth_size
|
||||
);
|
||||
COLOR = vec4(COLOR.rgb, alpha);
|
||||
}
|
||||
90
shaders/transition_shader.tscn
Normal file
90
shaders/transition_shader.tscn
Normal file
@@ -0,0 +1,90 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://17macg0q4k8l"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/transition_shader.gdshader" id="1_kyfmm"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5mne7k2hxq4m" path="res://shaders/masks/curtain.png" id="2_pg1r4"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_g48os"]
|
||||
shader = ExtResource("1_kyfmm")
|
||||
shader_parameter/cutoff = 0.0
|
||||
shader_parameter/smooth_size = 0.1
|
||||
shader_parameter/mask = ExtResource("2_pg1r4")
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_rrd13"]
|
||||
script/source = "class_name FadeShader extends ColorRect
|
||||
|
||||
signal fade_in_done()
|
||||
signal fade_out_done()
|
||||
|
||||
@onready var player := $\"AnimationPlayer\" as AnimationPlayer
|
||||
|
||||
func fade_in():
|
||||
player.play(&\"fade_in\")
|
||||
|
||||
func fade_out():
|
||||
player.play(&\"fade_out\")
|
||||
|
||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == \"fade_in\":
|
||||
fade_in_done.emit()
|
||||
elif anim_name == \"fade_out\":
|
||||
fade_out_done.emit()
|
||||
"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yg4ht"]
|
||||
resource_name = "fade_in"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:material:shader_parameter/cutoff")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.2, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 0.450625),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mavdc"]
|
||||
resource_name = "fade_out"
|
||||
length = 0.25
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:material:shader_parameter/cutoff")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [1.0, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kedvi"]
|
||||
_data = {
|
||||
"fade_in": SubResource("Animation_yg4ht"),
|
||||
"fade_out": SubResource("Animation_mavdc")
|
||||
}
|
||||
|
||||
[node name="TransitionShader" type="ColorRect"]
|
||||
material = SubResource("ShaderMaterial_g48os")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -1680.0
|
||||
offset_bottom = -945.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
color = Color(0, 0, 0, 1)
|
||||
script = SubResource("GDScript_rrd13")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kedvi")
|
||||
}
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||
Reference in New Issue
Block a user