This commit is contained in:
Marinho Brandao
2023-12-15 12:25:28 +01:00
parent cac890d6de
commit b922ff3bdf
5 changed files with 71 additions and 24 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://c051w6upl0t16"]
[gd_scene load_steps=20 format=3 uid="uid://c051w6upl0t16"]
[ext_resource type="Script" path="res://camera-effects/camera-effects-scene.gd" id="1_ct3xk"]
[ext_resource type="PackedScene" uid="uid://bvk23npqj2u2a" path="res://commons/halloween_village.tscn" id="2_8870h"]
@ -8,9 +8,9 @@
[ext_resource type="PackedScene" uid="uid://dv3o1u4hc11vn" path="res://camera-effects/sepia.tscn" id="10_rqewe"]
[ext_resource type="PackedScene" uid="uid://cf1adbox8xy7e" path="res://camera-effects/grain_noise.tscn" id="11_3qobw"]
[ext_resource type="PackedScene" uid="uid://dfy4v47aijqqp" path="res://camera-effects/under_water.tscn" id="12_76kh0"]
[ext_resource type="PackedScene" path="res://camera-effects/hexagon_mosaic.tscn" id="12_uvrob"]
[ext_resource type="Shader" path="res://camera-effects/mirage.gdshader" id="13_rl5nt"]
[ext_resource type="PackedScene" path="res://camera-effects/camera_shake.tscn" id="14_qhoe5"]
[ext_resource type="PackedScene" uid="uid://dwppksddt4t0x" path="res://camera-effects/hexagon_mosaic.tscn" id="12_uvrob"]
[ext_resource type="PackedScene" uid="uid://0ef8k2idbr15" path="res://camera-effects/mirage.tscn" id="13_rc6we"]
[ext_resource type="PackedScene" uid="uid://dxnm4sgbeu22g" path="res://camera-effects/camera_shake.tscn" id="14_qhoe5"]
[ext_resource type="Texture2D" uid="uid://etnwfy334jt" path="res://addons/kenney_particle_pack/window_03.png" id="14_ydbvf"]
[ext_resource type="PackedScene" uid="uid://kli822acdl5m" path="res://camera-effects/blur.tscn" id="15_kmr3r"]
[ext_resource type="PackedScene" uid="uid://pm0p6yeqy50d" path="res://camera-effects/fish_eye.tscn" id="16_nmfpv"]
@ -19,11 +19,6 @@
[sub_resource type="Environment" id="Environment_tln01"]
glow_blend_mode = 4
[sub_resource type="ShaderMaterial" id="ShaderMaterial_03j04"]
shader = ExtResource("13_rl5nt")
shader_parameter/blur_amount = 0.9
shader_parameter/strength = 0.01
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_24bae"]
bg_color = Color(0.278431, 0, 0.141176, 0.392157)
@ -73,7 +68,6 @@ light_energy = 2.0
unique_name_in_owner = true
[node name="Chromatic Aberration" parent="Effects" instance=ExtResource("7_uoado")]
visible = false
[node name="Pixelate" parent="Effects" instance=ExtResource("8_fshcg")]
visible = false
@ -102,13 +96,8 @@ visible = false
[node name="Under Water" parent="Effects" instance=ExtResource("12_76kh0")]
visible = false
[node name="Mirage" type="ColorRect" parent="Effects"]
material = SubResource("ShaderMaterial_03j04")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Mirage" parent="Effects" instance=ExtResource("13_rc6we")]
visible = false
[node name="CanvasLayer UI" type="CanvasLayer" parent="."]
@ -220,6 +209,13 @@ toggle_mode = true
button_group = ExtResource("16_r0ag1")
text = "Under Water"
[node name="Button Mirage" type="Button" parent="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 24
toggle_mode = true
button_group = ExtResource("16_r0ag1")
text = "Mirage"
[node name="ToggleButton" type="TextureButton" parent="CanvasLayer UI/SideBar"]
custom_minimum_size = Vector2(64, 2.08165e-12)
layout_mode = 2
@ -264,4 +260,5 @@ libraries = {
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/ButtonBlur" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/Button Fish Eye" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/Button Under Water" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/Button Mirage" to="." method="updateVisibleEffects"]
[connection signal="pressed" from="CanvasLayer UI/SideBar/ToggleButton" to="." method="toggleSideBar"]

View File

@ -1,14 +1,31 @@
shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform float blur_amount : hint_range(-2.0, 10.0) = .2;
uniform float strength : hint_range(0.0, 1.0) = .01;
uniform float focus : hint_range(0.0, 1.0) = .2;
uniform float centerLine : hint_range(0.0, 1.0) = .5;
uniform float speed : hint_range(0.0, 20.0) = 5.0;
uniform float sepia : hint_range(0.0, 1.0) = 0.0;
vec4 sepiaColor(vec4 col) {
return vec4(
col.r * .393 + col.g *.769 + col.b * .189,
col.r * .349 + col.g *.686 + col.b * .168,
col.r * .272 + col.g *.534 + col.b * .131,
col.a
);
}
void fragment() {
float yFromCenter = 1.0 - abs(UV.y - .5);
float blurImpact = blur_amount * yFromCenter;
vec2 uv = vec2(SCREEN_UV.x + sin(yFromCenter) * strength, SCREEN_UV.y);
vec4 blurred = textureLod(SCREEN_TEXTURE, uv, blurImpact);
float d = distance(SCREEN_UV.y, centerLine);
float yImpact = smoothstep(1.0 - focus, 1.0, 1.0 - d);
float wavedImpact = yImpact * strength * sin(TIME * speed);
vec2 uv = vec2(SCREEN_UV.x + wavedImpact, SCREEN_UV.y);
vec4 blurred = textureLod(SCREEN_TEXTURE, uv, blur_amount * yImpact);
COLOR = blurred;
vec4 withSepia = sepiaColor(blurred);
COLOR = mix(blurred, withSepia, sepia);
}

View File

@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://0ef8k2idbr15"]
[ext_resource type="Shader" path="res://camera-effects/mirage.gdshader" id="1_cps4x"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_03j04"]
shader = ExtResource("1_cps4x")
shader_parameter/blur_amount = 4.0
shader_parameter/strength = 0.02
shader_parameter/focus = 0.8
shader_parameter/centerLine = 0.1
shader_parameter/speed = 5.0
shader_parameter/sepia = 0.3
[node name="Mirage" type="ColorRect"]
material = SubResource("ShaderMaterial_03j04")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

View File

@ -460,7 +460,20 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 2)
[node name="tree_dead_large_decorated2" parent="Trees" instance=ExtResource("26_mv7qm")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, -4)
transform = Transform3D(0.866025, 0, 0.5, 0, 1, 0, -0.5, 0, 0.866025, -4, 0, -4)
[node name="OmniLight3D" type="OmniLight3D" parent="Trees/tree_dead_large_decorated2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.746172, 1.95825, -0.422976)
light_color = Color(0.964706, 0.6, 0, 1)
light_energy = 10.0
[node name="tree_dead_large_decorated3" parent="Trees" instance=ExtResource("26_mv7qm")]
transform = Transform3D(-0.866025, 0, -0.5, 0, 1, 0, 0.5, 0, -0.866025, 11, 0, 1)
[node name="OmniLight3D" type="OmniLight3D" parent="Trees/tree_dead_large_decorated3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.746172, 1.95825, -0.422976)
light_color = Color(0.964706, 0.6, 0, 1)
light_energy = 10.0
[node name="tree_dead_medium2" parent="Trees" instance=ExtResource("27_3pc3p")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 2)

View File

@ -5,7 +5,7 @@
[ext_resource type="PackedScene" uid="uid://cxj4cf67il71y" path="res://particles/smoke.tscn" id="1_vs4eb"]
[ext_resource type="PackedScene" uid="uid://c4g1wgyk5ynef" path="res://particles/fire.tscn" id="2_ua5o7"]
[ext_resource type="PackedScene" uid="uid://bdwxckix3vslo" path="res://particles/hurricane.tscn" id="3_1jf4n"]
[ext_resource type="PackedScene" uid="uid://ce6advdj56x0c" path="res://particles/hyperdrive.tscn" id="4_waeec"]
[ext_resource type="PackedScene" path="res://particles/hyperdrive.tscn" id="4_waeec"]
[ext_resource type="PackedScene" uid="uid://b2dthk7xytysh" path="res://particles/shield.tscn" id="5_iqqai"]
[ext_resource type="PackedScene" uid="uid://1p0djdxytw42" path="res://particles/sparks.tscn" id="6_n8y86"]
[ext_resource type="PackedScene" uid="uid://1nbihtdf4hnv" path="res://particles/rain.tscn" id="8_pqidy"]