| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  | shader_type canvas_item; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform sampler2D screenTexture: hint_screen_texture, repeat_disable,  filter_linear_mipmap; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform sampler2D distortionTexture; | 
					
						
							|  |  |  | uniform float offsetR = 1; | 
					
						
							|  |  |  | uniform float offsetG = 1; | 
					
						
							|  |  |  | uniform float offsetB = 1; | 
					
						
							|  |  |  | uniform float maxScale: hint_range(1,2) = 1.25; | 
					
						
							|  |  |  | uniform float effectStrength: hint_range(0,1) = 1; | 
					
						
							|  |  |  | uniform sampler2D scrollingTexture; | 
					
						
							|  |  |  | uniform float scrollScale = 1; | 
					
						
							|  |  |  | uniform vec2 scrollDirection = vec2( 0.01,0.01 ); | 
					
						
							|  |  |  | uniform float scrollAmount = 0.1; | 
					
						
							|  |  |  | uniform float minScroll = -1; | 
					
						
							|  |  |  | uniform float maxScroll = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void fragment() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   vec2 scrollUV = mod( scrollScale * (UV + TIME * scrollDirection ), vec2(1,1) ) ; | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   float strength = texture( distortionTexture, UV ).r + | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |                   mix( minScroll, maxScroll, texture( scrollingTexture, scrollUV ).r ) * scrollAmount; | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |   vec2 outerUV  =  ( UV - vec2(0.5,0.5) ) * maxScale + vec2( 0.5, 0.5 ); | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   vec2 direction = ( UV - outerUV ) * effectStrength; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |   vec4 red    = texture( screenTexture, UV + strength * offsetR * direction ); | 
					
						
							|  |  |  |   vec4 green  = texture( screenTexture, UV + strength * offsetG * direction ); | 
					
						
							|  |  |  |   vec4 blue   = texture( screenTexture, UV + strength * offsetB * direction  ); | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |   vec4 mixed = vec4( red.r, green.g, blue.b, 1 ); | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |   COLOR = mixed; | 
					
						
							|  |  |  | } |