Skip to content

Commit

Permalink
Added blur shader to Pause Menu
Browse files Browse the repository at this point in the history
Pretty self explanatory. Can be easily tweaked with one parameter.
  • Loading branch information
Phazorknight committed Nov 28, 2024
1 parent 5ed169c commit 1dbc98b
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 55 deletions.
92 changes: 92 additions & 0 deletions addons/cogito/Assets/Shader/BlurShader.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[gd_resource type="VisualShader" load_steps=8 format=3 uid="uid://wn6mnfchf1w7"]

[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_1u1qt"]
source = 5

[sub_resource type="VisualShaderNodeFloatParameter" id="VisualShaderNodeFloatParameter_uy04d"]
parameter_name = "BlurStrength"
default_value_enabled = true

[sub_resource type="VisualShaderNodeTexture2DParameter" id="VisualShaderNodeTexture2DParameter_4pbl3"]
parameter_name = "Screen"
texture_type = 1
texture_filter = 3
texture_repeat = 2
texture_source = 1

[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_fy3um"]
input_name = "screen_uv"

[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_fh0io"]
default_input_values = [0, 0.0, 1, 2.0, 2, 0.5]

[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_oxcow"]
operator = 2

[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_rdldc"]
default_input_values = [0, 1.0, 1, 0.8, 2, 0.5]

[resource]
code = "shader_type canvas_item;
render_mode blend_mix;

uniform float BlurStrength = 0;
uniform sampler2D Screen : source_color, filter_nearest_mipmap, repeat_disable, hint_screen_texture;



void fragment() {
// Input:5
vec2 n_out5p0 = SCREEN_UV;


// FloatParameter:3
float n_out3p0 = BlurStrength;


// Mix:6
float n_in6p0 = 0.00000;
float n_in6p1 = 2.00000;
float n_out6p0 = mix(n_in6p0, n_in6p1, n_out3p0);


vec4 n_out2p0;
// Texture2D:2
n_out2p0 = textureLod(Screen, n_out5p0, n_out6p0);


// Mix:8
float n_in8p0 = 1.00000;
float n_in8p1 = 0.80000;
float n_out8p0 = mix(n_in8p0, n_in8p1, n_out3p0);


// VectorOp:7
vec3 n_out7p0 = vec3(n_out2p0.xyz) * vec3(n_out8p0);


// Output:0
COLOR.rgb = n_out7p0;


}
"
graph_offset = Vector2(-2019.17, 217.761)
mode = 1
flags/light_only = false
nodes/fragment/0/position = Vector2(-760, 80)
nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_1u1qt")
nodes/fragment/2/position = Vector2(-1360, 80)
nodes/fragment/3/node = SubResource("VisualShaderNodeFloatParameter_uy04d")
nodes/fragment/3/position = Vector2(-2220, 240)
nodes/fragment/4/node = SubResource("VisualShaderNodeTexture2DParameter_4pbl3")
nodes/fragment/4/position = Vector2(-2020, 540)
nodes/fragment/5/node = SubResource("VisualShaderNodeInput_fy3um")
nodes/fragment/5/position = Vector2(-1900, 0)
nodes/fragment/6/node = SubResource("VisualShaderNodeMix_fh0io")
nodes/fragment/6/position = Vector2(-1840, 120)
nodes/fragment/7/node = SubResource("VisualShaderNodeVectorOp_oxcow")
nodes/fragment/7/position = Vector2(-1080, 60)
nodes/fragment/8/node = SubResource("VisualShaderNodeMix_rdldc")
nodes/fragment/8/position = Vector2(-1380, 340)
nodes/fragment/connections = PackedInt32Array(4, 0, 2, 2, 5, 0, 2, 0, 3, 0, 6, 2, 6, 0, 2, 1, 2, 0, 7, 0, 3, 0, 8, 2, 8, 0, 7, 1, 7, 0, 0, 0)
8 changes: 4 additions & 4 deletions addons/cogito/DemoScenes/COGITO_3_Lobby.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ volumetric_fog_temporal_reprojection_amount = 0.85
density = 0.04
albedo = Color(0.694118, 0.694118, 0.694118, 1)

[sub_resource type="Resource" id="Resource_k3pmn"]
[sub_resource type="Resource" id="Resource_nbadd"]
resource_local_to_scene = true
script = ExtResource("4_0kggm")
grid = true
Expand Down Expand Up @@ -2427,7 +2427,7 @@ shadow_mesh = SubResource("ArrayMesh_3ecdw")
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_upcaa"]
data = PackedVector3Array(0.6928, 0.0903, -1.6, 0, 0.0903, -1.2, 0.6128, 0.0903, -0.88, 0.6128, 0.0903, -0.88, 0.7728, 0.0903, -0.88, 0.6928, 0.0903, -1.6, 0.7728, 0.0903, -0.88, 1.3856, 0.0903, -1.2, 0.6928, 0.0903, -1.6, 0.7728, 0.0903, -0.88, 0.7728, 0.0903, -0.72, 1.3856, 0.0903, -1.2, 0.6128, 0.0903, -0.72, 0.6128, 0.0903, -0.88, 0, 0.0903, -1.2, 0.6928, 0.0903, 0, 0.6128, 0.0903, -0.72, 0, 0.0903, -1.2, 0.6928, 0.0903, 0, 0.7728, 0.0903, -0.72, 0.6128, 0.0903, -0.72, 0, 0.0903, -0.4, 0.6928, 0.0903, 0, 0, 0.0903, -1.2, 0, 0.0903, -1.2, 0, 0.0903, -0.8, 0, 0.0903, -0.4, 0.6928, 0.0903, 0, 1.3856, 0.0903, -0.4, 0.7728, 0.0903, -0.72, 1.3856, 0.0903, -0.4, 1.3856, 0.0903, -1.2, 0.7728, 0.0903, -0.72, 1.3856, 0.0903, -0.4, 1.3856, 0.0903, -0.8, 1.3856, 0.0903, -1.2, 0.6928, 0.1935, 0, 0, 0.1935, -0.4, 0, 0.1935, -1.2, 0, 0.1935, -1.2, 0.6928, 0.1935, -1.6, 0.6928, 0.1935, 0, 0.6928, 0.1935, -1.6, 1.3856, 0.1935, -0.4, 0.6928, 0.1935, 0, 0.6928, 0.1935, -1.6, 1.3856, 0.1935, -1.2, 1.3856, 0.1935, -0.4, 0.6928, 0.1935, -1.6, 0.6928, 0.0903, -1.6, 1.3856, 0.0903, -1.2, 1.3856, 0.0903, -1.2, 1.3856, 0.1935, -1.2, 0.6928, 0.1935, -1.6, 1.3856, 0.0903, -0.8, 1.3856, 0.0903, -0.4, 1.3856, 0.1935, -0.4, 1.3856, 0.1935, -0.4, 1.3856, 0.1935, -1.2, 1.3856, 0.0903, -0.8, 1.3856, 0.1935, -1.2, 1.3856, 0.0903, -1.2, 1.3856, 0.0903, -0.8, 1.3856, 0.1935, -0.4, 1.3856, 0.0903, -0.4, 0.6928, 0.0903, 0, 0.6928, 0.0903, 0, 0.6928, 0.1935, 0, 1.3856, 0.1935, -0.4, 0.6928, 0.1935, 0, 0.6928, 0.0903, 0, 0, 0.0903, -0.4, 0, 0.0903, -0.4, 0, 0.1935, -0.4, 0.6928, 0.1935, 0, 0, 0.1935, -1.2, 0, 0.1935, -0.4, 0, 0.0903, -0.4, 0, 0.0903, -0.4, 0, 0.0903, -0.8, 0, 0.1935, -1.2, 0, 0.0903, -0.8, 0, 0.0903, -1.2, 0, 0.1935, -1.2, 0, 0.1935, -1.2, 0, 0.0903, -1.2, 0.6928, 0.0903, -1.6, 0.6928, 0.0903, -1.6, 0.6928, 0.1935, -1.6, 0, 0.1935, -1.2, 0.7728, 0.0903, -0.72, 0.7728, -0.4, -0.72, 0.6128, -0.4, -0.72, 0.6128, -0.4, -0.72, 0.6128, 0.0903, -0.72, 0.7728, 0.0903, -0.72, 0.6128, 0.0903, -0.88, 0.6128, 0.0903, -0.72, 0.6128, -0.4, -0.72, 0.6128, -0.4, -0.72, 0.6128, -0.4, -0.88, 0.6128, 0.0903, -0.88, 0.6128, 0.0903, -0.88, 0.6128, -0.4, -0.88, 0.7728, -0.4, -0.88, 0.7728, -0.4, -0.88, 0.7728, 0.0903, -0.88, 0.6128, 0.0903, -0.88, 0.7728, -0.4, -0.88, 0.7728, -0.4, -0.72, 0.7728, 0.0903, -0.72, 0.7728, 0.0903, -0.72, 0.7728, 0.0903, -0.88, 0.7728, -0.4, -0.88, 0.8128, -0.4, -0.68, 0.8128, -0.44, -0.68, 0.5728, -0.44, -0.68, 0.5728, -0.44, -0.68, 0.5728, -0.4, -0.68, 0.8128, -0.4, -0.68, 0.5728, -0.4, -0.92, 0.5728, -0.4, -0.68, 0.5728, -0.44, -0.68, 0.5728, -0.44, -0.68, 0.5728, -0.44, -0.92, 0.5728, -0.4, -0.92, 0.8128, -0.44, -0.92, 0.8128, -0.44, -0.68, 0.8128, -0.4, -0.68, 0.8128, -0.4, -0.68, 0.8128, -0.4, -0.92, 0.8128, -0.44, -0.92, 0.5728, -0.4, -0.68, 0.5728, -0.4, -0.92, 0.6128, -0.4, -0.72, 0.6128, -0.4, -0.72, 0.8128, -0.4, -0.68, 0.5728, -0.4, -0.68, 0.6128, -0.4, -0.72, 0.7728, -0.4, -0.72, 0.8128, -0.4, -0.68, 0.7728, -0.4, -0.72, 0.7728, -0.4, -0.88, 0.8128, -0.4, -0.68, 0.6128, -0.4, -0.88, 0.6128, -0.4, -0.72, 0.5728, -0.4, -0.92, 0.5728, -0.4, -0.92, 0.8128, -0.4, -0.92, 0.6128, -0.4, -0.88, 0.8128, -0.4, -0.92, 0.7728, -0.4, -0.88, 0.6128, -0.4, -0.88, 0.8128, -0.4, -0.92, 0.8128, -0.4, -0.68, 0.7728, -0.4, -0.88, 0.4928, -0.44, -1, 0.4928, -0.44, -0.6, 0.4928, -0.5, -0.6, 0.4928, -0.5, -0.6, 0.4928, -0.5, -1, 0.4928, -0.44, -1, 0.4928, -0.44, -1, 0.4928, -0.5, -1, 0.8928, -0.5, -1, 0.8928, -0.5, -1, 0.8928, -0.44, -1, 0.4928, -0.44, -1, 0.8928, -0.44, -0.6, 0.8928, -0.5, -0.6, 0.4928, -0.5, -0.6, 0.4928, -0.5, -0.6, 0.4928, -0.44, -0.6, 0.8928, -0.44, -0.6, 0.8928, -0.5, -1, 0.8928, -0.5, -0.6, 0.8928, -0.44, -0.6, 0.8928, -0.44, -0.6, 0.8928, -0.44, -1, 0.8928, -0.5, -1, 0.4928, -0.44, -0.6, 0.4928, -0.44, -1, 0.5728, -0.44, -0.68, 0.5728, -0.44, -0.68, 0.8928, -0.44, -0.6, 0.4928, -0.44, -0.6, 0.5728, -0.44, -0.68, 0.8128, -0.44, -0.68, 0.8928, -0.44, -0.6, 0.8128, -0.44, -0.68, 0.8128, -0.44, -0.92, 0.8928, -0.44, -0.6, 0.5728, -0.44, -0.92, 0.5728, -0.44, -0.68, 0.4928, -0.44, -1, 0.4928, -0.44, -1, 0.8928, -0.44, -1, 0.5728, -0.44, -0.92, 0.8928, -0.44, -1, 0.8128, -0.44, -0.92, 0.5728, -0.44, -0.92, 0.8928, -0.44, -1, 0.8928, -0.44, -0.6, 0.8128, -0.44, -0.92, 0.9128, -0.54, -1.02, 0.4728, -0.54, -1.02, 0.4728, -0.54, -0.58, 0.4728, -0.54, -0.58, 0.9128, -0.54, -0.58, 0.9128, -0.54, -1.02, 0.4928, -0.5, -1, 0.4728, -0.54, -1.02, 0.9128, -0.54, -1.02, 0.9128, -0.54, -1.02, 0.8928, -0.5, -1, 0.4928, -0.5, -1, 0.9128, -0.54, -1.02, 0.9128, -0.54, -0.58, 0.8928, -0.5, -0.6, 0.8928, -0.5, -0.6, 0.8928, -0.5, -1, 0.9128, -0.54, -1.02, 0.8928, -0.5, -0.6, 0.9128, -0.54, -0.58, 0.4728, -0.54, -0.58, 0.4728, -0.54, -0.58, 0.4928, -0.5, -0.6, 0.8928, -0.5, -0.6, 0.4928, -0.5, -0.6, 0.4728, -0.54, -0.58, 0.4728, -0.54, -1.02, 0.4728, -0.54, -1.02, 0.4928, -0.5, -1, 0.4928, -0.5, -0.6, 0.5728, -0.4, -0.92, 0.5728, -0.44, -0.92, 0.8128, -0.44, -0.92, 0.8128, -0.44, -0.92, 0.8128, -0.4, -0.92, 0.5728, -0.4, -0.92)

[sub_resource type="Resource" id="Resource_5iqlp"]
[sub_resource type="Resource" id="Resource_ovfr1"]
resource_local_to_scene = true
script = ExtResource("4_0kggm")
grid = true
Expand Down Expand Up @@ -3169,7 +3169,7 @@ material = SubResource("FogMaterial_4avjx")

[node name="Player" parent="." instance=ExtResource("3_mgle8")]
transform = Transform3D(-1, 0, 7.45058e-07, 0, 1, 0, -7.45058e-07, 0, -1, 3.03073, 0.905039, -17.9321)
inventory_data = SubResource("Resource_k3pmn")
inventory_data = SubResource("Resource_nbadd")
step_height_camera_lerp = 1.5

[node name="QUESTS" type="Node3D" parent="."]
Expand Down Expand Up @@ -6993,7 +6993,7 @@ shape = SubResource("ConcavePolygonShape3D_upcaa")

[node name="kitchenFridgeContainer2" parent="BREAK_ROOM" instance=ExtResource("57_fdyfl")]
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 3.65301, -4.84288e-08, 6.17191)
inventory_data = SubResource("Resource_5iqlp")
inventory_data = SubResource("Resource_ovfr1")

[node name="kitchenMicrowave2" parent="BREAK_ROOM" instance=ExtResource("61_1x4um")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 1.98491, 0.84, 6.39503)
Expand Down
4 changes: 2 additions & 2 deletions addons/cogito/DemoScenes/COGITO_4_Laboratory.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ volumetric_fog_ambient_inject = 0.1
volumetric_fog_sky_affect = 0.1
volumetric_fog_temporal_reprojection_amount = 0.85

[sub_resource type="Resource" id="Resource_utps2"]
[sub_resource type="Resource" id="Resource_cnpux"]
resource_local_to_scene = true
script = ExtResource("4_hlewe")
grid = true
Expand Down Expand Up @@ -901,7 +901,7 @@ environment = SubResource("Environment_obnk3")
[node name="Player" parent="." instance=ExtResource("2_7qwrr")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 5.13854, 0.8, -5.43073)
inventory_data = SubResource("Resource_utps2")
inventory_data = SubResource("Resource_cnpux")
[node name="CONNECTOR_TO_LOBBY" type="Node3D" parent="."]
Expand Down
21 changes: 20 additions & 1 deletion addons/cogito/EasyMenus/Scenes/PauseMenu.tscn
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
[gd_scene load_steps=10 format=3 uid="uid://dkie3md1cmsip"]
[gd_scene load_steps=13 format=3 uid="uid://dkie3md1cmsip"]

[ext_resource type="Theme" uid="uid://by44nnjeu6u4n" path="res://addons/cogito/Theme/Cogito_Theme_A.tres" id="1_1djt0"]
[ext_resource type="Script" path="res://addons/cogito/EasyMenus/Scripts/pause_menu_controller.gd" id="2_473pa"]
[ext_resource type="AudioStream" uid="uid://cr3bcp0u6w1pl" path="res://addons/cogito/Assets/Audio/Kenney/UiAudio/mouseclick1.ogg" id="3_cekij"]
[ext_resource type="AudioStream" uid="uid://kbw2s407quul" path="res://addons/cogito/Assets/Audio/Kenney/UiAudio/click1.ogg" id="4_ccwo8"]
[ext_resource type="Texture2D" uid="uid://tjkesqff2f4g" path="res://addons/cogito/Assets/Graphics/EmptySaveSlot.png" id="5_18sdt"]
[ext_resource type="Script" path="res://addons/cogito/Theme/CogitoUiButton.gd" id="6_a8sll"]
[ext_resource type="Shader" uid="uid://wn6mnfchf1w7" path="res://addons/cogito/Assets/Shader/BlurShader.tres" id="6_fg7i3"]
[ext_resource type="PackedScene" uid="uid://bly6wti1q8bsu" path="res://addons/cogito/EasyMenus/Scenes/OptionsTabMenu.tscn" id="6_xdpcn"]
[ext_resource type="Script" path="res://addons/cogito/Scripts/menu_scene_switcher.gd" id="12_4c47n"]

[sub_resource type="ShaderMaterial" id="ShaderMaterial_8kcia"]
shader = ExtResource("6_fg7i3")
shader_parameter/BlurStrength = 0.7

[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_gjw0g"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3a44o"]

[node name="PauseMenu" type="Control" node_paths=PackedStringArray("nodes_to_focus")]
process_mode = 3
z_index = 2
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
Expand All @@ -26,7 +34,18 @@ sound_hover = ExtResource("3_cekij")
sound_click = ExtResource("4_ccwo8")
empty_slot_texture = ExtResource("5_18sdt")

[node name="BlurBG" type="TextureRect" parent="."]
material = SubResource("ShaderMaterial_8kcia")
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("PlaceholderTexture2D_gjw0g")

[node name="Panel" type="Panel" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
Expand Down
Loading

0 comments on commit 1dbc98b

Please sign in to comment.