batrix/shaders/cel_shader/cel_shader_no_culling.gdshader
2025-02-27 02:08:29 +10:00

48 lines
1.5 KiB
Plaintext

// https://github.com/eldskald/godot4-cel-shader
shader_type spatial;
render_mode cull_disabled;
#include "includes/base_cel_shader.gdshaderinc"
group_uniforms BaseProperties;
uniform vec4 color : source_color = vec4(0.7, 0.12, 0.86, 1.0);
uniform sampler2D base_texture : source_color;
uniform vec4 specular : source_color = vec4(0.3, 0.3, 0.3, 0.5);
uniform sampler2D specular_texture : hint_default_white;
uniform vec4 fresnel : source_color = vec4(0.2, 0.2, 0.2, 0.3);
uniform sampler2D fresnel_texture : hint_default_white;
group_uniforms;
varying vec3 SPECULAR_COLOR;
varying float SPECULAR_STRENGTH;
varying vec3 FRESNEL_COLOR;
varying float FRESNEL_STRENGTH;
group_uniforms Tiling;
uniform vec2 uv_scale = vec2(1, 1);
uniform vec2 uv_offset = vec2(0, 0);
group_uniforms;
void vertex() { UV = UV * uv_scale.xy + uv_offset.xy; }
void fragment() {
ALBEDO = color.rgb * texture(base_texture, UV).rgb;
SPECULAR_COLOR = specular.rgb * texture(specular_texture, UV).rgb;
SPECULAR_STRENGTH = specular.a * texture(specular_texture, UV).a;
FRESNEL_COLOR = fresnel.rgb * texture(fresnel_texture, UV).rgb;
FRESNEL_STRENGTH = fresnel.a * texture(fresnel_texture, UV).a;
}
void light() {
DIFFUSE_LIGHT +=
diffuse_light(ALBEDO, LIGHT_COLOR, LIGHT, NORMAL, ATTENUATION);
SPECULAR_LIGHT += fresnel_light(LIGHT_COLOR, FRESNEL_COLOR, FRESNEL_STRENGTH,
NORMAL, VIEW, LIGHT, ATTENUATION
//);
) *
2.0;
}