summaryrefslogtreecommitdiff
path: root/godot3/ShaderTestScreen.tscn
diff options
context:
space:
mode:
authorMohabMohamed <mohab.m.mohamed@gmail.com>2018-03-06 23:56:15 +0200
committerMohabMohamed <mohab.m.mohamed@gmail.com>2018-03-06 23:56:15 +0200
commitc3e8c9bab4756919c4a270c87a7cbe15458ed282 (patch)
tree877e74f68f80d70195710eebe5f41e8bc1c49d9c /godot3/ShaderTestScreen.tscn
parentcd91412e7b538d867870b3c4b96bbddf22dc32eb (diff)
downloadplugin-godot-simple-crt-shader-c3e8c9bab4756919c4a270c87a7cbe15458ed282.tar.gz
plugin-godot-simple-crt-shader-c3e8c9bab4756919c4a270c87a7cbe15458ed282.tar.bz2
plugin-godot-simple-crt-shader-c3e8c9bab4756919c4a270c87a7cbe15458ed282.zip
Curvature done in godot 3
Diffstat (limited to 'godot3/ShaderTestScreen.tscn')
-rw-r--r--godot3/ShaderTestScreen.tscn109
1 files changed, 109 insertions, 0 deletions
diff --git a/godot3/ShaderTestScreen.tscn b/godot3/ShaderTestScreen.tscn
new file mode 100644
index 0000000..9355bce
--- /dev/null
+++ b/godot3/ShaderTestScreen.tscn
@@ -0,0 +1,109 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://sample.png" type="Texture" id=1]
+[ext_resource path="res://white.png" type="Texture" id=2]
+
+[sub_resource type="Shader" id=1]
+
+code = "shader_type canvas_item;
+
+uniform float BarrelPower =1.1;
+
+vec2 distort(vec2 p)
+{
+
+ float angle = p.y / p.x;
+ float theta = atan(p.y,p.x);
+ float radius = pow(length(p), BarrelPower);
+
+ p.x = radius * cos(theta);
+ p.y = radius * sin(theta);
+
+ return 0.5 * (p + vec2(1.0,1.0));
+}
+void fragment()
+{
+
+vec2 xy = SCREEN_UV * 2.0;
+xy.x -= 1.0;
+xy.y -= 1.0;
+
+float d = length(xy);
+if(d < 1.5){
+ xy = distort(xy);
+}
+else{
+ xy = SCREEN_UV;
+}
+COLOR = textureLod(SCREEN_TEXTURE,xy,0);
+}
+
+
+
+"
+
+[sub_resource type="ShaderMaterial" id=2]
+
+render_priority = 0
+shader = SubResource( 1 )
+shader_param/BarrelPower = 1.1
+_sections_unfolded = [ "shader_param" ]
+
+[node name="Control" type="Control" index="0"]
+
+anchor_left = 0.0
+anchor_top = 0.0
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 40.0
+margin_bottom = 40.0
+rect_pivot_offset = Vector2( 0, 0 )
+rect_clip_content = false
+mouse_filter = 0
+mouse_default_cursor_shape = 0
+size_flags_horizontal = 1
+size_flags_vertical = 1
+_sections_unfolded = [ "Rect" ]
+
+[node name="Sprite" type="Sprite" parent="." index="0"]
+
+texture = ExtResource( 1 )
+centered = false
+_sections_unfolded = [ "Offset" ]
+
+[node name="Shaders" type="Control" parent="." index="1"]
+
+anchor_left = 0.0
+anchor_top = 0.0
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 40.0
+margin_bottom = 40.0
+rect_pivot_offset = Vector2( 0, 0 )
+rect_clip_content = false
+mouse_filter = 0
+mouse_default_cursor_shape = 0
+size_flags_horizontal = 1
+size_flags_vertical = 1
+
+[node name="Curvature" type="TextureRect" parent="Shaders" index="0"]
+
+material = SubResource( 2 )
+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", "Mouse", "Rect" ]
+
+