summaryrefslogtreecommitdiff
path: root/demos/2d/sprite_shaders/sprite_shaders.tscn
blob: feb60038905b1607110977827a59d0743969c565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[gd_scene load_steps=20 format=1]

[ext_resource path="res://cubio.png" type="Texture" id=1]

[sub_resource type="CanvasItemShader" id=1]

_code = { "fragment":"uniform float outline_width=2.0;\nuniform color outline_color=vec4(0,0,0,1);\n\nvec4 col = tex(TEXTURE,UV);\nvec2 ps = TEXTURE_PIXEL_SIZE;\nfloat a;\nfloat maxa=col.a;\nfloat mina=col.a;\na=tex(TEXTURE,UV+vec2(0,-outline_width)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(0,outline_width)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(-outline_width,0)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(outline_width,0)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\n\nCOLOR=mix(col,outline_color,maxa-mina);", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=2]

shader/shader = SubResource( 1 )
shader/shading_mode = 0
shader_param/outline_width = 2.0
shader_param/outline_color = Color( 0, 0, 0, 1 )

[sub_resource type="CanvasItemShader" id=3]

_code = { "fragment":"//this shader only works properly with premultiplied alpha blend mode\nuniform float aura_width=2.0;\nuniform color aura_color=vec4(0.4,0.7,0.3,1);\n\nvec4 col = tex(TEXTURE,UV);\nvec2 ps = TEXTURE_PIXEL_SIZE;\nfloat a;\nfloat maxa=col.a;\nfloat mina=col.a;\na=tex(TEXTURE,UV+vec2(0,-aura_width)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(0,aura_width)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(-aura_width,0)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\na=tex(TEXTURE,UV+vec2(aura_width,0)*ps).a;\nmaxa=max(a,maxa); \nmina=min(a,mina);\ncol.rgb*=col.a;\nCOLOR=col;//mix(col,aura_color,maxa-mina);\nfloat auraa=(maxa-mina);\n\nCOLOR.rgb+=aura_color.rgb*(maxa-mina);", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=4]

shader/shader = SubResource( 3 )
shader/shading_mode = 0
shader_param/aura_width = 2.0
shader_param/aura_color = Color( 0.4, 0.7, 0.3, 1 )

[sub_resource type="CanvasItemShader" id=5]

_code = { "fragment":"uniform float radius=2.0;\n\nvec4 col = tex(TEXTURE,UV);\nvec2 ps = TEXTURE_PIXEL_SIZE;\ncol+=tex(TEXTURE,UV+vec2(0,-radius)*ps);\ncol+=tex(TEXTURE,UV+vec2(0,radius)*ps);\ncol+=tex(TEXTURE,UV+vec2(-radius,0)*ps);\ncol+=tex(TEXTURE,UV+vec2(radius,0)*ps);\ncol/=5.0;\nCOLOR=col;", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=6]

shader/shader = SubResource( 5 )
shader/shading_mode = 0
shader_param/radius = 4.0

[sub_resource type="CanvasItemShader" id=7]

_code = { "fragment":"uniform float fattyness=2.0;\n\nvec2 ruv=(UV-vec2(0.5,0.5));\nfloat len = length(ruv);\nvec2 dir = normalize(ruv);\nlen=pow(len*2.0,fattyness)*0.5;\nruv=len*dir;\nvec4 col = tex(TEXTURE,ruv+vec2(0.5,0.5));\nCOLOR=col;", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=8]

shader/shader = SubResource( 7 )
shader/shading_mode = 0
shader_param/fattyness = 2.0

[sub_resource type="CanvasItemShader" id=9]

_code = { "fragment":"\nuniform float radius=5.0;\nuniform color modulate=color(0,0,0,0.7);\n\nvec2 ps = TEXTURE_PIXEL_SIZE;\n\nvec4 shadow = tex(TEXTURE,UV+vec2(-radius,-radius)*ps);\nshadow += tex(TEXTURE,UV+vec2(-radius,0)*ps);\nshadow += tex(TEXTURE,UV+vec2(-radius,radius)*ps);\nshadow += tex(TEXTURE,UV+vec2(0,-radius)*ps);\nshadow += tex(TEXTURE,UV+vec2(0,radius)*ps);\nshadow += tex(TEXTURE,UV+vec2(radius,-radius)*ps);\nshadow += tex(TEXTURE,UV+vec2(radius,0)*ps);\nshadow += tex(TEXTURE,UV+vec2(radius,radius)*ps);\nshadow/=8;\nshadow*=modulate;\n\nvec4 col = tex(TEXTURE,UV);\nCOLOR=mix(shadow,col,col.a);", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=10]

shader/shader = SubResource( 9 )
shader/shading_mode = 0
shader_param/radius = 5.0
shader_param/modulate = Color( 0, 0, 0, 0.7 )

[sub_resource type="CanvasItemShader" id=11]

_code = { "fragment":"\nuniform vec2 offset=vec2(8,8);\nuniform color modulate=color(0.5,0,0.1,0.5);\n\nvec2 ps = TEXTURE_PIXEL_SIZE;\n\nvec4 shadow = vec4(modulate.rgb,tex(TEXTURE,UV-offset*ps).a*modulate.a);\nvec4 col = tex(TEXTURE,UV);\n\nCOLOR=mix(shadow,col,col.a);", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=12]

shader/shader = SubResource( 11 )
shader/shading_mode = 0
shader_param/offset = Vector2( 8, 8 )
shader_param/modulate = Color( 0.5, 0, 0.1, 0.5 )

[sub_resource type="CanvasItemShader" id=13]

_code = { "fragment":"\nuniform color modulate=color(0.2,0.4,1.0,0.8);\nCOLOR = vec4(modulate.rgb,tex(TEXTURE,UV).a*modulate.a);\n\n\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=14]

shader/shader = SubResource( 13 )
shader/shading_mode = 0
shader_param/modulate = Color( 0.013125, 0.194829, 0.406815, 0.818237 )

[sub_resource type="CanvasItemShader" id=15]

_code = { "fragment":"\nuniform float radius=2.0;\nuniform float amount=0.6;\nfloat r = radius;\nvec2 ps = TEXTURE_PIXEL_SIZE;\n\nvec4 col = tex(TEXTURE,UV);\n\nvec4 glow = col;\nglow += tex(TEXTURE,UV+vec2(-r,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(-r,0)*ps);\nglow += tex(TEXTURE,UV+vec2(-r,r)*ps);\nglow += tex(TEXTURE,UV+vec2(0,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(0,r)*ps);\nglow += tex(TEXTURE,UV+vec2(r,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(r,0)*ps);\nglow += tex(TEXTURE,UV+vec2(r,r)*ps);\nr*=2.0;\nglow += tex(TEXTURE,UV+vec2(-r,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(-r,0)*ps);\nglow += tex(TEXTURE,UV+vec2(-r,r)*ps);\nglow += tex(TEXTURE,UV+vec2(0,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(0,r)*ps);\nglow += tex(TEXTURE,UV+vec2(r,-r)*ps);\nglow += tex(TEXTURE,UV+vec2(r,0)*ps);\nglow += tex(TEXTURE,UV+vec2(r,r)*ps);\n\nglow/=17.0;\nglow*=amount;\ncol.rgb*=col.a;\nCOLOR=glow+col;", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=16]

shader/shader = SubResource( 15 )
shader/shading_mode = 0
shader_param/radius = 2.0
shader_param/amount = 0.5

[sub_resource type="CanvasItemShader" id=17]

_code = { "fragment":"\nuniform float amount = 20;\nvec2 uv = UV*0.05;\nfloat a = fract(sin(dot(UV ,vec2(12.9898,78.233))) * 438.5453);\nvec4 col = tex(TEXTURE,UV);\ncol.a*=pow(a,amount);\nCOLOR = col;\n\n\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }

[sub_resource type="CanvasItemMaterial" id=18]

shader/shader = SubResource( 17 )
shader/shading_mode = 0
shader_param/amount = 2.0

[node name="shaders" type="Node2D"]

[node name="normal" type="Sprite" parent="."]

transform/pos = Vector2( 95.4559, 131.272 )
texture = ExtResource( 1 )

[node name="outline" type="Sprite" parent="."]

material/material = SubResource( 2 )
transform/pos = Vector2( 246.456, 128.272 )
texture = ExtResource( 1 )

[node name="aura" type="Sprite" parent="."]

visibility/blend_mode = 4
material/material = SubResource( 4 )
transform/pos = Vector2( 398.185, 130.624 )
texture = ExtResource( 1 )

[node name="blur" type="Sprite" parent="."]

material/material = SubResource( 6 )
transform/pos = Vector2( 548.503, 123.04 )
texture = ExtResource( 1 )

[node name="fatty" type="Sprite" parent="."]

material/material = SubResource( 8 )
transform/pos = Vector2( 696.518, 125.393 )
texture = ExtResource( 1 )

[node name="dropshadow" type="Sprite" parent="."]

material/material = SubResource( 10 )
transform/pos = Vector2( 97.4079, 389.709 )
texture = ExtResource( 1 )

[node name="offsetshadow" type="Sprite" parent="."]

material/material = SubResource( 12 )
transform/pos = Vector2( 254.821, 384.238 )
texture = ExtResource( 1 )

[node name="silouette" type="Sprite" parent="."]

material/material = SubResource( 14 )
transform/pos = Vector2( 418.854, 387.184 )
texture = ExtResource( 1 )

[node name="glow" type="Sprite" parent="."]

visibility/blend_mode = 4
material/material = SubResource( 16 )
transform/pos = Vector2( 563.75, 385.42 )
texture = ExtResource( 1 )

[node name="dissintegrate" type="Sprite" parent="."]

material/material = SubResource( 18 )
transform/pos = Vector2( 708.613, 385.444 )
texture = ExtResource( 1 )