meat_madness_redux/godot/effects/shader.tscn

68 lines
1.4 KiB
Plaintext

[gd_scene load_steps=3 format=2]
[sub_resource type="Shader" id=1]
code = "/*
砂嵐エフェクト by あるる(きのもと 結衣)
Screen Noise Effect Shader by Yui Kinomoto @arlez80
MIT License
*/
shader_type canvas_item;
uniform float seed = 81.0;
uniform float power : hint_range( 0.0, 1.0 ) = 0.0022;
uniform float speed = 0.1;
vec2 random( vec2 pos )
{
return fract(
sin(
vec2(
dot(pos, vec2(12.9898,78.233))
, dot(pos, vec2(-148.998,-65.233))
)
) * 43758.5453
);
}
uniform float amount = 0.060;
void fragment( )
{
vec2 uv = SCREEN_UV + ( random( UV + vec2( seed - TIME * speed, TIME * speed ) ) - vec2( 0.5, 0.5 ) ) * power;
COLOR = textureLod( SCREEN_TEXTURE, uv, 0.0 );
vec2 buv = UV;
//buv.r = buv.r % 25.0
float factor = 200.0;
buv.r = round(buv.r * factor) / factor;
buv.g = round(buv.g * factor) / factor;
float a = fract(sin(dot(buv, vec2(12.9898, 78.233) * TIME)) * 438.5453) * 1.9;
a = a * amount;
COLOR.r -= a;
COLOR.g -= a;
COLOR.b -= a;
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/seed = 81.0
shader_param/power = 0.0022
shader_param/speed = 0.1
shader_param/amount = 0.06
[node name="shader" type="Spatial"]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 100
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
material = SubResource( 2 )
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2