From c8fec3cbc3cca866c1ad44f1deb7e42dff3b2e94 Mon Sep 17 00:00:00 2001 From: Josef Date: Mon, 20 Jan 2025 17:12:24 +0100 Subject: [PATCH] Rainbow Glow --- .../Effects/RainbowGlow/RainbowGlow.gdshader | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Runtime/Shading/Shaders/Effects/RainbowGlow/RainbowGlow.gdshader b/Runtime/Shading/Shaders/Effects/RainbowGlow/RainbowGlow.gdshader index 9ffe690..070f1fd 100644 --- a/Runtime/Shading/Shaders/Effects/RainbowGlow/RainbowGlow.gdshader +++ b/Runtime/Shading/Shaders/Effects/RainbowGlow/RainbowGlow.gdshader @@ -6,23 +6,21 @@ render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_sc #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" -uniform vec4 albedo : source_color; -uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; - -uniform float colorScale = 1; - +uniform vec4 tint : source_color; +uniform float colorScale = 0.24; uniform float normalWrap = 1; -uniform float normalShift = 0; +uniform float normalShift = 0.465; uniform float weight = 1; -uniform float normalWrap2 = 1; +uniform float normalWrap2 = 5.525; uniform float normalShift2 = 0; -uniform float weight2 = 1; +uniform float weight2 = 0.181; -uniform float normalWrap3 = 1; -uniform float normalShift3 = 0; -uniform float weight3 = 1; +uniform float normalWrap3 = 0.1; +uniform float normalShift3 = 2.655; +uniform float weight3 = 0.315; varying vec3 worldNormal; @@ -32,17 +30,21 @@ void vertex() } +vec3 rainbow( float hue ) +{ + return HSLtoRGB( vec3( hue, 1.0, 0.5 ) ); +} void fragment() { float dotP = mod( dot( worldNormal, VIEW ) * normalWrap + normalShift, 1 ); float dotP2 = mod( dot( -NORMAL, -VIEW ) * normalWrap2 + normalShift2, 1 ); float dotP3 = mod( dot( -NORMAL, -VIEW ) * normalWrap3 + normalShift3, 1 ); - vec4 albedo_tex = texture( texture_albedo, vec2( dotP, 0 ) ) * weight - + texture( texture_albedo, vec2( dotP2, 0 ) ) * weight2 - + texture( texture_albedo, vec2( dotP3, 0 ) ) * weight3; - - ALBEDO = albedo.rgb * albedo_tex.rgb * colorScale; + vec3 rainbowColor = rainbow( dotP ) * weight + + rainbow( dotP2 ) * weight2 + + rainbow( dotP3 ) * weight3; + + ALBEDO = tint.rgb * rainbowColor * colorScale; }