40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 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) ) ;
 | |
|   float strength = texture( distortionTexture, UV ).r +
 | |
|                   mix( minScroll, maxScroll, texture( scrollingTexture, scrollUV ).r ) * scrollAmount;
 | |
| 
 | |
| 
 | |
|   vec2 outerUV  =  ( UV - vec2(0.5,0.5) ) * maxScale + vec2( 0.5, 0.5 );
 | |
| 
 | |
|   vec2 direction = ( UV - outerUV ) * effectStrength;
 | |
| 
 | |
|   vec4 red    = texture( screenTexture, UV + strength * offsetR * direction );
 | |
|   vec4 green  = texture( screenTexture, UV + strength * offsetG * direction );
 | |
|   vec4 blue   = texture( screenTexture, UV + strength * offsetB * direction  );
 | |
| 
 | |
|   vec4 mixed = vec4( red.r, green.g, blue.b, 1 );
 | |
| 
 | |
| 
 | |
|   COLOR = mixed;
 | |
| } |