rj-action-library/Runtime/Shading/Shaders/PostProcessing/Overlays.gdshader

30 lines
849 B
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 overlay;
uniform float effectStrength: hint_range(0,1) = 1;
void fragment()
{
vec4 rgb = texture( screenTexture, UV );
vec4 originalRGB = rgb;
vec4 overlayColor = texture( overlay, UV );
vec4 additiveOverlayColor = overlayColor + rgb;
vec4 multipliedOverlayColor = overlayColor * rgb;
float overlayBlendType = length( overlayColor.rgb );
vec4 mixed = mix3_v4( multipliedOverlayColor, rgb, additiveOverlayColor, overlayBlendType );
rgb = mixed;
COLOR = mix( originalRGB, mixed, effectStrength );
}