Blur camera effect

This commit is contained in:
Mario Brandao 2023-12-14 23:00:04 +01:00
parent 8a26c09b1a
commit d460749fb7
3 changed files with 233 additions and 87 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=3 uid="uid://c051w6upl0t16"]
[gd_scene load_steps=24 format=3 uid="uid://c051w6upl0t16"]
[ext_resource type="PackedScene" uid="uid://bydyult2k5rcb" path="res://addons/kenney_prototype_tools/scenes/green/green_01.tscn" id="1_61jfr"]
[ext_resource type="Script" path="res://camera-effects/camera-effects-scene.gd" id="1_ct3xk"]
@ -15,7 +15,7 @@
[ext_resource type="PackedScene" path="res://camera-effects/hexagon_mosaic.tscn" id="12_uvrob"]
[ext_resource type="PackedScene" 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="Shader" path="res://camera-effects/blur.gdshader" id="15_4061k"]
[ext_resource type="PackedScene" uid="uid://kli822acdl5m" path="res://camera-effects/blur.tscn" id="15_kmr3r"]
[ext_resource type="ButtonGroup" uid="uid://2yjsq45hqgit" path="res://camera-effects/camera_button_group.tres" id="16_r0ag1"]
[sub_resource type="Environment" id="Environment_tln01"]
@ -28,10 +28,6 @@ albedo_color = Color(0.337255, 0.890196, 0.207843, 1)
material = SubResource("StandardMaterial3D_u8hyj")
size = Vector2(20, 20)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_petba"]
shader = ExtResource("15_4061k")
shader_parameter/lod = 0.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_24bae"]
bg_color = Color(0.278431, 0, 0.141176, 0.392157)
@ -81,113 +77,229 @@ light_energy = 2.0
mesh = SubResource("PlaneMesh_wx71g")
skeleton = NodePath("../..")
[node name="Cube" parent="Scene" instance=ExtResource("1_61jfr")]
[node name="Block of blocks" type="Node3D" parent="Scene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 5)
[node name="Cube2" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 5)
[node name="Cube" parent="Scene/Block of blocks" instance=ExtResource("1_61jfr")]
[node name="Cube3" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 5)
[node name="Cube2" parent="Scene/Block of blocks" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="Cube4" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 5)
[node name="Cube3" parent="Scene/Block of blocks" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
[node name="Cube5" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 5)
[node name="Cube4" parent="Scene/Block of blocks" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0)
[node name="Cube6" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 0, 4)
[node name="Cube5" parent="Scene/Block of blocks" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
[node name="Cube7" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 4)
[node name="Cube6" parent="Scene/Block of blocks" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -1)
[node name="Cube12" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 4)
[node name="Cube7" parent="Scene/Block of blocks" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1)
[node name="Cube13" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 4)
[node name="Cube12" parent="Scene/Block of blocks" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -1)
[node name="Cube14" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 4)
[node name="Cube13" parent="Scene/Block of blocks" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1)
[node name="Cube8" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 6)
[node name="Cube14" parent="Scene/Block of blocks" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -1)
[node name="Cube9" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 6)
[node name="Cube8" parent="Scene/Block of blocks" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1)
[node name="Cube10" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 6)
[node name="Cube9" parent="Scene/Block of blocks" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="Cube11" parent="Scene" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 7)
[node name="Cube10" parent="Scene/Block of blocks" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1)
[node name="Cube15" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 3)
[node name="Cube11" parent="Scene/Block of blocks" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
[node name="Cube16" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 3)
[node name="Cube15" parent="Scene/Block of blocks" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -2)
[node name="Cube17" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 3)
[node name="Cube16" parent="Scene/Block of blocks" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -2)
[node name="Cube18" parent="Scene" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 2)
[node name="Cube17" parent="Scene/Block of blocks" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2)
[node name="Cube19" parent="Scene" instance=ExtResource("1_61jfr")]
[node name="Cube18" parent="Scene/Block of blocks" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3)
[node name="Block of blocks2" type="Node3D" parent="Scene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 2)
[node name="Cube" parent="Scene/Block of blocks2" instance=ExtResource("1_61jfr")]
[node name="Cube2" parent="Scene/Block of blocks2" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="Cube3" parent="Scene/Block of blocks2" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
[node name="Cube4" parent="Scene/Block of blocks2" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0)
[node name="Cube5" parent="Scene/Block of blocks2" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
[node name="Cube6" parent="Scene/Block of blocks2" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -1)
[node name="Cube7" parent="Scene/Block of blocks2" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1)
[node name="Cube12" parent="Scene/Block of blocks2" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -1)
[node name="Cube13" parent="Scene/Block of blocks2" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1)
[node name="Cube14" parent="Scene/Block of blocks2" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -1)
[node name="Cube8" parent="Scene/Block of blocks2" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1)
[node name="Cube9" parent="Scene/Block of blocks2" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="Cube10" parent="Scene/Block of blocks2" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1)
[node name="Cube11" parent="Scene/Block of blocks2" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
[node name="Cube15" parent="Scene/Block of blocks2" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -2)
[node name="Cube16" parent="Scene/Block of blocks2" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -2)
[node name="Cube17" parent="Scene/Block of blocks2" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2)
[node name="Cube18" parent="Scene/Block of blocks2" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3)
[node name="Block of blocks4" type="Node3D" parent="Scene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, -2)
[node name="Cube" parent="Scene/Block of blocks4" instance=ExtResource("1_61jfr")]
[node name="Cube2" parent="Scene/Block of blocks4" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="Cube3" parent="Scene/Block of blocks4" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
[node name="Cube4" parent="Scene/Block of blocks4" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0)
[node name="Cube5" parent="Scene/Block of blocks4" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
[node name="Cube6" parent="Scene/Block of blocks4" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -1)
[node name="Cube7" parent="Scene/Block of blocks4" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1)
[node name="Cube12" parent="Scene/Block of blocks4" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -1)
[node name="Cube13" parent="Scene/Block of blocks4" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1)
[node name="Cube14" parent="Scene/Block of blocks4" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -1)
[node name="Cube8" parent="Scene/Block of blocks4" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1)
[node name="Cube9" parent="Scene/Block of blocks4" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="Cube10" parent="Scene/Block of blocks4" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1)
[node name="Cube11" parent="Scene/Block of blocks4" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
[node name="Cube15" parent="Scene/Block of blocks4" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -2)
[node name="Cube16" parent="Scene/Block of blocks4" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -2)
[node name="Cube17" parent="Scene/Block of blocks4" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2)
[node name="Cube18" parent="Scene/Block of blocks4" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3)
[node name="Block of blocks3" type="Node3D" parent="Scene"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -5)
[node name="Cube20" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -5)
[node name="Cube" parent="Scene/Block of blocks3" instance=ExtResource("1_61jfr")]
[node name="Cube21" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -5)
[node name="Cube2" parent="Scene/Block of blocks3" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="Cube22" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -5)
[node name="Cube3" parent="Scene/Block of blocks3" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
[node name="Cube23" parent="Scene" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -5)
[node name="Cube4" parent="Scene/Block of blocks3" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0)
[node name="Cube24" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, -6)
[node name="Cube5" parent="Scene/Block of blocks3" instance=ExtResource("1_61jfr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
[node name="Cube25" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -6)
[node name="Cube6" parent="Scene/Block of blocks3" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -1)
[node name="Cube26" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -6)
[node name="Cube7" parent="Scene/Block of blocks3" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1)
[node name="Cube27" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -6)
[node name="Cube12" parent="Scene/Block of blocks3" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -1)
[node name="Cube28" parent="Scene" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -6)
[node name="Cube13" parent="Scene/Block of blocks3" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1)
[node name="Cube29" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -4)
[node name="Cube14" parent="Scene/Block of blocks3" instance=ExtResource("2_xlmfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -1)
[node name="Cube30" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -4)
[node name="Cube8" parent="Scene/Block of blocks3" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1)
[node name="Cube31" parent="Scene" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -4)
[node name="Cube9" parent="Scene/Block of blocks3" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
[node name="Cube32" parent="Scene" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -3)
[node name="Cube10" parent="Scene/Block of blocks3" instance=ExtResource("3_xj16f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1)
[node name="Cube33" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -7)
[node name="Cube11" parent="Scene/Block of blocks3" instance=ExtResource("4_paly4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
[node name="Cube34" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -7)
[node name="Cube15" parent="Scene/Block of blocks3" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -2)
[node name="Cube35" parent="Scene" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -7)
[node name="Cube16" parent="Scene/Block of blocks3" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -2)
[node name="Cube36" parent="Scene" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -8)
[node name="Cube17" parent="Scene/Block of blocks3" instance=ExtResource("5_dra7r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2)
[node name="Cube18" parent="Scene/Block of blocks3" instance=ExtResource("6_y7myb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3)
[node name="Effects" type="CanvasLayer" parent="."]
unique_name_in_owner = true
@ -213,13 +325,7 @@ visible = false
[node name="Camera Shake" parent="Effects" instance=ExtResource("14_qhoe5")]
visible = false
[node name="Blur" type="ColorRect" parent="Effects"]
material = SubResource("ShaderMaterial_petba")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Blur" parent="Effects" instance=ExtResource("15_kmr3r")]
[node name="CanvasLayer UI" type="CanvasLayer" parent="."]
@ -316,6 +422,14 @@ toggle_mode = true
button_group = ExtResource("16_r0ag1")
text = "Camera Shake"
[node name="ButtonBlur" type="Button" parent="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 24
toggle_mode = true
button_group = ExtResource("16_r0ag1")
text = "Blur"
[node name="ToggleButton" type="TextureButton" parent="CanvasLayer UI/SideBar"]
custom_minimum_size = Vector2(64, 2.08165e-12)
layout_mode = 2
@ -357,4 +471,5 @@ libraries = {
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/ButtonGrainNoise" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/ButtonHexagonMosaic" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/ButtonCameraShake" to="." method="updateVisibleEffects"]
[connection signal="toggled" from="CanvasLayer UI/SideBar/SideBar Menu/MarginContainer/VBoxContainer/ButtonBlur" to="." method="updateVisibleEffects"]
[connection signal="pressed" from="CanvasLayer UI/SideBar/ToggleButton" to="." method="toggleSideBar"]

View File

@ -1,9 +1,21 @@
shader_type canvas_item;
uniform float lod : hint_range(0.0, 5.0) = 0.0;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear;
// inspired by: https://godotshaders.com/shader/simple-blur-mixed-with-a-color/
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform float blur_amount : hint_range(-2.0, 10.0);
uniform float mix_amount : hint_range(0.0, 1.0);
uniform vec4 color_over : source_color;
uniform float focus_radius : hint_range(0.0, 1.0) = 0.1;
uniform float focus_edge : hint_range(0.0, 1.0) = 0.1;
void fragment() {
vec4 col = texture(SCREEN_TEXTURE, UV, lod);
COLOR = col;
vec2 CENTER = vec2(0.5, 0.5);
float d = distance(SCREEN_UV, CENTER);
float within_radius = smoothstep(focus_radius, focus_radius + focus_edge, d);
vec4 blurred = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur_amount * within_radius);
vec4 fin = mix(blurred, color_over, mix_amount);
COLOR = fin;
}

19
camera-effects/blur.tscn Normal file
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://kli822acdl5m"]
[ext_resource type="Shader" path="res://camera-effects/blur.gdshader" id="1_vf6s1"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_petba"]
shader = ExtResource("1_vf6s1")
shader_parameter/blur_amount = 2.0
shader_parameter/mix_amount = 0.0
shader_parameter/color_over = null
shader_parameter/focus_radius = 0.25
shader_parameter/focus_edge = 0.1
[node name="Blur" type="ColorRect"]
material = SubResource("ShaderMaterial_petba")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2