mirror of
https://github.com/Steffo99/nanogolf.git
synced 2024-11-23 08:34:20 +00:00
Experiment with creating a glow shader
This commit is contained in:
parent
63731c18a3
commit
ba882ab8d4
2 changed files with 36 additions and 1 deletions
23
main.tscn
23
main.tscn
|
@ -1,3 +1,24 @@
|
|||
[gd_scene format=3 uid="uid://b8f5t76nfdu5h"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b8f5t76nfdu5h"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bxyy3bwt7a5l2" path="res://sprites/circle.svg" id="1_70edj"]
|
||||
[ext_resource type="Shader" path="res://shaders/postprocess.gdshader" id="1_gpsy1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvr4j6164rphg" path="res://sprites/square.svg" id="2_xiv3x"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_rnibu"]
|
||||
shader = ExtResource("1_gpsy1")
|
||||
shader_parameter/radius = 16
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
|
||||
[node name="Circle" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 1, 1, 0.498039)
|
||||
texture_filter = 2
|
||||
position = Vector2(68, 44)
|
||||
texture = ExtResource("1_70edj")
|
||||
|
||||
[node name="Square" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_rnibu")
|
||||
scale = Vector2(72, 40)
|
||||
texture = ExtResource("2_xiv3x")
|
||||
centered = false
|
||||
metadata/_edit_lock_ = true
|
||||
|
|
14
shaders/postprocess.gdshader
Normal file
14
shaders/postprocess.gdshader
Normal file
|
@ -0,0 +1,14 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen: hint_screen_texture, repeat_disable, filter_nearest;
|
||||
uniform int radius = 16;
|
||||
|
||||
void fragment() {
|
||||
float u = SCREEN_UV.x;
|
||||
float v = SCREEN_UV.y;
|
||||
|
||||
COLOR.rgb = texture(screen, vec2(u, v)).rgb;
|
||||
|
||||
// This is affected by editor zoom!
|
||||
COLOR.r += texture(screen, vec2(u + (SCREEN_PIXEL_SIZE.x * 4.0), v + (SCREEN_PIXEL_SIZE.y * 4.0))).r;
|
||||
}
|
Loading…
Reference in a new issue