summaryrefslogtreecommitdiff
path: root/godot3/ShaderTestScreen.tscn
diff options
context:
space:
mode:
authorMohabMohamed <mohab.m.mohamed@gmail.com>2018-03-07 15:41:02 +0200
committerMohabMohamed <mohab.m.mohamed@gmail.com>2018-03-07 15:41:02 +0200
commit9271ac7da04b06770024edb9a2038cc687933278 (patch)
tree51c9802e58b64e49fdb9fc1ca914a0a5ac99cd06 /godot3/ShaderTestScreen.tscn
parent3770cfa4cc36325be244f34c174db7c38f6c4872 (diff)
downloadplugin-godot-simple-crt-shader-9271ac7da04b06770024edb9a2038cc687933278.tar.gz
plugin-godot-simple-crt-shader-9271ac7da04b06770024edb9a2038cc687933278.tar.bz2
plugin-godot-simple-crt-shader-9271ac7da04b06770024edb9a2038cc687933278.zip
scanline in godot3
Diffstat (limited to 'godot3/ShaderTestScreen.tscn')
-rw-r--r--godot3/ShaderTestScreen.tscn77
1 files changed, 75 insertions, 2 deletions
diff --git a/godot3/ShaderTestScreen.tscn b/godot3/ShaderTestScreen.tscn
index 2cbbb1a..e6d22fa 100644
--- a/godot3/ShaderTestScreen.tscn
+++ b/godot3/ShaderTestScreen.tscn
@@ -1,7 +1,8 @@
-[gd_scene load_steps=7 format=2]
+[gd_scene load_steps=10 format=2]
[ext_resource path="res://sample.png" type="Texture" id=1]
[ext_resource path="res://white.png" type="Texture" id=2]
+[ext_resource path="res://CRTFrame.png" type="Texture" id=3]
[sub_resource type="Shader" id=1]
@@ -47,7 +48,7 @@ COLOR = texture(SCREEN_TEXTURE,xy);
render_priority = 0
shader = SubResource( 1 )
shader_param/BarrelPower = 1.1
-_sections_unfolded = [ "shader_param" ]
+_sections_unfolded = [ "Resource", "shader_param" ]
[sub_resource type="Shader" id=3]
@@ -74,6 +75,38 @@ shader_param/color_bleeding = null
shader_param/bleeding_range = null
shader_param/screen_width = null
+[sub_resource type="Shader" id=5]
+
+code = "shader_type canvas_item;
+
+uniform float lines_distance = 4.0;
+uniform float pixel_size = 2.0;
+uniform float size_screen = 600;
+uniform float scanline_alpha = 0.9;
+uniform float lines_velocity = 30.0;
+
+void fragment()
+{
+ float line_row = floor((SCREEN_UV.y * size_screen/pixel_size) + mod(TIME*lines_velocity, lines_distance));
+
+ float n = 1.0 - ceil((mod(line_row,lines_distance)/lines_distance));
+
+vec4 c = texture(SCREEN_TEXTURE,SCREEN_UV);
+c = c - n*c*(1.0 - scanline_alpha);
+c.a = 1.0;
+COLOR = c;
+}"
+
+[sub_resource type="ShaderMaterial" id=6]
+
+render_priority = 0
+shader = SubResource( 5 )
+shader_param/lines_distance = null
+shader_param/pixel_size = null
+shader_param/size_screen = null
+shader_param/scanline_alpha = null
+shader_param/lines_velocity = null
+
[node name="Control" type="Control" index="0"]
anchor_left = 0.0
@@ -133,6 +166,7 @@ _sections_unfolded = [ "Material", "Mouse", "Rect" ]
[node name="ColorBleeding" type="TextureRect" parent="Shaders" index="1"]
+visible = false
material = SubResource( 4 )
anchor_left = 0.0
anchor_top = 0.0
@@ -151,4 +185,43 @@ expand = true
stretch_mode = 0
_sections_unfolded = [ "Material", "Rect" ]
+[node name="ScanLine" type="TextureRect" parent="Shaders" index="2"]
+
+material = SubResource( 6 )
+anchor_left = 0.0
+anchor_top = 0.0
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 1024.0
+margin_bottom = 600.0
+rect_pivot_offset = Vector2( 0, 0 )
+rect_clip_content = false
+mouse_filter = 1
+mouse_default_cursor_shape = 0
+size_flags_horizontal = 1
+size_flags_vertical = 1
+texture = ExtResource( 2 )
+expand = true
+stretch_mode = 0
+_sections_unfolded = [ "Material", "Rect" ]
+
+[node name="CRTFrame" type="TextureRect" parent="." index="2"]
+
+anchor_left = 0.0
+anchor_top = 0.0
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 1082.0
+margin_bottom = 812.0
+rect_scale = Vector2( 0.946396, 0.738916 )
+rect_pivot_offset = Vector2( 0, 0 )
+rect_clip_content = false
+mouse_filter = 1
+mouse_default_cursor_shape = 0
+size_flags_horizontal = 1
+size_flags_vertical = 1
+texture = ExtResource( 3 )
+stretch_mode = 0
+_sections_unfolded = [ "Rect" ]
+