meat_madness_redux/godot/effects/grainy_shader.tres

57 lines
1.2 KiB
Plaintext

[gd_resource type="ShaderMaterial" load_steps=2 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;
}"
[resource]
shader = SubResource( 1 )
shader_param/seed = 81.0
shader_param/power = 0.0022
shader_param/speed = 0.1
shader_param/amount = 0.06