Rainbow Glow

This commit is contained in:
Josef 2025-01-20 17:12:24 +01:00
parent 7b3f4d8c5e
commit c8fec3cbc3
1 changed files with 18 additions and 16 deletions

View File

@ -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/Math.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.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/Noise.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc"
uniform vec4 albedo : source_color; uniform vec4 tint : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; uniform float colorScale = 0.24;
uniform float colorScale = 1;
uniform float normalWrap = 1; uniform float normalWrap = 1;
uniform float normalShift = 0; uniform float normalShift = 0.465;
uniform float weight = 1; uniform float weight = 1;
uniform float normalWrap2 = 1; uniform float normalWrap2 = 5.525;
uniform float normalShift2 = 0; uniform float normalShift2 = 0;
uniform float weight2 = 1; uniform float weight2 = 0.181;
uniform float normalWrap3 = 1; uniform float normalWrap3 = 0.1;
uniform float normalShift3 = 0; uniform float normalShift3 = 2.655;
uniform float weight3 = 1; uniform float weight3 = 0.315;
varying vec3 worldNormal; varying vec3 worldNormal;
@ -32,17 +30,21 @@ void vertex()
} }
vec3 rainbow( float hue )
{
return HSLtoRGB( vec3( hue, 1.0, 0.5 ) );
}
void fragment() void fragment()
{ {
float dotP = mod( dot( worldNormal, VIEW ) * normalWrap + normalShift, 1 ); float dotP = mod( dot( worldNormal, VIEW ) * normalWrap + normalShift, 1 );
float dotP2 = mod( dot( -NORMAL, -VIEW ) * normalWrap2 + normalShift2, 1 ); float dotP2 = mod( dot( -NORMAL, -VIEW ) * normalWrap2 + normalShift2, 1 );
float dotP3 = mod( dot( -NORMAL, -VIEW ) * normalWrap3 + normalShift3, 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;
vec3 rainbowColor = rainbow( dotP ) * weight
+ rainbow( dotP2 ) * weight2
+ rainbow( dotP3 ) * weight3;
ALBEDO = albedo.rgb * albedo_tex.rgb * colorScale; ALBEDO = tint.rgb * rainbowColor * colorScale;
} }