Skip to content

Commit

Permalink
Fix black blur background
Browse files Browse the repository at this point in the history
  • Loading branch information
rsubtil committed Aug 4, 2023
1 parent fba974d commit 806b0ee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ jobs:

- name: "Setup rcedit"
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install wine-stable
wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe
cached_builds/editor/godot --headless --quit
Expand Down
15 changes: 15 additions & 0 deletions resources/shaders/MenuBlur.gdshader
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Source: https://kidscancode.org/godot_recipes/shaders/blur/

shader_type canvas_item;

// FIXME: blur_amount and modulate have to be hardcoded; the shader parameters
// are not being used on exported projects from the editor
// So far this hasn't been replicated on vanilla Godot, but it's likely
// an engine bug. Investigate later
uniform float blur_amount : hint_range(0, 5) = 1;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform vec4 modulate : source_color = vec4(0.749, 0.749, 0.749, 1.0);

void fragment() {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur_amount) * modulate;
}
16 changes: 2 additions & 14 deletions scenes/root/Root.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,14 @@
[ext_resource type="PackedScene" uid="uid://cjx4cfx0f2k2" path="res://scenes/config/ConfigPopup.tscn" id="3"]
[ext_resource type="Script" path="res://scenes/root/Viewport.gd" id="4"]
[ext_resource type="Theme" uid="uid://jtuqhw3am1h3" path="res://resources/default_theme.tres" id="5"]
[ext_resource type="Shader" path="res://resources/shaders/MenuBlur.gdshader" id="5_co422"]
[ext_resource type="Script" path="res://scenes/root/FileSystemPopup.gd" id="6"]
[ext_resource type="Script" path="res://addons/godot-accessibility/ScreenReader.gd" id="7"]
[ext_resource type="Script" path="res://source/utils/InputHandler.gd" id="9_5ltce"]
[ext_resource type="PackedScene" uid="uid://dmcmcyq0jach5" path="res://scenes/no_theme/NoTheme.tscn" id="10"]

[sub_resource type="Shader" id="1"]
code = "// Source: https://kidscancode.org/godot_recipes/shaders/blur/

shader_type canvas_item;

uniform float blur_amount : hint_range(0, 5);
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform vec4 modulate : source_color;

void fragment() {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur_amount) * modulate;
}"

[sub_resource type="ShaderMaterial" id="2"]
shader = SubResource("1")
shader = ExtResource("5_co422")
shader_parameter/blur_amount = 1.0
shader_parameter/modulate = Color(0.74902, 0.74902, 0.74902, 1)

Expand Down

0 comments on commit 806b0ee

Please sign in to comment.