28 lines
759 B
Plaintext
28 lines
759 B
Plaintext
/*
|
|
放射状ブラーエフェクト by あるる(きのもと 結衣) @arlez80
|
|
Radial Blur Effect by Yui Kinomoto
|
|
|
|
MIT License
|
|
*/
|
|
|
|
shader_type canvas_item;
|
|
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
|
|
|
|
// 発射中央部
|
|
uniform vec2 blur_center = vec2( 0.5, 0.5 );
|
|
// ブラー強度
|
|
uniform float blur_power : hint_range( 0.0, 1.0 ) = 0.01;
|
|
// サンプリング回数
|
|
uniform int sampling_count : hint_range( 1, 64 ) = 2;
|
|
|
|
void fragment( )
|
|
{
|
|
vec2 direction = SCREEN_UV - blur_center;
|
|
vec3 c = vec3( 0.0, 0.0, 0.0 );
|
|
float f = 1.0 / float( sampling_count );
|
|
for( int i=0; i < sampling_count; i++ ) {
|
|
c += texture( SCREEN_TEXTURE, SCREEN_UV - blur_power * direction * float(i) ).rgb * f;
|
|
}
|
|
COLOR.rgb = c;
|
|
}
|