|  |  |  | shader_type canvas_item; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float shift_strength : hint_range(0.0, 1.0); | 
					
						
							|  |  |  | uniform float blur_strength : hint_range(0.0, 1.0); | 
					
						
							|  |  |  | uniform float speed_line_strength : hint_range(0.0, 1.0); | 
					
						
							|  |  |  | uniform float vignette_alpha : hint_range(0.0, 1.0); | 
					
						
							|  |  |  | uniform float vignette_inner : hint_range(0.0, 1.0) = 0.5; | 
					
						
							|  |  |  | uniform float vignette_outer : hint_range(0.0, 2.0) = 1.0; | 
					
						
							|  |  |  | uniform sampler2D speed_line_tex1; | 
					
						
							|  |  |  | uniform sampler2D speed_line_tex2; | 
					
						
							|  |  |  | uniform sampler2D speed_line_tex3; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void fragment() { | 
					
						
							|  |  |  | 	vec3 color = vec3(0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	//模糊+色移 | 
					
						
							|  |  |  | 	float shift = 0.01 * shift_strength; | 
					
						
							|  |  |  | 	float blur = 0.01 * blur_strength; | 
					
						
							|  |  |  | 	vec2 direction = UV - vec2(0.5); | 
					
						
							|  |  |  | 	float f = 0.1; | 
					
						
							|  |  |  | 	color *= f; | 
					
						
							|  |  |  | 	for(int i=1; i < 10; i++) { | 
					
						
							|  |  |  | 		vec2 target_uv = UV - blur * direction * float(i); | 
					
						
							|  |  |  | 		vec3 target_color = vec3(0); | 
					
						
							|  |  |  | 		target_color.r = texture(TEXTURE, vec2(target_uv.x + shift, target_uv.y)).r; | 
					
						
							|  |  |  | 		target_color.g = texture(TEXTURE, target_uv).g; | 
					
						
							|  |  |  | 		target_color.b = texture(TEXTURE, vec2(target_uv.x - shift, target_uv.y)).b; | 
					
						
							|  |  |  | 		color += target_color * f; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	//暗角 | 
					
						
							|  |  |  | 	float x = abs(UV.r-.5)*2.0; | 
					
						
							|  |  |  | 	float y = abs(UV.g-.5)*2.0; | 
					
						
							|  |  |  | 	float q = 1.0-(1.0-sqrt(x*x+y*y)/vignette_outer)/(1.0-vignette_inner); | 
					
						
							|  |  |  | 	q = clamp(q*vignette_alpha,0.0,1.1); | 
					
						
							|  |  |  | 	color *= (1.0-q); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	//速度线 | 
					
						
							|  |  |  | 	if(speed_line_strength>0.0){ | 
					
						
							|  |  |  | 		float speed_line_color = 0.0; | 
					
						
							|  |  |  | 		float select_value = mod(TIME/10.0, 3.0); | 
					
						
							|  |  |  | 		if(select_value<1.0){ | 
					
						
							|  |  |  | 			speed_line_color = texture(speed_line_tex1, UV).r; | 
					
						
							|  |  |  | 		}else if(select_value<2.0){ | 
					
						
							|  |  |  | 			speed_line_color = texture(speed_line_tex2, UV).r; | 
					
						
							|  |  |  | 		}else{ | 
					
						
							|  |  |  | 			speed_line_color = texture(speed_line_tex3, UV).r; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		speed_line_color *= speed_line_strength; | 
					
						
							|  |  |  | 		color *= (1.0-speed_line_color); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	COLOR.rgb = color; | 
					
						
							|  |  |  | } |