rj-action-library/Runtime/Shading/Shaders/Effects/RainbowGlow/RainbowGlow.gdshader

51 lines
1.5 KiB
Plaintext
Raw Normal View History

2025-01-19 20:35:51 +00:00
// NOTE: Shader automatically converted from Godot Engine 4.3.stable.mono's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded;
#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"
2025-01-20 16:12:24 +00:00
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc"
2025-01-19 20:35:51 +00:00
2025-01-20 16:12:24 +00:00
uniform vec4 tint : source_color;
uniform float colorScale = 0.24;
2025-01-19 20:35:51 +00:00
uniform float normalWrap = 1;
2025-01-20 16:12:24 +00:00
uniform float normalShift = 0.465;
2025-01-19 20:35:51 +00:00
uniform float weight = 1;
2025-01-20 16:12:24 +00:00
uniform float normalWrap2 = 5.525;
2025-01-19 20:35:51 +00:00
uniform float normalShift2 = 0;
2025-01-20 16:12:24 +00:00
uniform float weight2 = 0.181;
2025-01-19 20:35:51 +00:00
2025-01-20 16:12:24 +00:00
uniform float normalWrap3 = 0.1;
uniform float normalShift3 = 2.655;
uniform float weight3 = 0.315;
2025-01-19 20:35:51 +00:00
varying vec3 worldNormal;
void vertex()
{
worldNormal = NORMAL * MODEL_NORMAL_MATRIX;
}
2025-01-20 16:12:24 +00:00
vec3 rainbow( float hue )
{
return HSLtoRGB( vec3( hue, 1.0, 0.5 ) );
}
2025-01-19 20:35:51 +00:00
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 );
2025-01-20 16:12:24 +00:00
vec3 rainbowColor = rainbow( dotP ) * weight
+ rainbow( dotP2 ) * weight2
+ rainbow( dotP3 ) * weight3;
ALBEDO = tint.rgb * rainbowColor * colorScale;
2025-01-19 20:35:51 +00:00
}