screen_shaders.tscn 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. [gd_scene load_steps=34 format=1]
  2. [ext_resource path="res://screen_shaders.gd" type="Script" id=1]
  3. [ext_resource path="res://art/burano.jpg" type="Texture" id=2]
  4. [ext_resource path="res://art/platformer.jpg" type="Texture" id=3]
  5. [ext_resource path="res://art/mountains.jpg" type="Texture" id=4]
  6. [ext_resource path="res://art/forest.jpg" type="Texture" id=5]
  7. [ext_resource path="res://art/vignette.png" type="Texture" id=6]
  8. [ext_resource path="res://art/white.png" type="Texture" id=7]
  9. [ext_resource path="res://art/filmgrain.png" type="Texture" id=8]
  10. [sub_resource type="CanvasItemShader" id=1]
  11. _code = { "fragment":"uniform texture vignette;\n\nCOLOR.rgb = texscreen(SCREEN_UV);\nCOLOR.rgb*= tex(vignette,UV).rgb;\n\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  12. [sub_resource type="CanvasItemMaterial" id=2]
  13. shader/shader = SubResource( 1 )
  14. shader/shading_mode = 0
  15. shader_param/vignette = ExtResource( 6 )
  16. [sub_resource type="CanvasItemShader" id=3]
  17. _code = { "fragment":"uniform texture vignette;\nfloat radius = 0.003;\nvec3 col = vec3(0);\n\ncol+= texscreen(SCREEN_UV+vec2(-radius,-radius));\ncol+= texscreen(SCREEN_UV+vec2(0,-radius));\ncol+= texscreen(SCREEN_UV+vec2(radius,-radius));\n\ncol+= texscreen(SCREEN_UV+vec2(-radius,0));\ncol+= texscreen(SCREEN_UV+vec2(0,0));\ncol+= texscreen(SCREEN_UV+vec2(radius,0));\n\n\ncol+= texscreen(SCREEN_UV+vec2(-radius,radius));\ncol+= texscreen(SCREEN_UV+vec2(0,radius));\ncol+= texscreen(SCREEN_UV+vec2(radius,radius));\n\ncol/=9.0;\nCOLOR.rgb=col;\n\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  18. [sub_resource type="CanvasItemMaterial" id=4]
  19. shader/shader = SubResource( 3 )
  20. shader/shading_mode = 0
  21. shader_param/vignette = ExtResource( 6 )
  22. [sub_resource type="CanvasItemShader" id=5]
  23. _code = { "fragment":"uniform texture vignette;\nuniform float radius=0.005;\nuniform float etching=2.0;\nuniform float edge_darken=0.5;\n\nfloat d = length(UV-vec2(0.5,0.5))*etching;\nmat2 rot = mat2( vec2(cos(d),-sin(d)), vec2(sin(d),cos(d)) );\n\nvec3 col = vec3(0);\n\ncol+= texscreen(SCREEN_UV+rot*vec2(-radius,-radius));\ncol+= texscreen(SCREEN_UV+rot*vec2(0,-radius));\ncol+= texscreen(SCREEN_UV+rot*vec2(radius,-radius));\n\ncol+= texscreen(SCREEN_UV+rot*vec2(-radius,0));\nvec3 scol = texscreen(SCREEN_UV+vec2(0,0));\ncol+= scol;\ncol+= texscreen(SCREEN_UV+rot*vec2(radius,0));\n\n\ncol+= texscreen(SCREEN_UV+rot*vec2(-radius,radius));\ncol+= texscreen(SCREEN_UV+rot*vec2(0,radius));\ncol+= texscreen(SCREEN_UV+vec2(radius,radius));\n\ncol/=9.0;\nfloat v = tex(vignette,UV).r;\nCOLOR.rgb=mix(col,scol,v)*mix(1.0,v,edge_darken);\n\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  24. [sub_resource type="CanvasItemMaterial" id=6]
  25. shader/shader = SubResource( 5 )
  26. shader/shading_mode = 0
  27. shader_param/vignette = ExtResource( 6 )
  28. shader_param/radius = 0.005
  29. shader_param/etching = 2.0
  30. shader_param/edge_darken = 0.5
  31. [sub_resource type="CanvasItemMaterial" id=7]
  32. shader/shader = SubResource( 5 )
  33. shader/shading_mode = 0
  34. shader_param/vignette = ExtResource( 6 )
  35. shader_param/radius = 0.02
  36. shader_param/etching = 100.0
  37. shader_param/edge_darken = -0.5
  38. [sub_resource type="CanvasItemShader" id=8]
  39. _code = { "fragment":"uniform float size_x=0.008;\nuniform float size_y=0.008;\n\nvec2 uv = SCREEN_UV;\nuv-=mod(uv,vec2(size_x,size_y));\n\nCOLOR.rgb= texscreen(uv);\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  40. [sub_resource type="CanvasItemMaterial" id=9]
  41. shader/shader = SubResource( 8 )
  42. shader/shading_mode = 0
  43. shader_param/size_x = 0.01
  44. shader_param/size_y = 0.01
  45. [sub_resource type="CanvasItemShader" id=10]
  46. _code = { "fragment":"uniform float rotation=3.0;\n\nvec2 uv = SCREEN_UV;\nvec2 rel = uv-vec2(0.5,0.5);\nfloat angle = length(rel)*rotation;\nmat2 rot = mat2(vec2(cos(angle),-sin(angle)),vec2(sin(angle),cos(angle)));\nrel = rot * rel;\nuv = clamp(rel + vec2(0.5,0.5),vec2(0,0),vec2(1,1));\nCOLOR.rgb= texscreen(uv);\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  47. [sub_resource type="CanvasItemMaterial" id=11]
  48. shader/shader = SubResource( 10 )
  49. shader/shading_mode = 0
  50. shader_param/rotation = 3.0
  51. [sub_resource type="CanvasItemShader" id=12]
  52. _code = { "fragment":"uniform color base=color(0.75,0.6,0.6,1.0);\nvec3 c = texscreen(SCREEN_UV);\n\n//float v = max(c.r,max(c.g,c.b));\nfloat v = dot(c,vec3(0.33333,0.33333,0.33333));\nv=sqrt(v);\n//v*=v;\nCOLOR.rgb= base.rgb*v;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  53. [sub_resource type="CanvasItemMaterial" id=13]
  54. shader/shader = SubResource( 12 )
  55. shader/shading_mode = 0
  56. shader_param/base = Color( 0.75, 0.566284, 0.6, 1 )
  57. [sub_resource type="CanvasItemShader" id=14]
  58. _code = { "fragment":"vec3 c = texscreen(SCREEN_UV);\nc=vec3(1.0)-c;\nCOLOR.rgb=c;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  59. [sub_resource type="CanvasItemMaterial" id=15]
  60. shader/shader = SubResource( 14 )
  61. shader/shading_mode = 0
  62. [sub_resource type="CanvasItemShader" id=16]
  63. _code = { "fragment":"vec3 c = texscreen(SCREEN_UV);\nc=mod(c+vec3(0.5),vec3(1.0));\nCOLOR.rgb=c;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  64. [sub_resource type="CanvasItemMaterial" id=17]
  65. shader/shader = SubResource( 16 )
  66. shader/shading_mode = 0
  67. [sub_resource type="CanvasItemShader" id=18]
  68. _code = { "fragment":"vec3 c = texscreen(SCREEN_UV);\nCOLOR.rgb=normalize(c);\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  69. [sub_resource type="CanvasItemMaterial" id=19]
  70. shader/shader = SubResource( 18 )
  71. shader/shading_mode = 0
  72. [sub_resource type="CanvasItemShader" id=20]
  73. _code = { "fragment":"uniform float brightness=0.8;\nuniform float contrast=1.5;\nuniform float saturation=1.8;\n\nvec3 c = texscreen(SCREEN_UV);\n\nc.rgb = mix(vec3(0.0),c.rgb,brightness);\nc.rgb = mix(vec3(0.5),c.rgb,contrast);\nc.rgb = mix(vec3(dot(vec3(1.0),c.rgb)*0.33333),c.rgb,saturation);\n\nCOLOR.rgb=c;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  74. [sub_resource type="CanvasItemMaterial" id=21]
  75. shader/shader = SubResource( 20 )
  76. shader/shading_mode = 0
  77. shader_param/brightness = 0.8
  78. shader_param/contrast = 1.5
  79. shader_param/saturation = 1.8
  80. [sub_resource type="CanvasItemShader" id=22]
  81. _code = { "fragment":"uniform float frequency=60;\nuniform float depth = 0.005;\n\nvec2 uv = SCREEN_UV;\nuv.x += sin(uv.y*frequency+TIME)*depth;\nuv.x = clamp(uv.x,0,1);\nvec3 c = texscreen(uv);\n\n\nCOLOR.rgb=c;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  82. [sub_resource type="CanvasItemMaterial" id=23]
  83. shader/shader = SubResource( 22 )
  84. shader/shading_mode = 0
  85. shader_param/frequency = 60.0
  86. shader_param/depth = 0.005
  87. [sub_resource type="CanvasItemShader" id=24]
  88. _code = { "fragment":"uniform color base=color(0.75,0.6,0.6,1.0);\nuniform texture grain;\nuniform float grain_strength=0.3;\nuniform texture vignette;\nuniform float fps=12;\nuniform float stretch = 0.5;\nuniform float flashing=0.01;\n\nvec3 c = texscreen(SCREEN_UV);\n\n//float v = max(c.r,max(c.g,c.b));\nfloat v = dot(c,vec3(0.33333,0.33333,0.33333));\nv=sqrt(v);\n//v*=v;\nfloat make_grain(float time) {\n\n\tvec2 ofs = vec2(sin(41*time*sin(time*123)),sin(27*time*sin(time*312)));\n\treturn tex(grain,(UV+mod(ofs,vec2(1,1)))*stretch).r;\n}\n\nfloat f = 1.0/fps;\nfloat g = make_grain(TIME-mod(TIME,f));\ng=max(g,make_grain(TIME-mod(TIME,f)+f)*0.5);\ng=max(g,make_grain(TIME-mod(TIME,f)+f*2.0)*0.25);\n\n\nCOLOR.rgb= base.rgb*v-vec3(g)*grain_strength;\nCOLOR.rgb*=tex(vignette,UV).r;\nfloat ft = TIME * 0.002;\nCOLOR.rgb+=vec3(sin(75*ft*sin(ft*123)))*flashing;\n", "fragment_ofs":0, "light":"", "light_ofs":0, "vertex":"", "vertex_ofs":0 }
  89. [sub_resource type="CanvasItemMaterial" id=25]
  90. shader/shader = SubResource( 24 )
  91. shader/shading_mode = 0
  92. shader_param/base = Color( 0.75, 0.566284, 0.6, 1 )
  93. shader_param/grain = ExtResource( 8 )
  94. shader_param/grain_strength = 0.3
  95. shader_param/vignette = ExtResource( 6 )
  96. shader_param/fps = 12.0
  97. shader_param/stretch = 0.5
  98. shader_param/flashing = 0.01
  99. [node name="Control" type="Control"]
  100. anchor/right = 1
  101. anchor/bottom = 1
  102. focus/ignore_mouse = false
  103. focus/stop_mouse = true
  104. size_flags/horizontal = 2
  105. size_flags/vertical = 2
  106. margin/left = 0.0
  107. margin/top = 0.0
  108. margin/right = 0.0
  109. margin/bottom = 0.0
  110. script/script = ExtResource( 1 )
  111. [node name="pictures" type="Control" parent="."]
  112. anchor/right = 1
  113. anchor/bottom = 1
  114. focus/ignore_mouse = false
  115. focus/stop_mouse = true
  116. size_flags/horizontal = 2
  117. size_flags/vertical = 2
  118. margin/left = 0.0
  119. margin/top = 0.0
  120. margin/right = 0.0
  121. margin/bottom = 0.0
  122. [node name="burano" type="TextureFrame" parent="pictures"]
  123. focus/ignore_mouse = true
  124. focus/stop_mouse = true
  125. size_flags/horizontal = 2
  126. size_flags/vertical = 2
  127. margin/left = 0.0
  128. margin/top = 0.0
  129. margin/right = 40.0
  130. margin/bottom = 40.0
  131. texture = ExtResource( 2 )
  132. [node name="roby" type="TextureFrame" parent="pictures"]
  133. visibility/visible = false
  134. focus/ignore_mouse = true
  135. focus/stop_mouse = true
  136. size_flags/horizontal = 2
  137. size_flags/vertical = 2
  138. margin/left = 0.0
  139. margin/top = 0.0
  140. margin/right = 40.0
  141. margin/bottom = 40.0
  142. texture = ExtResource( 3 )
  143. [node name="mountains" type="TextureFrame" parent="pictures"]
  144. visibility/visible = false
  145. focus/ignore_mouse = true
  146. focus/stop_mouse = true
  147. size_flags/horizontal = 2
  148. size_flags/vertical = 2
  149. margin/left = 0.0
  150. margin/top = 0.0
  151. margin/right = 40.0
  152. margin/bottom = 40.0
  153. texture = ExtResource( 4 )
  154. [node name="forest" type="TextureFrame" parent="pictures"]
  155. visibility/visible = false
  156. focus/ignore_mouse = true
  157. focus/stop_mouse = true
  158. size_flags/horizontal = 2
  159. size_flags/vertical = 2
  160. margin/left = 0.0
  161. margin/top = 0.0
  162. margin/right = 40.0
  163. margin/bottom = 40.0
  164. texture = ExtResource( 5 )
  165. [node name="effects" type="Control" parent="."]
  166. anchor/right = 1
  167. anchor/bottom = 1
  168. focus/ignore_mouse = false
  169. focus/stop_mouse = true
  170. size_flags/horizontal = 2
  171. size_flags/vertical = 2
  172. margin/left = 0.0
  173. margin/top = 0.0
  174. margin/right = -20.0
  175. margin/bottom = 0.0
  176. [node name="disabled" type="Control" parent="effects"]
  177. focus/ignore_mouse = false
  178. focus/stop_mouse = true
  179. size_flags/horizontal = 2
  180. size_flags/vertical = 2
  181. margin/left = 0.0
  182. margin/top = 0.0
  183. margin/right = 40.0
  184. margin/bottom = 40.0
  185. [node name="vignette" type="TextureFrame" parent="effects"]
  186. visibility/visible = false
  187. material/material = SubResource( 2 )
  188. anchor/right = 1
  189. anchor/bottom = 1
  190. focus/ignore_mouse = true
  191. focus/stop_mouse = true
  192. size_flags/horizontal = 2
  193. size_flags/vertical = 2
  194. margin/left = 0.0
  195. margin/top = 0.0
  196. margin/right = 0.0
  197. margin/bottom = 0.0
  198. texture = ExtResource( 7 )
  199. expand = true
  200. [node name="blur" type="TextureFrame" parent="effects"]
  201. visibility/visible = false
  202. material/material = SubResource( 4 )
  203. anchor/right = 1
  204. anchor/bottom = 1
  205. focus/ignore_mouse = true
  206. focus/stop_mouse = true
  207. size_flags/horizontal = 2
  208. size_flags/vertical = 2
  209. margin/left = 0.0
  210. margin/top = 0.0
  211. margin/right = 0.0
  212. margin/bottom = 0.0
  213. texture = ExtResource( 7 )
  214. expand = true
  215. [node name="radial_blur" type="TextureFrame" parent="effects"]
  216. visibility/visible = false
  217. material/material = SubResource( 6 )
  218. anchor/right = 1
  219. anchor/bottom = 1
  220. focus/ignore_mouse = true
  221. focus/stop_mouse = true
  222. size_flags/horizontal = 2
  223. size_flags/vertical = 2
  224. margin/left = -1.0
  225. margin/top = 0.0
  226. margin/right = 1.0
  227. margin/bottom = 0.0
  228. texture = ExtResource( 7 )
  229. expand = true
  230. [node name="radial_etch" type="TextureFrame" parent="effects"]
  231. visibility/visible = false
  232. material/material = SubResource( 7 )
  233. anchor/right = 1
  234. anchor/bottom = 1
  235. focus/ignore_mouse = true
  236. focus/stop_mouse = true
  237. size_flags/horizontal = 2
  238. size_flags/vertical = 2
  239. margin/left = -1.0
  240. margin/top = 0.0
  241. margin/right = 1.0
  242. margin/bottom = 0.0
  243. texture = ExtResource( 7 )
  244. expand = true
  245. [node name="pixelize" type="TextureFrame" parent="effects"]
  246. visibility/visible = false
  247. material/material = SubResource( 9 )
  248. anchor/right = 1
  249. anchor/bottom = 1
  250. focus/ignore_mouse = true
  251. focus/stop_mouse = true
  252. size_flags/horizontal = 2
  253. size_flags/vertical = 2
  254. margin/left = 0.0
  255. margin/top = 0.0
  256. margin/right = 0.0
  257. margin/bottom = 0.0
  258. texture = ExtResource( 7 )
  259. expand = true
  260. [node name="whirl" type="TextureFrame" parent="effects"]
  261. visibility/visible = false
  262. material/material = SubResource( 11 )
  263. anchor/right = 1
  264. anchor/bottom = 1
  265. focus/ignore_mouse = true
  266. focus/stop_mouse = true
  267. size_flags/horizontal = 2
  268. size_flags/vertical = 2
  269. margin/left = 0.0
  270. margin/top = 0.0
  271. margin/right = 0.0
  272. margin/bottom = 0.0
  273. texture = ExtResource( 7 )
  274. expand = true
  275. [node name="sepia" type="TextureFrame" parent="effects"]
  276. visibility/visible = false
  277. material/material = SubResource( 13 )
  278. anchor/right = 1
  279. anchor/bottom = 1
  280. focus/ignore_mouse = true
  281. focus/stop_mouse = true
  282. size_flags/horizontal = 2
  283. size_flags/vertical = 2
  284. margin/left = 0.0
  285. margin/top = 0.0
  286. margin/right = 0.0
  287. margin/bottom = 0.0
  288. texture = ExtResource( 7 )
  289. expand = true
  290. [node name="negative" type="TextureFrame" parent="effects"]
  291. visibility/visible = false
  292. material/material = SubResource( 15 )
  293. anchor/right = 1
  294. anchor/bottom = 1
  295. focus/ignore_mouse = true
  296. focus/stop_mouse = true
  297. size_flags/horizontal = 2
  298. size_flags/vertical = 2
  299. margin/left = 0.0
  300. margin/top = 0.0
  301. margin/right = 0.0
  302. margin/bottom = 0.0
  303. texture = ExtResource( 7 )
  304. expand = true
  305. [node name="contrasted" type="TextureFrame" parent="effects"]
  306. visibility/visible = false
  307. material/material = SubResource( 17 )
  308. anchor/right = 1
  309. anchor/bottom = 1
  310. focus/ignore_mouse = true
  311. focus/stop_mouse = true
  312. size_flags/horizontal = 2
  313. size_flags/vertical = 2
  314. margin/left = 0.0
  315. margin/top = 0.0
  316. margin/right = 0.0
  317. margin/bottom = 0.0
  318. texture = ExtResource( 7 )
  319. expand = true
  320. [node name="normalized" type="TextureFrame" parent="effects"]
  321. visibility/visible = false
  322. material/material = SubResource( 19 )
  323. anchor/right = 1
  324. anchor/bottom = 1
  325. focus/ignore_mouse = true
  326. focus/stop_mouse = true
  327. size_flags/horizontal = 2
  328. size_flags/vertical = 2
  329. margin/left = 0.0
  330. margin/top = 0.0
  331. margin/right = 0.0
  332. margin/bottom = 0.0
  333. texture = ExtResource( 7 )
  334. expand = true
  335. [node name="BCS" type="TextureFrame" parent="effects"]
  336. visibility/visible = false
  337. material/material = SubResource( 21 )
  338. anchor/right = 1
  339. anchor/bottom = 1
  340. focus/ignore_mouse = true
  341. focus/stop_mouse = true
  342. size_flags/horizontal = 2
  343. size_flags/vertical = 2
  344. margin/left = 0.0
  345. margin/top = 3.0
  346. margin/right = 0.0
  347. margin/bottom = -3.0
  348. texture = ExtResource( 7 )
  349. expand = true
  350. [node name="mirage" type="TextureFrame" parent="effects"]
  351. visibility/visible = false
  352. material/material = SubResource( 23 )
  353. anchor/right = 1
  354. anchor/bottom = 1
  355. focus/ignore_mouse = true
  356. focus/stop_mouse = true
  357. size_flags/horizontal = 2
  358. size_flags/vertical = 2
  359. margin/left = 0.0
  360. margin/top = 0.0
  361. margin/right = 0.0
  362. margin/bottom = 0.0
  363. texture = ExtResource( 7 )
  364. expand = true
  365. [node name="old_film" type="TextureFrame" parent="effects"]
  366. visibility/visible = false
  367. material/material = SubResource( 25 )
  368. anchor/right = 1
  369. anchor/bottom = 1
  370. focus/ignore_mouse = true
  371. focus/stop_mouse = true
  372. size_flags/horizontal = 2
  373. size_flags/vertical = 2
  374. margin/left = -3.0
  375. margin/top = 0.0
  376. margin/right = 3.0
  377. margin/bottom = 0.0
  378. texture = ExtResource( 7 )
  379. expand = true
  380. [node name="picture" type="OptionButton" parent="."]
  381. visibility/opacity = 0.8
  382. focus/ignore_mouse = false
  383. focus/stop_mouse = true
  384. size_flags/horizontal = 2
  385. size_flags/vertical = 2
  386. margin/left = 8.0
  387. margin/top = 7.0
  388. margin/right = 131.0
  389. margin/bottom = 28.0
  390. toggle_mode = false
  391. flat = false
  392. align = 0
  393. selected = -1
  394. items = [ ]
  395. [node name="effect" type="OptionButton" parent="."]
  396. visibility/opacity = 0.8
  397. focus/ignore_mouse = false
  398. focus/stop_mouse = true
  399. size_flags/horizontal = 2
  400. size_flags/vertical = 2
  401. margin/left = 137.0
  402. margin/top = 7.0
  403. margin/right = 260.0
  404. margin/bottom = 28.0
  405. toggle_mode = false
  406. flat = false
  407. align = 0
  408. selected = -1
  409. items = [ ]
  410. [connection signal="item_selected" from="picture" to="." method="_on_picture_item_selected"]
  411. [connection signal="item_selected" from="effect" to="." method="_on_effect_item_selected"]