Added VFEZ

This commit is contained in:
MaddoScientisto 2025-03-09 15:58:26 +01:00
commit 6d572503cb
59 changed files with 5796 additions and 0 deletions

View file

@ -0,0 +1,25 @@
group_uniforms alpha_clip;
uniform float alpha_clip_left: hint_range(0.0, 1.0) = 0;
uniform float alpha_clip_right: hint_range(0.0, 1.0) = 0;
uniform float alpha_clip_up: hint_range(0.0, 1.0) = 0;
uniform float alpha_clip_down: hint_range(0.0, 1.0) = 0;
group_uniforms;
float alpha_clip(float alpha, vec2 uv, vec2 main_texture_scale)
{
vec2 norm_uv = uv / main_texture_scale;
if (1. - alpha_clip_up - norm_uv.y < 0.)
return 0.;
if (norm_uv.y - alpha_clip_down < 0.)
return 0.;
if (1. - alpha_clip_right - norm_uv.x < 0.)
return 0.;
if (norm_uv.x - alpha_clip_left < 0.)
return 0.;
return alpha;
}

View file

@ -0,0 +1,15 @@
group_uniforms alpha_cutoff;
uniform float alpha_cuttof_value: hint_range(0.001, 1.) = 0.5;
group_uniforms;
float alpha_cutoff(float alpha)
{
if (((1. - alpha_cuttof_value) - (1. - alpha) - 0.01) < 0.)
{
return 0.;
}
else
{
return alpha;
}
}

View file

@ -0,0 +1,67 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms alpha_disolve;
uniform sampler2D alpha_disolve_texture: source_color;
uniform vec2 alpha_disolve_texture_scale = vec2(1.);
uniform vec2 alpha_disolve_texture_offset = vec2(0.);
uniform float alpha_disolve_amount: hint_range(-0.1, 1) = -0.1;
uniform float alpha_disolve_transition: hint_range(0.01, 0.75)= 0.075;
uniform float alpha_disolve_power: hint_range(0.001, 10) = 1;
uniform vec2 alpha_disolve_scroll_speed;
group_uniforms;
// disolve burn
group_uniforms alpha_disolve.disolve_burn;
uniform bool use_alpha_disolve_burn = false;
uniform sampler2D alpha_disolve_burn_texture: source_color;
uniform vec3 alpha_disolve_burn_color: source_color = vec3(1., 1., 0.);
uniform float alpha_disolve_burn_width: hint_range(0.0, 0.2) = 0.01;
uniform float alpha_disolve_burn_glow: hint_range(1, 250) = 5;
group_uniforms;
vec4 alpha_disolve(
vec4 color,
float pre_disolve_alpha,
float base_a,
vec2 uv,
bool fract_uv)
{
vec2 disolve_uv = transform_uv(uv, alpha_disolve_texture_scale, alpha_disolve_texture_offset, fract_uv);
float disolve_amount = clamp(alpha_disolve_amount + (1. - base_a), 0., 1.);
float disolve_transition = max(0.01, alpha_disolve_transition * ease_out_quint(disolve_amount));
disolve_uv += mod(TIME * alpha_disolve_scroll_speed, 1.0);
disolve_amount = clamp(pow(disolve_amount, alpha_disolve_power), 0., 1.);
float disolve_sample = texture(alpha_disolve_texture, disolve_uv).r;
float disolve = clamp(
smoothstep(
0.0,
disolve_transition,
remap_float(1.0 - disolve_amount, 0.0, 1.0, -1.0, 1.0) + disolve_sample
), 0., 1.);
color.a *= disolve;
if (use_alpha_disolve_burn)
{
float disolve_burn = clamp(
smoothstep(
0.,
disolve_transition + alpha_disolve_burn_width,
remap_float(1.0 - disolve_amount, 0.0, 1.0, -1.0, 1.0) + disolve_sample
), 0., 1.
);
disolve_burn = disolve - disolve_burn;
vec3 disolve_burn_color = alpha_disolve_burn_color.rgb * alpha_disolve_burn_glow;
color.rgb += disolve_burn *
texture(alpha_disolve_burn_texture, disolve_uv).rgb
* disolve_burn_color.rgb
* pre_disolve_alpha;
}
return color;
}

View file

@ -0,0 +1,13 @@
group_uniforms alpha_flicker;
uniform float alpha_flicker_percent: hint_range(0., 1.) = 0.05;
uniform float alpha_flicker_frequency: hint_range(0., 5.) = 0.2;
uniform float alpha_flicker_value: hint_range(0.0, 1.0) = 0.;
group_uniforms;
float alpha_flicker(float alpha)
{
alpha *= clamp(
alpha * step(fract(0.05 + TIME * alpha_flicker_frequency),
1. - alpha_flicker_percent) + alpha_flicker_value, 0., 1.);
return alpha;
}

View file

@ -0,0 +1,23 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms alpha_mask;
uniform sampler2D alpha_mask_texture: source_color;
uniform vec2 alpha_mask_scale = vec2(1.);
uniform vec2 alpha_mask_offset = vec2(0.);
uniform float alpha_mask_power: hint_range(0.001, 10.) = 1;
group_uniforms;
float alpha_mask(
float alpha,
vec2 uv,
bool fract_uv)
{
vec2 alpha_mask_uv = transform_uv(uv, alpha_mask_scale, alpha_mask_offset, fract_uv);
vec4 alpha_mask_sample = texture(alpha_mask_texture, alpha_mask_uv);
float mask = pow(min(alpha_mask_sample.r, alpha_mask_sample.a), alpha_mask_power);
alpha *= mask;
return alpha;
}

View file

@ -0,0 +1,28 @@
group_uniforms alpha_radial_clip;
uniform float alpha_radial_clip_start_angle: hint_range(0.0, 360., 1.);
uniform float alpha_radial_clip_one: hint_range(0.0, 360., 1.);
uniform float alpha_radial_clip_two: hint_range(0.0, 360., 1.);
group_uniforms;
float alpha_radial_clip(float alpha, vec2 uv, vec2 main_texture_scale)
{
vec2 norm_uv = uv / main_texture_scale;
float start_angle = alpha_radial_clip_start_angle - alpha_radial_clip_one;
float end_angle = alpha_radial_clip_start_angle + alpha_radial_clip_two;
float offset_0 = clamp(0., 360., start_angle + 360.);
float offset_360 = clamp(0., 360., end_angle - 360.);
vec2 atan2Coord = vec2(mix(-1., 1., norm_uv.x), mix(-1., 1., norm_uv.y));
float a_tan_angle = atan(atan2Coord.y, atan2Coord.x) * 57.3;
if (a_tan_angle < 0.)
a_tan_angle = 360. + a_tan_angle;
if (a_tan_angle >= start_angle && a_tan_angle <= end_angle)
return 0.;
if (a_tan_angle <= offset_360)
return 0.;
if (a_tan_angle >= offset_0)
return 0.;
return alpha;
}

View file

@ -0,0 +1,10 @@
group_uniforms alpha_remap;
uniform float alpha_remap_min: hint_range(0.0, 1.0) = 0;
uniform float alpha_remap_max: hint_range(0.0, 1.0) = 0.075;
group_uniforms;
float alpha_remap(float alpha)
{
alpha = smoothstep(alpha_remap_min, alpha_remap_max, alpha);
return alpha;
}

View file

@ -0,0 +1,18 @@
group_uniforms chromatic_aberration;
uniform float chromatic_aberration_amount: hint_range(0.0, 1.0) = 1.;
uniform float chromatic_aberration_alpha: hint_range(0.0, 1.0) = 0.4;
group_uniforms;
vec4 chromatic_aberration(vec4 color, vec2 uv, sampler2D main_texture)
{
vec4 r = texture(main_texture,
uv + vec2(chromatic_aberration_amount / 10., 0.));
vec4 b = texture(main_texture,
uv + vec2(-chromatic_aberration_amount / 10., 0.));
color = vec4(r.r * r.a, color.g, b.b * b.a,
max(max(r.a, b.a) * chromatic_aberration_alpha, color.a));
return color;
}

View file

@ -0,0 +1,71 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_change.color1;
uniform bool change_color_1;
uniform vec3 color_1_to_change: source_color;
uniform vec3 color_1_to_replace: source_color;
uniform float color_1_change_tolerance: hint_range(0.0, 1.0) = 0.1;
group_uniforms;
group_uniforms color_change.color2;
uniform bool change_color_2;
uniform vec3 color_2_to_change: source_color;
uniform vec3 color_2_to_replace: source_color;
uniform float color_2_change_tolerance: hint_range(0.0, 1.0) = 0.1;
group_uniforms;
group_uniforms color_change.color3;
uniform bool change_color_3;
uniform vec3 color_3_to_change: source_color;
uniform vec3 color_3_to_replace: source_color;
uniform float color_3_change_tolerance: hint_range(0.0, 1.0) = 0.1;
group_uniforms;
vec3 change_single_color(
vec3 color,
vec3 color_to_change,
vec3 color_to_replace,
float color_change_tolerance)
{
vec3 dif = abs(color - color_to_change.rgb);
color.rgb = mix(color, color_to_replace.rgb,
max(sign(color_change_tolerance * 3. - dif.x - dif.y - dif.z), 0.0));
return color;
}
vec3 color_change(vec3 color)
{
color = clamp(color, 0., 1.);
if (change_color_1)
{
color = change_single_color(
color,
color_1_to_change,
color_1_to_replace,
color_1_change_tolerance);
}
if (change_color_2)
{
color = change_single_color(
color,
color_2_to_change,
color_2_to_replace,
color_2_change_tolerance);
}
if (change_color_3)
{
color = change_single_color(
color,
color_3_to_change,
color_3_to_replace,
color_3_change_tolerance);
}
return color;
}

View file

@ -0,0 +1,16 @@
group_uniforms color_face_tint;
uniform vec3 backface_tint_color: source_color = vec3(0.5);
uniform vec3 frontface_tint_color: source_color = vec3(1.);
group_uniforms;
vec3 color_face_tint(
vec3 color,
vec3 world_normal,
vec3 view_direction)
{
color.rgb = mix(
color.rgb * backface_tint_color,
color.rgb * frontface_tint_color,
step(0, dot(world_normal, view_direction)));
return color;
}

View file

@ -0,0 +1,20 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_ghost;
uniform float color_ghost_boost: hint_range(0.0, 5.) = 1.;
uniform float color_ghost_transparency: hint_range(0.0, 1.0) = 0.;
uniform float color_ghost_blend: hint_range(0.0, 1.0) = 1.;
group_uniforms;
vec4 color_ghost(vec4 color)
{
float luminance = get_color_luminance(color);
vec4 ghost;
ghost.a = clamp(luminance - color_ghost_transparency, 0., 1.) * color.a;
ghost.rgb = color.rgb * (luminance + color_ghost_boost);
color = mix(color, ghost, color_ghost_blend);
return color;
}

View file

@ -0,0 +1,23 @@
group_uniforms color_glow;
uniform vec4 glow_color: source_color = vec4(1.);
uniform float glow_intensity = 0;
uniform float glow_intensity_global = 1;
uniform bool use_glow_texture = false;
uniform sampler2D glow_texture: source_color;
group_uniforms;
vec3 color_glow(
vec4 color,
vec2 uv,
float glow_mult)
{
float glow_mask = 1.;
if (use_glow_texture)
{
glow_mask = texture(glow_texture, uv).r;
}
color.rgb *= glow_intensity_global * glow_mask;
color.rgb += glow_color.rgb * glow_intensity * glow_mask * color.a * glow_mult;
return color.rgb;
}

View file

@ -0,0 +1,32 @@
group_uniforms color_gradient;
uniform float color_gradient_blend: hint_range(0., 1.) = 0.5;
uniform float color_gradient_boost_x: hint_range(0., 1.) = 0.5;
uniform float color_gradient_boost_y: hint_range(0., 1.) = 0.5;
uniform vec4 color_gradient_top_right_color: source_color = vec4(1,0,0,1);
uniform vec4 color_gradient_bottom_right_color: source_color = vec4(0,1,0,1);
uniform vec4 color_gradient_top_left_color: source_color = vec4(0,0,1,1);
uniform vec4 color_gradient_bottom_left_color: source_color = vec4(1,1,0,1);
group_uniforms;
vec4 color_gradient(vec4 color, vec2 uv, vec2 main_texture_scale)
{
vec2 norm_uv = uv / main_texture_scale;
float grad_x_mix_factor = clamp(pow(norm_uv.x, color_gradient_boost_x), 0., 1.);
float grad_y_mix_factor = clamp(pow(norm_uv.y, color_gradient_boost_y), 0., 1.);
vec4 grad_result = mix(
mix(
color_gradient_bottom_left_color,
color_gradient_bottom_right_color,
grad_x_mix_factor),
mix(
color_gradient_top_left_color,
color_gradient_top_right_color,
grad_x_mix_factor),
grad_y_mix_factor
);
grad_result = mix(color, grad_result, color_gradient_blend);
color.rgb = grad_result.rgb * color.a;
color.a *= grad_result.a;
return color;
}

View file

@ -0,0 +1,18 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_greyscale;
uniform float color_greyscale_luminosity: hint_range(-1., 1.) = 0;
uniform float color_greyscale_blend: hint_range(0., 1.) = 1.;
uniform vec3 color_greyscale_tint: source_color = vec3(1.);
group_uniforms;
vec3 color_greyscale(vec3 color)
{
float luminance = get_color_luminance(vec4(color, 1.));
luminance = clamp(luminance + color_greyscale_luminosity, 0., 1.);
color = mix(color, vec3(luminance) * color_greyscale_tint, color_greyscale_blend);
return color;
}

View file

@ -0,0 +1,34 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_hologram;
uniform vec3 color_hologram_stripes_color: source_color = vec3(0,1,1);
uniform float color_hologram_stripes_amount: hint_range(0.0, 1.0) = 0.1;
uniform float color_hologram_unchanged_amount: hint_range(0.0, 1.0) = 0.0;
uniform float color_hologram_stripes_speed: hint_range(-20., 20.) = 4.5;
uniform float color_hologram_min_alpha: hint_range(0.0, 1.0) = 0.1;
uniform float color_hologram_max_alpha: hint_range(0.0, 1.0) = 0.75;
uniform float color_hologram_blend: hint_range(0.0, 1.0) = 1.;
group_uniforms;
vec4 color_hologram(vec4 color, vec2 uv)
{
float total_hologram = color_hologram_stripes_amount +
color_hologram_unchanged_amount;
float hologram_y_coord = mod(uv.y + mod(TIME, 1.) * color_hologram_stripes_speed, total_hologram) / total_hologram;
hologram_y_coord = abs(hologram_y_coord);
float alpha = remap_float(
clamp(hologram_y_coord - color_hologram_unchanged_amount / total_hologram, 0., 1.),
0., 1., color_hologram_min_alpha, color_hologram_max_alpha);
float hologram_mask = max(sign(color_hologram_unchanged_amount / total_hologram - hologram_y_coord), 0.0);
vec4 hologram_result = color;
hologram_result.a *= mix(alpha, 1., hologram_mask);
hologram_result.rgb *= max(1., color_hologram_max_alpha * max (sign (hologram_y_coord - color_hologram_unchanged_amount / total_hologram), 0.0));
hologram_mask = 1. - step(0.01, hologram_mask);
hologram_result.rgb += hologram_mask * color_hologram_stripes_color.rgb * color.a;
color = mix(color, hologram_result, color_hologram_blend);
return color;
}

View file

@ -0,0 +1,9 @@
group_uniforms color_negative;
uniform float color_negative_blend: hint_range(0.0, 1.0) = 1.0;
group_uniforms;
vec3 color_negative(vec3 color)
{
color = mix(color, 1. - color, color_negative_blend);
return color;
}

View file

@ -0,0 +1,40 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_overlay_texture;
uniform sampler2D color_overlay_tex: source_color;
uniform vec2 color_overlay_tex_scale = vec2(1.);
uniform vec2 color_overlay_tex_offset = vec2(0.);
uniform vec4 color_overlay_color: source_color = vec4(1.);
uniform float color_overlay_glow: hint_range(0.0, 25) = 1.;
uniform float color_overlay_blend: hint_range(0.0, 1.0) = 1.;
uniform float color_overlay_tex_scroll_x: hint_range(-5, 5) = 0.25;
uniform float color_overlay_tex_scroll_y: hint_range(-5, 5) = 0.25;
uniform bool color_overlay_mult;
group_uniforms;
vec4 color_overlay_texture(vec4 color, vec2 uv)
{
vec2 overlay_uv = uv;
overlay_uv.x += TIME * color_overlay_tex_scroll_x;
overlay_uv.y += TIME * color_overlay_tex_scroll_y;
overlay_uv = fract(overlay_uv);
overlay_uv = transform_uv(overlay_uv, color_overlay_tex_scale, color_overlay_tex_offset, true);
vec4 final_overlay_color = texture(color_overlay_tex, overlay_uv);
final_overlay_color.rgb *= color_overlay_color.rgb * color_overlay_glow;
if (color_overlay_mult)
{
final_overlay_color.a *= color_overlay_color.a;
color = mix(color, color * final_overlay_color, color_overlay_blend);
}
else
{
final_overlay_color.rgb *= final_overlay_color.a * color_overlay_color.rgb * color_overlay_color.a * color_overlay_blend;
color.rgb += final_overlay_color.rgb;
}
return color;
}

View file

@ -0,0 +1,9 @@
group_uniforms color_posterize;
uniform float color_posterize_num_colors: hint_range(0.0, 30.) = 5.;
group_uniforms;
vec3 color_posterize(vec3 color)
{
color = floor(color.rgb / (1.0 / color_posterize_num_colors)) * (1.0 / color_posterize_num_colors);
return color;
}

View file

@ -0,0 +1,24 @@
group_uniforms color_radial_gradient;
uniform vec2 color_radial_gradient_center = vec2(0.5);
uniform float color_radial_gradient_blend: hint_range(0., 1.) = 0.5;
uniform float color_radial_gradient_boost: hint_range(0., 1.) = 0.5;
uniform vec4 color_radial_gradient_color_one: source_color = vec4(1,0,0,1);
uniform vec4 color_radial_gradient_color_two: source_color = vec4(0,1,0,1);
group_uniforms;
vec4 color_radial_gradient(vec4 color, vec2 uv, vec2 main_texture_scale, vec2 viewport_size)
{
vec2 norm_uv = uv / main_texture_scale;
float radial_dist = 1. - length(norm_uv - color_radial_gradient_center);
radial_dist*= viewport_size.x / viewport_size.y;
radial_dist = clamp(color_radial_gradient_boost * radial_dist, 0., 1.);
vec4 grad_result = mix(
color_radial_gradient_color_one,
color_radial_gradient_color_two,
radial_dist);
grad_result = mix(color, grad_result, color_radial_gradient_blend);
color.rgb = grad_result.rgb * color.a;
color.a *= grad_result.a;
return color;
}

View file

@ -0,0 +1,21 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_ramp;
uniform vec4 color_ramp_albedo: source_color = vec4(1.);
uniform sampler2D color_ramp_texture: source_color, repeat_disable;
uniform float color_ramp_luminosity: hint_range(-1., 1.) = 0.;
uniform float color_ramp_blend: hint_range(0.0, 1.0) = 1.;
group_uniforms;
vec4 color_ramp(vec4 color)
{
float luminance = get_color_luminance(color);
float color_ramp_luminance = clamp(luminance + color_ramp_luminosity, 0., 1.);
vec4 color_ramp_res = texture(color_ramp_texture, vec2(color_ramp_luminance)) * color_ramp_albedo;
color.rgb = mix(color.rgb, color_ramp_res.rgb, color_ramp_blend);
color.a = mix(color.a, clamp(color.a * color_ramp_res.a, 0., 1.), color_ramp_blend);
return color;
}

View file

@ -0,0 +1,31 @@
group_uniforms color_rim;
uniform vec4 rim_color: source_color = vec4(1.);
uniform float rim_bias: hint_range(0.0, 1.0) = 0.;
uniform float rim_scale: hint_range(0.0, 25.0) = 1.;
uniform float rim_power: hint_range(0.1, 20.0) = 5.;
uniform float rim_intensity: hint_range(0.1, 50.0) = 1.;
uniform float rim_add_amount: hint_range(0.1, 1.0) = 1.;
uniform float rim_erodes_alpha: hint_range(0.1, 2.0) = 0.;
group_uniforms;
vec4 color_rim(
vec4 color,
vec3 normal,
vec3 view)
{
float ndv = 1. - abs(dot(normal, view));
float rim_factor = clamp(
rim_bias + rim_scale * pow(ndv, rim_power), 0., 1.);
vec4 final_rim_color = rim_color * rim_factor;
final_rim_color.rgb *= rim_intensity;
color.rgb = mix(
color.rgb * (final_rim_color.rgb + vec3(1.)),
color.rgb + final_rim_color.rgb,
rim_add_amount);
color.a = clamp(
color.a * (1. - rim_factor * rim_erodes_alpha),
0.,
1.);
return color;
}

View file

@ -0,0 +1,17 @@
group_uniforms color_shadow;
uniform float color_shadow_x: hint_range(-0.5, 0.5) = 0.1;
uniform float color_shadow_y: hint_range(-0.5, 0.5) = 0.1;
uniform float color_shadow_alpha: hint_range(0., 1.) = 0.5;
uniform vec3 color_shadow_color: source_color = vec3(0.);
group_uniforms;
vec4 shadow(vec4 color, sampler2D tex, vec2 uv)
{
vec2 shadowOffset = vec2(color_shadow_x, color_shadow_y);
float shadowA = texture(tex, uv + shadowOffset).a;
color.rgb *= 1. - (shadowA - color.a) * (1. - color.a);
color.rgb += color_shadow_color * shadowA * (1. - color.a);
color = clamp(color, 0., 1.);
color.a = max(shadowA * color_shadow_alpha, color.a);
return color;
}

View file

@ -0,0 +1,48 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_shine;
uniform vec4 color_shine_color: source_color = vec4(1.);
uniform float color_shine_location: hint_range(0., 1.) = 0.5;
uniform float color_shine_angle: hint_range(0.0, 6.2831) = 0.;
uniform float color_shine_width: hint_range(0.0, 2.0) = 0.1;
uniform float color_shine_glow: hint_range(0., 100., 1.) = 1.;
uniform sampler2D color_shine_mask: source_color;
uniform bool color_shine_mask_red_as_alpha;
group_uniforms;
vec4 color_shine(vec4 color, vec2 uv)
{
if (color_shine_width == 0.)
return color;
vec2 shine_uv = uv;
shine_uv = rotate_uvs(shine_uv, color_shine_angle, vec2(1.), vec2(0.));
float shine_mask;
if (color_shine_mask_red_as_alpha)
{
shine_mask = texture(color_shine_mask, uv).r;
}
else
{
shine_mask = texture(color_shine_mask, uv).a;
}
float current_distance_proj = (shine_uv.x + shine_uv.y) / 2.;
float white_power = 1. -
abs(current_distance_proj - color_shine_location) / color_shine_width;
vec4 shine_color = color + color.a * white_power * color_shine_glow
* max(sign(current_distance_proj - (color_shine_location - color_shine_width)), 0.)
* max(sign(color_shine_location + color_shine_width - current_distance_proj), 0.)
* color_shine_color * shine_mask;
color.rgb = shine_color.rgb;
return color;
}

View file

@ -0,0 +1,10 @@
group_uniforms color_single;
uniform vec3 color_single_color: source_color = vec3(1.);
uniform float color_single_blend: hint_range(0.0, 1.0) = 1.0;
group_uniforms;
vec3 color_single(vec3 color)
{
color = mix(color, color_single_color, color_single_blend);
return color;
}

View file

@ -0,0 +1,36 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms color_toning;
uniform vec3 color_grading_light_tone: source_color;
uniform vec3 color_grading_mid_tone: source_color;
uniform vec3 color_grading_dark_tone: source_color;
uniform float color_grading_mid_point: hint_range(0.0, 1.0) = 0.5;
group_uniforms;
vec3 color_toning(vec4 color)
{
float luminance = get_color_luminance(color);
vec3 color_grading_dark_middle_mix = mix(
color_grading_dark_tone,
color_grading_mid_tone,
luminance / color_grading_mid_point
);
vec3 color_grading_middle_light_mix = mix(
color_grading_mid_tone,
color_grading_light_tone,
(luminance - color_grading_mid_point) / (1.0 - color_grading_mid_point)
);
color.rgb *= mix(
color_grading_dark_middle_mix,
color_grading_middle_light_mix,
step(color_grading_mid_point, luminance)
);
return color.rgb;
}

View file

@ -0,0 +1,20 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms glitch;
uniform float glitch_amount: hint_range(0.0, 20.) = 3.;
uniform float glitch_size: hint_range(0.25, 5.) = 1.;
group_uniforms;
vec3 glitch(vec3 color, vec2 uv, sampler2D main_texture)
{
vec2 glitch_uv = uv - 0.5;
float line_noise =
pow(rand(floor(glitch_uv * vec2(24., 19.) * glitch_size) * 4.0, TIME), 3.0) * glitch_amount
* pow(rand(floor(glitch_uv * vec2(38., 14.) * glitch_size) * 4.0, TIME), 3.0);
color = texture(main_texture, uv + vec2(line_noise * 0.02 * rand(vec2(2.0, 1.), TIME), 0)).rgb;
return color;
}

View file

@ -0,0 +1,23 @@
group_uniforms color_hsv_shift;
uniform float h_shift: hint_range(0.0, 360.0) = 180;
uniform float s_shift: hint_range(0.0, 2.) = 1.;
uniform float v_shift: hint_range(0.0, 2.) = 1.;
group_uniforms;
vec3 hsv_shift(vec3 color)
{
vec3 result_hsv = vec3(color.rgb);
float cos_hsv = v_shift * s_shift * cos(h_shift * PI / 180.);
float sin_hsv = v_shift * s_shift * sin(h_shift * PI / 180.);
result_hsv.x = (.299 * v_shift + .701 * cos_hsv + .168 * sin_hsv) * color.x
+ (.587 * v_shift - .587 * cos_hsv + .330 * sin_hsv) * color.y
+ (.114 * v_shift - .114 * cos_hsv - .497 * sin_hsv) * color.z;
result_hsv.y = (.299 * v_shift - .299 * cos_hsv - .328 * sin_hsv) *color.x
+ (.587 * v_shift + .413 * cos_hsv + .035 * sin_hsv) * color.y
+ (.114 * v_shift - .114 * cos_hsv + .292 * sin_hsv) * color.z;
result_hsv.z = (.299 * v_shift - .3 * cos_hsv + 1.25 * sin_hsv) * color.x
+ (.587 * v_shift - .588 * cos_hsv - 1.05 * sin_hsv) * color.y
+ (.114 * v_shift + .886 * cos_hsv - .203 * sin_hsv) * color.z;
color.rgb = result_hsv;
return color.rgb;
}

View file

@ -0,0 +1,35 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms motion_blur;
uniform float motion_blur_angle: hint_range(-1., 1.) = 0.1;
uniform float motion_blur_dist: hint_range(-3., 3.) = 1.25;
group_uniforms;
vec3 motion_blur(vec3 color, vec2 uv, sampler2D main_texture)
{
float angle = motion_blur_angle * PI;
float dist = motion_blur_dist * 0.005;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(-dist, -dist), angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(-dist, -dist) * 2., angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(-dist, -dist) * 3., angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(-dist, -dist) * 4., angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(dist, dist), angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(dist, dist) * 2., angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(dist, dist) * 3., angle)).rgb;
color.rgb += texture(main_texture,
uv + rotate_vec2(vec2(dist, dist) * 4., angle)).rgb;
color.rgb /= 9.;
return color;
}

View file

@ -0,0 +1,101 @@
#ifndef VFEZ_UTILS
#include "vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
group_uniforms outline;
uniform vec3 outline_color: source_color;
uniform float outline_alpha: hint_range(0.0, 1.0) = 1.0;
uniform float outline_glow: hint_range(1., 100, 1.) = 1.0;
uniform float outline_width;
uniform bool only_render_outline;
group_uniforms;
group_uniforms outline.pixel_perfect;
uniform bool use_pixel_perfect_outline;
uniform int outline_pixel_width;
group_uniforms;
group_uniforms outline.texture;
uniform bool use_outline_texture;
uniform sampler2D outline_texture;
uniform vec2 outline_texture_scale = vec2(1.);
uniform vec2 outline_texture_offset = vec2(0.);
uniform vec2 outline_texture_scroll_speed = vec2(0.);
group_uniforms;
group_uniforms outline.distortion;
uniform bool use_outline_distortion;
uniform sampler2D outline_distortion_texture;
uniform vec2 outline_distortion_texture_scale = vec2(1.);
uniform vec2 outline_distortion_texture_offset = vec2(0.);
uniform vec2 outline_distortion_texture_scroll_speed = vec2(0.);
uniform float outline_distortion_amount;
group_uniforms;
vec4 outline(vec4 color, vec2 texture_pixel_size, vec2 uv, sampler2D tex)
{
float base_tex_a = texture(tex, uv).a;;
vec2 destUV;
if (use_pixel_perfect_outline)
{
destUV = texture_pixel_size * float(outline_pixel_width);
}
else
{
destUV = texture_pixel_size * float(outline_width) * 200.;
}
if (use_outline_distortion)
{
vec2 outlineDistUV = transform_uv(
uv,
outline_distortion_texture_scale,
outline_distortion_texture_offset,
true);
destUV = uv_distortion(destUV, outline_distortion_texture, outlineDistUV,
outline_distortion_amount, outline_distortion_texture_scroll_speed, true);;
}
float left = texture(tex, uv + vec2(destUV.x, 0.)).a;
float right = texture(tex, uv - vec2(destUV.x, 0.)).a;
float bottom = texture(tex, uv + vec2(0., destUV.y)).a;
float top = texture(tex, uv - vec2(0., destUV.y)).a;
float result = left + right + bottom + top;
result = step(0.05, clamp(result, 0., 1.));
vec4 final_outline_color = vec4(outline_color, 1.0);
if (use_outline_texture)
{
vec2 outlineTexUV = transform_uv(
uv,
outline_texture_scale,
outline_texture_offset,
true);
outlineTexUV += mod(TIME * outline_texture_scroll_speed,vec2(1.));
outlineTexUV = fract(outlineTexUV);
final_outline_color *= texture(outline_texture, outlineTexUV);
}
result *= (1. - color.a) * outline_alpha;
vec4 outline = final_outline_color;
outline.rgb *= outline_glow;
outline.a = result;
if (only_render_outline)
{
color = outline;
}
else
{
color = mix(color, outline, result);
}
return color;
}

View file

@ -0,0 +1,40 @@
group_uniforms outline_inner;
uniform bool only_render_inner_outline;
uniform vec3 outline_inner_color: source_color;
uniform float outline_inner_thickness: hint_range(0., 5.) = 1.;
uniform float outline_inner_alpha: hint_range(0., 1.) = 1.;
uniform float ouline_inner_glow: hint_range(1., 10.) = 1.;
group_uniforms;
vec3 get_pixel(float offsetX, float offsetY, vec2 uv, sampler2D tex, vec2 texture_pixel_size)
{
return texture(tex, (uv + vec2(offsetX * texture_pixel_size.x, offsetY * texture_pixel_size.y))).rgb;
}
vec4 outline_inner(vec4 color, vec2 texture_pixel_size, vec2 uv, sampler2D tex)
{
vec3 innerT = abs(
get_pixel(0., outline_inner_thickness, uv, tex, texture_pixel_size) -
get_pixel(0., - outline_inner_thickness, uv, tex, texture_pixel_size)
);
innerT += abs(
get_pixel(outline_inner_thickness, 0., uv, tex, texture_pixel_size) -
get_pixel(-outline_inner_thickness, 0., uv, tex, texture_pixel_size)
);
if (only_render_inner_outline)
{
innerT *= color.a * outline_inner_alpha;
color.rgb = length(innerT) * outline_inner_color * ouline_inner_glow;
color.a = step(0.3, color.r + color.g + color.b);
}
else
{
innerT = innerT / 2.0 * color.a * outline_inner_alpha;
color.rgb += length(innerT) * outline_inner_color * ouline_inner_glow;
}
return color;
}

View file

@ -0,0 +1,21 @@
group_uniforms particle.particle_anim;
uniform int particles_anim_h_frames : hint_range(1, 128) = 1;
uniform int particles_anim_v_frames : hint_range(1, 128) = 1;
uniform bool particles_anim_loop;
group_uniforms;
vec2 particle_anim(float instance_custom_z, vec2 uv)
{
float h_frames = float(particles_anim_h_frames);
float v_frames = float(particles_anim_v_frames);
float particle_total_frames = float(particles_anim_h_frames * particles_anim_v_frames);
float particle_frame = floor(instance_custom_z * float(particle_total_frames));
if (!particles_anim_loop) {
particle_frame = clamp(particle_frame, 0.0, particle_total_frames - 1.0);
} else {
particle_frame = mod(particle_frame, particle_total_frames);
}
uv /= vec2(h_frames, v_frames);
uv += vec2(mod(particle_frame, h_frames) / h_frames, floor((particle_frame + 0.5) / h_frames) / v_frames);
return uv;
}

View file

@ -0,0 +1,96 @@
// helper functions ------------------------------------------
vec2 transform_uv(vec2 uv, vec2 scale, vec2 offset, bool fract_result)
{
uv = uv * scale + offset;
if (fract_result)
uv = fract(uv);
return uv;
}
vec2 uv_distortion(
vec2 uv,
sampler2D distortion_texture,
vec2 distortion_uv,
float distortion_amount,
vec2 distortion_speed,
bool fract_result)
{
distortion_uv += mod(TIME * distortion_speed, vec2(1.));
if (fract_result)
{
distortion_uv = fract(distortion_uv);
}
float distortAmount =
(texture(distortion_texture, distortion_uv).r - 0.5) * 0.2 * distortion_amount;
uv += vec2(1.) * distortAmount;
return uv;
}
vec2 uv_polar(vec2 uv, vec2 center)
{
vec2 dir = uv - center;
float radius = length(dir) * 2.;
float angle = atan(dir.y, dir.x) / (2. * PI);
vec2 polarUV = vec2(angle, radius);
//baseUV = mod(vec2(radius, angle), 1.0);
return polarUV;
}
vec2 rotate_vec2(vec2 vector, float angle)
{
float cosAngle = cos(angle);
float sinAngle = sin(angle);
vector = mat2(vec2(cosAngle, -sinAngle), vec2(sinAngle, cosAngle)) * vector;
return vector;
}
vec2 rotate_uvs(vec2 uv, float rotation, vec2 scale, vec2 offset)
{
vec2 center = vec2(0.5 * scale.x + offset.x, 0.5 * scale.y + offset.y);
uv -= center;
uv = rotate_vec2(uv, rotation);
uv += center;
return uv;
}
vec4 sample_texture_with_scroll(sampler2D tex, vec2 uv, vec2 scroll_speed, float time)
{
uv.x += mod(time * scroll_speed.x, 1);
uv.y += mod(time * scroll_speed.y, 1);
if (scroll_speed != vec2(0.))
uv = fract(uv);
return texture(tex, uv);
}
float rand(vec2 seed, float offset) {
return mod(fract(sin(dot(seed, vec2(12.9898, 78.233))) * 43758.5453) + offset, 1.0);
}
float rand_uncapped(vec2 seed, float offset) {
return fract(sin(dot(seed, vec2(12.9898, 78.233))) * 43758.5453) + offset;
}
float rand2(vec2 seed, float offset, float time) {
return mod(
fract(
sin(
dot(seed * floor(50. + mod(time, 1.0) * 12.), vec2(127.1, 311.7))
) * 43758.5453123
) + offset, 1.0);
}
float remap_float(float inValue, float inMin, float inMax, float outMin, float outMax){
return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin);
}
float ease_out_quint(float x) {
return 1. - pow(1. - x, 5.);
}
float get_color_luminance(vec4 color)
{
float luminance = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;
luminance *= color.a;
return luminance;
}

View file

@ -0,0 +1,18 @@
group_uniforms uv_fisheye;
uniform float uv_fisheye_center_x: hint_range(0.0, 1.0) = 0.5;
uniform float uv_fisheye_center_y: hint_range(0.0, 1.0) = 0.5;
uniform float uv_fisheye_amount = 0.1;
group_uniforms;
vec2 uv_fisheye(vec2 uv, vec2 main_texture_scale)
{
vec2 center = vec2(uv_fisheye_center_x * main_texture_scale.x,
uv_fisheye_center_y * main_texture_scale.y);
float bind = length(center);
vec2 dF = uv - center;
float dFlen = length(dF);
float fishInt = (PI / bind) * (uv_fisheye_amount + 0.001);
uv = center + (dF / max(0.0001, dFlen)) * tan(dFlen * fishInt) * bind / tan(bind * fishInt);
return uv;
}

View file

@ -0,0 +1,15 @@
group_uniforms uv_handrawn;
uniform float uv_handrawn_amount: hint_range(0.0, 40.0) = 10.;
uniform float uv_handrawn_speed: hint_range(0.0, 30.0) = 5.;
group_uniforms;
vec2 uv_handrawn(vec2 uv)
{
vec2 handrawnUV = uv;
float handrawn_speed =
floor(TIME * 20. * uv_handrawn_speed);
handrawnUV.x = sin((handrawnUV.x * uv_handrawn_amount + handrawn_speed / 2.) * 4.);
handrawnUV.y = sin((handrawnUV.y * uv_handrawn_amount + handrawn_speed / 2.) * 4.);
uv = mix(uv, uv + handrawnUV, 0.0005 * uv_handrawn_amount);
return uv;
}

View file

@ -0,0 +1,16 @@
group_uniforms uv_pinch;
uniform float uv_pinch_center_x: hint_range(0.0, 1.0) = 0.5;
uniform float uv_pinch_center_y: hint_range(0.0, 1.0) = 0.5;
uniform float uv_pinch_amount;
group_uniforms;
vec2 uv_pinch(vec2 uv, vec2 main_texture_scale)
{
vec2 center = vec2(uv_pinch_center_x * main_texture_scale.x,
uv_pinch_center_y * main_texture_scale.y);
vec2 dP = uv - center;
float pinchInt = (PI / length(center)) * (-uv_pinch_amount + 0.001);
uv = center + normalize(dP) * atan(-length(dP) * pinchInt * 10.0)
* 0.5 / atan(-pinchInt * 5.);
return uv;
}

View file

@ -0,0 +1,11 @@
group_uniforms uv_pixelate;
uniform int uv_pixelate_size: hint_range(4, 512) = 32;
group_uniforms;
vec2 uv_pixelate(vec2 uv, vec2 viewport_size)
{
float aspect_ratio = viewport_size.x / viewport_size.y;
vec2 pixel_size = vec2(float(uv_pixelate_size), float(uv_pixelate_size) * aspect_ratio);
uv = floor(uv * pixel_size) / pixel_size;
return uv;
}

View file

@ -0,0 +1,18 @@
group_uniforms uv_round_wave;
uniform float uv_round_wave_strength: hint_range(0.0, 1.0) = 0.7;
uniform float uv_round_wave_speed: hint_range(0.0, 5.0) = 2.;
group_uniforms;
vec2 uv_round_wave(
vec2 uv,
vec2 main_texture_size,
vec2 main_texture_scale)
{
float round_wave_x = 0.5 * main_texture_scale.x - uv.x;
float round_wave_y = (0.5 * main_texture_scale.y - uv.y) *
main_texture_size.y / main_texture_size.x;
float ripple = -sqrt(round_wave_x * round_wave_x + round_wave_y * round_wave_y);
uv += mod(sin((ripple + TIME * (uv_round_wave_speed/10.0)) / 0.015)
* (uv_round_wave_strength /10.0), 1.0);
return uv;
}

View file

@ -0,0 +1,14 @@
group_uniforms uv_shake;
uniform float uv_shake_speed: hint_range(0.0, 50.0) = 20.;
uniform float uv_shake_x: hint_range(-15., 15) = 5;
uniform float uv_shake_y: hint_range(-15., 15) = 4;
group_uniforms;
vec2 uv_shake(
vec2 uv)
{
float x_shake = sin(TIME * uv_shake_speed * 50.) * uv_shake_x;
float y_shake = cos(TIME * uv_shake_speed * 50.) * uv_shake_y;
uv += vec2(x_shake * 0.012, y_shake * 0.01);
return uv;
}

View file

@ -0,0 +1,26 @@
group_uniforms uv_twist;
uniform float uv_twist_amount: hint_range(0.0, 3.1415) = 1.;
uniform float uv_twist_pos_x: hint_range(0.0, 1.0) = 0.5;
uniform float uv_twist_pos_y: hint_range(0.0, 1.0) = 0.5;
uniform float uv_twist_radius: hint_range(0.0, 3.0) = 0.75;
group_uniforms;
vec2 uv_twist(
vec2 uv,
vec2 main_texture_scale)
{
vec2 twistUV = uv - vec2(uv_twist_pos_x * main_texture_scale.x,
uv_twist_pos_y * main_texture_scale.y);
float twist_radius = uv_twist_radius *
(main_texture_scale.x + main_texture_scale.y) / 2.;
float percent = (twist_radius - length(twistUV)) / twist_radius;
float theta = percent * percent * (2.0 * sin(uv_twist_amount)) * 8.0;
float s = sin(theta);
float c = cos(theta);
float beta = max(sign(twist_radius - length(twistUV)), 0.);
twistUV = vec2(dot(twistUV, vec2(c, -s)), dot(twistUV, vec2(s, c))) * beta + twistUV * (1. - beta);
twistUV += vec2(uv_twist_pos_x * main_texture_scale.x,
uv_twist_pos_y * main_texture_scale.y);
uv = twistUV;
return uv;
}

View file

@ -0,0 +1,22 @@
group_uniforms uv_wave;
uniform float uv_wave_amount: hint_range(0.0, 25.0) = 7.;
uniform float uv_wave_speed: hint_range(0.0, 25.0) = 10.;
uniform float uv_wave_strength: hint_range(0.0, 25.0) = 7.5;
uniform float uv_wave_x: hint_range(0.0, 1.0) = 0.;
uniform float uv_wave_y: hint_range(0.0, 1.0) = 0.5;
group_uniforms;
vec2 uv_wave(
vec2 uv,
vec2 viewport_size,
vec2 main_texture_scale)
{
vec2 waveUV = vec2(uv_wave_x * main_texture_scale.x,
uv_wave_y * main_texture_scale.y) - uv;
waveUV.x *= viewport_size.x / viewport_size.y;
float ang_wave =
(sqrt(dot(waveUV, waveUV)) * uv_wave_amount)
- mod(TIME * uv_wave_speed, 360.0);
uv = uv + normalize(waveUV) * sin(ang_wave) * (uv_wave_strength / 1000.);
return uv;
}

View file

@ -0,0 +1,31 @@
group_uniforms uv_wind;
uniform float uv_wind_speed: hint_range(0., 50.) = 2.;
uniform float uv_wind_amount: hint_range(0, 50) = 20;
uniform float uv_wind_vertical_ratio: hint_range(0.0, 1.0) = 1.;
uniform vec2 uv_radial_bend_center = vec2(0.5, 0.9);
uniform bool uv_wind_animate_manual;
uniform float uv_wind_manual_anim: hint_range(-1, 1) = 1;
uniform float uv_wind_radial_bend: hint_range(0.0, 5.0) = 0.1;
group_uniforms;
vec2 uv_wind(vec2 uv)
{
float wind_offset;
if (uv_wind_animate_manual)
{
wind_offset = uv_wind_manual_anim;
}
else
{
wind_offset = sin(TIME * uv_wind_speed * 10.);
}
uv.x = mix(uv.x, uv.x + uv_wind_amount * 0.01 * wind_offset,
abs(uv_wind_vertical_ratio - uv.y));
vec2 delta = uv - uv_radial_bend_center;
float delta2 = dot(delta, delta);
float delta_offset = delta2 * wind_offset;
uv = uv + vec2(delta.y, - delta.x) * delta_offset * uv_wind_radial_bend;
return uv;
}

View file

@ -0,0 +1,15 @@
group_uniforms uv_wrap;
uniform float uv_wrap_strength: hint_range(0.0, 0.1) = 0.025;
uniform float uv_wrap_speed: hint_range(0.0, 25.) = 8;
uniform float uv_wrap_scale: hint_range(0.05, 3.) = 0.5;
group_uniforms;
vec2 uv_wrap(vec2 uv, vec2 main_texture_scale)
{
vec2 norm_uv = uv / main_texture_scale;
float x_wrap = TIME * uv_wrap_speed + norm_uv.x * TAU / uv_wrap_scale;
float y_wrap = TIME * uv_wrap_speed + norm_uv.y * TAU / uv_wrap_scale;
vec2 wrap = vec2(sin(x_wrap), cos(y_wrap)) * uv_wrap_strength;
uv += wrap;
return uv;
}

View file

@ -0,0 +1,13 @@
group_uniforms uv_zoom;
uniform vec2 uv_zoom_center = vec2(0.5);
uniform float uv_zoom_amount: hint_range(0.1, 5.) = 0.5;
group_uniforms;
vec2 uv_zoom(vec2 uv, vec2 main_texture_scale)
{
vec2 norm_center = uv_zoom_center / main_texture_scale;
uv -= norm_center;
uv = uv * uv_zoom_amount;
uv += norm_center;
return uv;
}

View file

@ -0,0 +1,18 @@
group_uniforms vertex_expand;
uniform vec3 vertex_expand_center = vec3(0.);
uniform bool vertex_expand_ignore_center_vertical = false;
uniform float vertex_expand_amount: hint_range(0.0, 10.) = 0.5;
group_uniforms;
vec3 vertex_expand(
vec3 vertex)
{
vec3 final_expand_center = vertex_expand_center;
if (vertex_expand_ignore_center_vertical)
{
final_expand_center.z = vertex.z;
}
vec3 expand_dir = normalize(vertex - final_expand_center);
vertex += expand_dir * vertex_expand_amount;
return vertex;
}

View file

@ -0,0 +1,18 @@
group_uniforms vertex_offset;
uniform sampler2D vertex_offset_texture: source_color;
uniform float vertex_offset_amount: hint_range(0.0, 2.) = 0.5;
uniform float vertex_offset_power: hint_range(0.01, 10.) = 1.;
uniform vec2 vertex_offset_speed;
group_uniforms;
vec3 vertex_offset(
vec3 vertex,
vec3 normal,
vec2 uv)
{
vec2 offsetUV = uv;
offsetUV += mod(TIME * vertex_offset_speed, 1.0);
float offset = textureLod(vertex_offset_texture, offsetUV, 0.).r;
vertex = vertex + normal * vertex_offset_amount * pow(offset, vertex_offset_power);
return vertex;
}

View file

@ -0,0 +1,64 @@
// this code servers as an example VFEZ2D shader
// that uses the VFEZ2D template. Files like this are
// automatically generated using the VFEZMaterial but you
// can also create them manually like the example below.
shader_type canvas_item;
#define BLEND_MIX
//#define BLEND_ADD
//#define BLEND_SUB
//#define BLEND_MUL
//#define BLEND_PREMUL_ALPHA
// #define UNSHADED
// #define LIGHT_ONLY
#define UV_POLAR
#define UV_DISTORTION
#define UV_ROTATION
#define UV_PIXELATE
#define UV_TWIST
#define UV_FISHEYE
#define UV_PINCH
#define UV_HANDRAWN
#define UV_SHAKE
#define UV_WAVE
#define UV_ROUND_WAVE
#define UV_WIND
#define UV_WRAP
#define UV_ZOOM
#define COLOR_SINGLE
#define COLOR_OVERLAY_TEXTURE
#define OUTLINE
#define OUTLINE_INNER
#define ALPHA_DISOLVE
#define CHROMATIC_ABERRATION
#define MOTION_BLUR
#define GLITCH
#define COLOR_GRADIENT
#define COLOR_RADIAL_GRADIENT
#define COLOR_TONING
#define COLOR_RAMP
#define COLOR_CHANGE
#define COLOR_GHOST
#define COLOR_HOLOGRAM
#define COLOR_POSTERIZE
#define COLOR_NEGATIVE
#define COLOR_GLOW
#define COLOR_HSV_SHIFT
#define COLOR_SHADOW
#define COLOR_GREYSCALE
#define ALPHA_MASK
#define ALPHA_REMAP
#define ALPHA_CUTOFF
#define ALPHA_CLIP
#define ALPHA_RADIAL_CLIP
#define ALPHA_FLICKER
#define PARTICLE_ANIM
#include "vfez_2d_template.gdshaderinc"

View file

@ -0,0 +1,753 @@
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// THE CODE BELOW IS NOT INTENDED TO BE CHANGED MANUALLY.
// MANUAL CHANGES MIGHT CAUSE THE VFEZ MATERIAL TO WORK INCORRECTLY.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// shader code starts here -----------------------------------------------
#include "Effects/vfez_utils.gdshaderinc"
#if defined(UNSHADED)
render_mode unshaded;
#elif defined(LIGHT_ONLY)
render_mode light_only;
#endif
#if defined(BLEND_MIX)
render_mode blend_mix;
#elif defined(BLEND_ADD)
render_mode blend_add;
#elif defined(BLEND_SUB)
render_mode blend_sub;
#elif defined(BLEND_MUL)
render_mode blend_mul;
#elif defined(BLEND_PREMUL_ALPHA)
render_mode blend_premul_alpha;
#endif
group_uniforms base;
uniform vec2 texture_scale = vec2(1.);
uniform vec2 texture_offset = vec2(0.);
uniform vec2 texture_scroll_speed = vec2(0.);
uniform bool replicate_on_scale = true;
uniform vec4 texture_color: source_color = vec4(1.);
uniform float texture_alpha: hint_range(0.0, 1.0) = 1.;
uniform bool texture_red_as_alpha = false;
uniform bool premultiply_color = false;
uniform bool premultiply_alpha = false;
uniform float contrast: hint_range(0.0, 10) = 1.;
uniform float brightness: hint_range(-1., 1.) = 0.;
group_uniforms;
group_uniforms rect_size;
uniform float rect_size_ratio: hint_range(1.0, 5.0) = 1.0;
group_uniforms;
group_uniforms uv_polar;
uniform bool use_uv_polar = false;
#if defined(UV_POLAR)
uniform vec2 uv_polar_center = vec2(0.5);
uniform bool distortion_uses_uv_polar = false;
#endif
group_uniforms;
group_uniforms uv_distortion;
uniform bool use_uv_distortion;
#if defined(UV_DISTORTION)
uniform sampler2D distortion_tex: source_color;
uniform vec2 distortion_tex_scale = vec2(1.);
uniform vec2 distortion_tex_offset = vec2(0.);
uniform float distortion_amount: hint_range(0.0, 10) = 0.0;
uniform vec2 distortion_speed = vec2(0.1);
#endif
group_uniforms;
group_uniforms uv_rotation;
uniform bool use_uv_rotation;
#if defined(UV_ROTATION)
uniform float uv_rotation_offset: hint_range(0.0, 6.28318530718) = 0.;
uniform float uv_rotation_speed = 0.;
#endif
group_uniforms;
group_uniforms uv_pixelate;
uniform bool use_uv_pixelate = false;
group_uniforms;
#if defined(UV_PIXELATE)
#include "Effects/vfez_uv_pixelate.gdshaderinc"
#endif
group_uniforms uv_twist;
uniform bool use_uv_twist = false;
group_uniforms;
#if defined(UV_TWIST)
#include "Effects/vfez_uv_twist.gdshaderinc"
#endif
group_uniforms uv_fisheye;
uniform bool use_uv_fisheye;
group_uniforms;
#if defined(UV_FISHEYE)
#include "Effects/vfez_uv_fisheye.gdshaderinc"
#endif
group_uniforms uv_pinch;
uniform bool use_uv_pinch;
group_uniforms;
#if defined(UV_PINCH)
#include "Effects/vfez_uv_pinch.gdshaderinc"
#endif
group_uniforms uv_handrawn;
uniform bool use_uv_handrawn = false;
group_uniforms;
#if defined(UV_HANDRAWN)
#include "Effects/vfez_uv_handrawn.gdshaderinc"
#endif
group_uniforms uv_shake;
uniform bool use_uv_shake = false;
group_uniforms;
#if defined(UV_SHAKE)
#include "Effects/vfez_uv_shake.gdshaderinc"
#endif
group_uniforms uv_wave;
uniform bool use_uv_wave = false;
group_uniforms;
#if defined(UV_WAVE)
#include "Effects/vfez_uv_wave.gdshaderinc"
#endif
group_uniforms uv_round_wave;
uniform bool use_uv_round_wave = false;
group_uniforms;
#if defined(UV_ROUND_WAVE)
#include "Effects/vfez_uv_round_wave.gdshaderinc"
#endif
group_uniforms uv_wind;
uniform bool use_uv_wind = false;
group_uniforms;
#if defined(UV_WIND)
#include "Effects/vfez_uv_wind.gdshaderinc"
#endif
group_uniforms uv_wrap;
uniform bool use_uv_wrap = false;
group_uniforms;
#if defined(UV_WRAP)
#include "Effects/vfez_uv_wrap.gdshaderinc"
#endif
group_uniforms uv_zoom;
uniform bool use_uv_zoom = false;
group_uniforms;
#if defined(UV_ZOOM)
#include "Effects/vfez_uv_zoom.gdshaderinc"
#endif
group_uniforms color_single;
uniform bool use_color_single;
group_uniforms;
#if defined(COLOR_SINGLE)
#include "Effects/vfez_color_single.gdshaderinc"
#endif
group_uniforms color_overlay_texture;
uniform bool use_color_overlay_texture;
group_uniforms;
#if defined(COLOR_OVERLAY_TEXTURE)
#include "Effects/vfez_color_overlay_texture.gdshaderinc"
#endif
group_uniforms outline;
uniform bool use_outline;
group_uniforms;
#if defined(OUTLINE)
#include "Effects/vfez_outline.gdshaderinc"
#endif
group_uniforms outline_inner;
uniform bool use_outline_inner;
group_uniforms;
#if defined(OUTLINE_INNER)
#include "Effects/vfez_outline_inner.gdshaderinc"
#endif
group_uniforms alpha_disolve;
uniform bool use_alpha_disolve = false;
group_uniforms;
#if defined(ALPHA_DISOLVE)
#include "Effects/vfez_alpha_disolve.gdshaderinc"
#endif
group_uniforms chromatic_aberration;
uniform bool use_chromatic_aberration;
group_uniforms;
#if defined(CHROMATIC_ABERRATION)
#include "Effects/vfez_chromatic_aberration.gdshaderinc"
#endif
group_uniforms motion_blur;
uniform bool use_motion_blur = false;
group_uniforms;
#if defined(MOTION_BLUR)
#include "Effects/vfez_motion_blur.gdshaderinc"
#endif
group_uniforms glitch;
uniform bool use_glitch = false;
group_uniforms;
#if defined(GLITCH)
#include "Effects/vfez_glitch.gdshaderinc"
#endif
group_uniforms color_gradient;
uniform bool use_color_gradient = false;
group_uniforms;
#if defined(COLOR_GRADIENT)
#include "Effects/vfez_color_gradient.gdshaderinc"
#endif
group_uniforms color_radial_gradient;
uniform bool use_color_radial_gradient = false;
group_uniforms;
#if defined(COLOR_RADIAL_GRADIENT)
#include "Effects/vfez_color_radial_gradient.gdshaderinc"
#endif
group_uniforms color_toning;
uniform bool use_color_toning = false;
group_uniforms;
#if defined(COLOR_TONING)
#include "Effects/vfez_color_toning.gdshaderinc"
#endif
group_uniforms color_ramp;
uniform bool use_color_ramp = false;
group_uniforms;
#if defined(COLOR_RAMP)
#include "Effects/vfez_color_ramp.gdshaderinc"
#endif
group_uniforms color_change;
uniform bool use_color_change = false;
group_uniforms;
#if defined(COLOR_CHANGE)
#include "Effects/vfez_color_change.gdshaderinc"
#endif
group_uniforms color_ghost;
uniform bool use_color_ghost = false;
group_uniforms;
#if defined(COLOR_GHOST)
#include "Effects/vfez_color_ghost.gdshaderinc"
#endif
group_uniforms color_hologram;
uniform bool use_color_hologram = false;
group_uniforms;
#if defined(COLOR_HOLOGRAM)
#include "Effects/vfez_color_hologram.gdshaderinc"
#endif
group_uniforms color_posterize;
uniform bool use_color_posterize = false;
group_uniforms;
#if defined(COLOR_POSTERIZE)
#include "Effects/vfez_color_posterize.gdshaderinc"
#endif
group_uniforms color_negative;
uniform bool use_color_negative;
group_uniforms;
#if defined(COLOR_NEGATIVE)
#include "Effects/vfez_color_negative.gdshaderinc"
#endif
group_uniforms color_glow;
uniform bool use_color_glow = false;
group_uniforms;
#if defined(COLOR_GLOW)
#include "Effects/vfez_color_glow.gdshaderinc"
#endif
group_uniforms color_hsv_shift;
uniform bool use_color_hsv_shift = false;
group_uniforms;
#if defined(COLOR_HSV_SHIFT)
#include "Effects/vfez_hsv_shift.gdshaderinc"
#endif
group_uniforms color_shadow;
uniform bool use_color_shadow = false;
group_uniforms;
#if defined(COLOR_SHADOW)
#include "Effects/vfez_color_shadow.gdshaderinc"
#endif
group_uniforms color_greyscale;
uniform bool use_color_greyscale= false;
group_uniforms;
#if defined(COLOR_GREYSCALE)
#include "Effects/vfez_color_greyscale.gdshaderinc"
#endif
group_uniforms color_shine;
uniform bool use_color_shine= false;
group_uniforms;
#if defined(COLOR_SHINE)
#include "Effects/vfez_color_shine.gdshaderinc"
#endif
group_uniforms alpha_mask;
uniform bool use_alpha_mask = false;
group_uniforms;
#if defined(ALPHA_MASK)
#include "Effects/vfez_alpha_mask.gdshaderinc"
#endif
group_uniforms alpha_remap;
uniform bool use_alpha_remap = false;
group_uniforms alpha_remap;
#if defined(ALPHA_REMAP)
#include "Effects/vfez_alpha_remap.gdshaderinc"
#endif
group_uniforms alpha_cutoff;
uniform bool use_alpha_cutoff = false;
group_uniforms;
#if defined(ALPHA_CUTOFF)
#include "Effects/vfez_alpha_cutoff.gdshaderinc"
#endif
group_uniforms alpha_clip;
uniform bool use_alpha_clip = false;
group_uniforms;
#if defined(ALPHA_CLIP)
#include "Effects/vfez_alpha_clip.gdshaderinc"
#endif
group_uniforms alpha_radial_clip;
uniform bool use_alpha_radial_clip = false;
group_uniforms;
#if defined(ALPHA_RADIAL_CLIP)
#include "Effects/vfez_alpha_radial_clip.gdshaderinc"
#endif
group_uniforms alpha_flicker;
uniform bool use_alpha_flicker = false;
group_uniforms;
#if defined(ALPHA_FLICKER)
#include "Effects/vfez_alpha_flicker.gdshaderinc"
#endif
group_uniforms particle.particle_anim;
uniform bool use_particle_anim = false;
group_uniforms;
#if defined(PARTICLE_ANIM)
#include "Effects/vfez_particle_anim.gdshaderinc"
#endif
void vertex() {
#if defined(PARTICLE_ANIM)
if (use_particle_anim)
{
UV = particle_anim(INSTANCE_CUSTOM.z, UV);
}
#endif
VERTEX += VERTEX * (rect_size_ratio - 1.0);
}
void fragment() {
vec2 startUV = UV * rect_size_ratio + vec2(-rect_size_ratio * 0.5 + 0.5);
vec2 baseUV = startUV;
#if defined(UV_POLAR)
if (use_uv_polar)
{
baseUV = uv_polar(baseUV, uv_polar_center);
}
#endif
baseUV = transform_uv(
baseUV,
texture_scale,
texture_offset,
replicate_on_scale);
#if defined(UV_DISTORTION)
if (use_uv_distortion && distortion_amount > 0.)
{
vec2 distortionUV = startUV;
distortionUV = transform_uv(
distortionUV,
distortion_tex_scale,
distortion_tex_offset,
true);
#if defined(UV_POLAR)
if (use_uv_polar && distortion_uses_uv_polar)
{
distortionUV = uv_polar(distortionUV, uv_polar_center);
}
#endif
baseUV = uv_distortion(baseUV, distortion_tex, distortionUV, distortion_amount, distortion_speed, true);
}
#endif
#if defined(UV_ROTATION)
if (use_uv_rotation)
{
baseUV = rotate_uvs(
baseUV,
uv_rotation_offset + mod(uv_rotation_speed * TIME, TAU),
texture_scale,
texture_offset);
}
#endif
#if defined(UV_PIXELATE)
if (use_uv_pixelate)
{
vec2 texture_size = 1. / TEXTURE_PIXEL_SIZE;
baseUV = uv_pixelate(baseUV, texture_size);
}
#endif
#if defined(UV_TWIST)
if (use_uv_twist)
{
baseUV = uv_twist(baseUV, texture_scale);
}
#endif
#if defined (UV_FISHEYE)
if (use_uv_fisheye)
{
baseUV = uv_fisheye(baseUV, texture_scale);
}
#endif
#if defined(UV_PINCH)
if (use_uv_pinch)
{
baseUV = uv_pinch(baseUV, texture_scale);
}
#endif
#if defined(UV_HANDRAWN)
if (use_uv_handrawn)
{
baseUV = uv_handrawn(baseUV);
}
#endif
#if defined(UV_SHAKE)
if (use_uv_shake)
{
baseUV = uv_shake(baseUV);
}
#endif
#if defined(UV_WAVE)
if (use_uv_wave)
{
vec2 texture_size = 1. / TEXTURE_PIXEL_SIZE;
baseUV = uv_wave(baseUV, texture_size, texture_scale);
}
#endif
#if defined(UV_ROUND_WAVE)
if (use_uv_round_wave)
{
vec2 main_tex_size = vec2(textureSize(TEXTURE, 0));
baseUV = uv_round_wave(baseUV, main_tex_size, texture_scale);
}
#endif
#if defined(UV_WIND)
if (use_uv_wind)
{
baseUV = uv_wind(baseUV);
}
#endif
#if defined(UV_WRAP)
if (use_uv_wrap)
{
baseUV = uv_wrap(baseUV, texture_scale);
}
#endif
#if defined(UV_ZOOM)
if (use_uv_zoom)
{
baseUV = uv_zoom(baseUV, texture_scale);
}
#endif
vec4 color = sample_texture_with_scroll(
TEXTURE,
baseUV,
texture_scroll_speed,
TIME);
if (texture_red_as_alpha)
{
color = vec4(texture_color.rgb * color.rgb, color.r);
}
else
{
color *= texture_color;
}
bool apply_contrast = contrast != 1. || brightness != 0.;
if (apply_contrast)
{
if (texture_red_as_alpha)
{
color.a = clamp(
(color.a - 0.5) * contrast + 0.5 + brightness,
0.,
1.);
}
else
{
color.rgb = vec3(
max(0, (color.r - 0.5) * contrast + 0.5 + brightness),
max(0, (color.g - 0.5) * contrast + 0.5 + brightness),
max(0, (color.b - 0.5) * contrast + 0.5 + brightness)
);
}
}
// ----------------------------------------------
// apply premultiply color
if (premultiply_color)
{
float luminance = get_color_luminance(color);
color.a = min(luminance, color.a);
}
/// apply premultiply alpha
if (premultiply_alpha)
{
color.rgb *= color.a;
}
#if defined(COLOR_SINGLE)
if (use_color_single)
{
color.rgb = color_single(color.rgb);
}
#endif
#if defined(COLOR_OVERLAY_TEXTURE)
if (use_color_overlay_texture)
{
color = color_overlay_texture(color, baseUV);
}
#endif
#if defined(OUTLINE)
if (use_outline)
{
color = outline(color, TEXTURE_PIXEL_SIZE, baseUV, TEXTURE);
}
#endif
#if defined(OUTLINE_INNER)
if (use_outline_inner)
{
color = outline_inner(color, TEXTURE_PIXEL_SIZE, baseUV, TEXTURE);
}
#endif
#if defined(ALPHA_DISOLVE)
if (use_alpha_disolve)
{
color = alpha_disolve(color, color.a, COLOR.a, baseUV, false);
}
#endif
#if defined(CHROMATIC_ABERRATION)
if (use_chromatic_aberration)
{
color = chromatic_aberration(color, baseUV, TEXTURE);
}
#endif
#if defined(MOTION_BLUR)
if (use_motion_blur)
{
color.rgb = motion_blur(color.rgb, baseUV, TEXTURE);
}
#endif
#if defined(GLITCH)
if (use_glitch)
{
color.rgb = glitch(color.rgb, baseUV, TEXTURE);
}
#endif
#if defined(COLOR_GRADIENT)
if (use_color_gradient)
{
color.rgba = color_gradient(color, baseUV, texture_scale);
}
#endif
#if defined(COLOR_RADIAL_GRADIENT)
if (use_color_radial_gradient)
{
vec2 main_tex_size = vec2(textureSize(TEXTURE, 0));
color.rgba = color_radial_gradient(color, baseUV, texture_scale, main_tex_size);
}
#endif
// apply color grading if defined
#if defined(COLOR_TONING)
if (use_color_toning)
{
color.rgb = color_toning(color);
}
#endif
// apply color ramp if defined
#if defined(COLOR_RAMP)
if (use_color_ramp)
{
color = color_ramp(color);
}
#endif
#if defined(COLOR_CHANGE)
if (use_color_change)
{
color.rgb = color_change(color.rgb);
}
#endif
#if defined(COLOR_GHOST)
if (use_color_ghost)
{
color = color_ghost(color);
}
#endif
#if defined(COLOR_HOLOGRAM)
if (use_color_hologram)
{
color = color_hologram(color, baseUV);
}
#endif
#if defined(COLOR_POSTERIZE)
if (use_color_posterize)
{
color.rgb = color_posterize(color.rgb);
}
#endif
#if defined(COLOR_NEGATIVE)
if (use_color_negative)
{
color.rgb = color_negative(color.rgb);
}
#endif
#if defined(COLOR_GLOW)
if (use_color_glow)
{
color.rgb = color_glow(color, baseUV, 1.);
}
#endif
#if defined(COLOR_HSV_SHIFT)
if (use_color_hsv_shift)
{
color.rgb = hsv_shift(color.rgb);
}
#endif
#if defined(COLOR_SHADOW)
if (use_color_shadow)
{
color = shadow(color, TEXTURE, baseUV);
}
#endif
#if defined(COLOR_GREYSCALE)
if (use_color_greyscale)
{
color.rgb = color_greyscale(color.rgb);
}
#endif
#if defined(COLOR_SHINE)
if (use_color_shine)
{
color = color_shine(color, baseUV);
}
#endif
#if defined(ALPHA_MASK)
if (use_alpha_mask)
{
color.a = alpha_mask(color.a, baseUV, true);
}
#endif
#if defined(ALPHA_REMAP)
if (use_alpha_remap)
{
color.a = alpha_remap(color.a);
}
#endif
#if defined(ALPHA_CUTOFF)
if (use_alpha_cutoff)
{
color.a = alpha_cutoff(color.a);
}
#endif
#if defined(ALPHA_CLIP)
if (use_alpha_clip)
{
color.a = alpha_clip(color.a, baseUV, texture_scale);
}
#endif
#if defined(ALPHA_RADIAL_CLIP)
if (use_alpha_radial_clip)
{
color.a = alpha_radial_clip(color.a, baseUV, texture_scale);
}
#endif
#if defined(ALPHA_FLICKER)
if (use_alpha_flicker)
{
color.a = alpha_flicker(color.a);
}
#endif
color.a *= texture_alpha;
// if the following line throws an error thats a godot bug, ignore it.
// Shader works as intented
COLOR = color;
}

View file

@ -0,0 +1,72 @@
// this code servers as an example VFEZ3D shader
// that uses the VFEZ3D template. Files like this are
// automatically generated using the VFEZMaterial but you
// can also create them manually like the example below.
shader_type spatial;
#define BLEND_MIX
//#define BLEND_ADD
//#define BLEND_SUB
//#define BLEND_MUL
//#define BLEND_PREMUL_ALPHA
#define DEPTH_DRAW_OPAQUE
//#define DEPTH_DRAW_ALWAYS
//#define DEPTH_DRAW_NEVER
#define CULL_BACK
//#define CULL_FRONT
//#define CULL_DISABLED
#define DIFFUSE_LAMBERT
//#define DIFFUSE_LABERT_WRAP
//#define DIFFUSE_BURLEY
//#define DIFFUSE_TOON
#define SPECULAR_SCHLICK_GGX
//#define SPECULAR_TOON
//#define SPECULAR_DISABLED
//#define UNSHADED
//#define BILLBOARD_ENABLED
//#define BILLBOARD_Y
//#define BILLBOARD_PARTICLE
//#define BILLBOARD_KEEP_SCALE
//#define NO_DEPTH_TEST
//#define PARTICLE_TRAILS
//#define PARTICLE_ANIM
// enable more shapes to blend more textures
#define SHAPE2
#define SHAPE3
#define UV_PIXELATE
#define UV_TWIST
#define UV_HANDRAWN
#define UV_SHAKE
#define UV_WAVE
#define UV_ROUND_WAVE
#define UV_GLOBAL_DISTORTION
#define ALPHA_DISOLVE
#define COLOR_FACE_TINT
#define COLOR_TONING
#define COLOR_RAMP
#define COLOR_POSTERIZE
#define COLOR_RIM
#define COLOR_GLOW
#define COLOR_HSV_SHIFT
#define ALPHA_MASK
#define ALPHA_REMAP
#define ALPHA_CUTOFF
#define VERTEX_OFFSET
#define VERTEX_EXPAND
#include "vfez_3d_template.gdshaderinc"

View file

@ -0,0 +1,913 @@
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// THE CODE BELOW IS NOT INTENDED TO BE CHANGED MANUALLY.
// MANUAL CHANGES MIGHT CAUSE THE VFEZ MATERIAL TO WORK INCORRECTLY.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// shader code starts here -----------------------------------------------
#ifndef VFEZ_UTILS
#include "Effects/vfez_utils.gdshaderinc"
#define VFEZ_UTILS
#endif
#if defined(UNSHADED)
render_mode unshaded;
#endif
#if defined(BLEND_MIX)
render_mode blend_mix;
#elif defined(BLEND_ADD)
render_mode blend_add;
#elif defined(BLEND_SUB)
render_mode blend_sub;
#elif defined(BLEND_MUL)
render_mode blend_mul;
#elif defined(BLEND_PREMUL_ALPHA)
render_mode blend_premul_alpha;
#endif
#if defined(DEPTH_DRAW_OPAQUE)
render_mode depth_draw_opaque;
#elif defined(DEPTH_DRAW_ALWAYS)
render_mode depth_draw_always;
#elif defined(DEPTH_DRAW_NEVER)
render_mode depth_draw_never;
#endif
#if defined(CULL_BACK)
render_mode cull_back;
#elif defined(CULL_FRONT)
render_mode cull_front;
#elif defined (CULL_DISABLED)
render_mode cull_disabled;
#endif
#if defined(DIFFUSE_LAMBERT)
render_mode diffuse_lambert;
#elif defined(DIFFUSE_LAMBERT_WRAP)
render_mode diffuse_lambert_wrap;
#elif defined(DIFFUSE_BURLEY)
render_mode diffuse_burley;
#elif defined(DIFFUSE_TOON)
render_mode diffuse_toon;
#endif
#if defined(SPECULAR_SCHLICK_GGX)
render_mode specular_schlick_ggx;
#elif defined(SPECULAR_TOON)
render_mode specular_toon;
#elif defined(SPECULAR_DISABLED)
render_mode specular_disabled;
#endif
#if defined(NO_DEPTH_TEST)
render_mode depth_test_disabled;
#endif
#if defined(PARTICLE_TRAILS)
render_mode particle_trails;
#endif
group_uniforms general;
uniform vec3 global_color: source_color = vec3(1.);
uniform float global_alpha: hint_range(0.0, 1.0) = 1.;
uniform bool additive_config = false;
uniform bool premultiply_color = false;
uniform bool premultiply_alpha = false;
group_uniforms;
group_uniforms shape1.shape_texture;
uniform sampler2D shape1_main_texture: source_color, filter_nearest;
uniform vec2 shape1_main_texture_scale = vec2(1.);
uniform vec2 shape1_main_texture_offset = vec2(0.);
uniform vec4 shape1_color: source_color = vec4(1.);
uniform bool shape1_red_as_alpha = false;
uniform vec2 shape1_scroll_speed = vec2(0.);
uniform float shape1_rotation_offset: hint_range(0.0, 6.28318530718) = 0.;
uniform float shape1_rotation_speed = 0.;
group_uniforms;
group_uniforms shape1.contrast_brightness;
uniform float shape1_contrast: hint_range(0.0, 10) = 1.;
uniform float shape1_brightness: hint_range(-1., 1.) = 0.;
group_uniforms;
group_uniforms shape1.distortion;
uniform sampler2D shape1_distortion_texture: source_color;
uniform vec2 shape1_distortion_texture_scale = vec2(1.);
uniform vec2 shape1_distortion_texture_offset = vec2(0.);
uniform float shape1_distortion_amount: hint_range(0.0, 10) = 0.0;
uniform vec2 shape1_distortion_speed = vec2(0.1);
group_uniforms;
group_uniforms shape1.polar_uv;
uniform bool shape1_use_polar_uv = false;
uniform vec2 shape1_polar_uv_center = vec2(0.5);
uniform bool shape1_distortion_polar_uvs = false;
group_uniforms;
group_uniforms shape1.screenspace_uv;
uniform bool shape1_use_screenspace_uv;
group_uniforms;
group_uniforms shape2;
uniform bool use_shape2 = false;
group_uniforms;
#if defined(SHAPE2)
group_uniforms shape2.shape_texture;
uniform sampler2D shape2_main_texture: source_color, filter_nearest;
uniform vec2 shape2_main_texture_scale = vec2(1.);
uniform vec2 shape2_main_texture_offset = vec2(0.);
uniform vec4 shape2_color: source_color = vec4(1.);
uniform bool shape2_red_as_alpha = false;
uniform vec2 shape2_scroll_speed = vec2(0.);
uniform float shape2_rotation_offset: hint_range(0.0, 6.28318530718) = 0.;
uniform float shape2_rotation_speed = 0.;
group_uniforms;
group_uniforms shape2.contrast_brightness;
uniform float shape2_contrast: hint_range(0.0, 10) = 1.;
uniform float shape2_brightness: hint_range(-1., 1.) = 0.;
group_uniforms;
group_uniforms shape2.distortion;
uniform sampler2D shape2_distortion_texture: source_color;
uniform vec2 shape2_distortion_texture_scale = vec2(1.);
uniform vec2 shape2_distortion_texture_offset = vec2(0.);
uniform float shape2_distortion_amount: hint_range(0.0, 10) = 0.0;
uniform vec2 shape2_distortion_speed = vec2(0.1);
group_uniforms;
group_uniforms shape2.polar_uv;
uniform bool shape2_use_polar_uv = false;
uniform vec2 shape2_polar_uv_center = vec2(0.5);
uniform bool shape2_distortion_polar_uvs = false;
group_uniforms;
group_uniforms shape2.screenspace_uv;
uniform bool shape2_use_screenspace_uv;
group_uniforms;
#endif
group_uniforms shape3;
uniform bool use_shape3 = false;
group_uniforms;
#if defined(SHAPE3)
group_uniforms shape3.shape_texture;
uniform sampler2D shape3_main_texture: source_color, filter_nearest;
uniform vec2 shape3_main_texture_scale = vec2(1.);
uniform vec2 shape3_main_texture_offset = vec2(0.);
uniform vec4 shape3_color: source_color = vec4(1.);
uniform bool shape3_red_as_alpha = false;
uniform vec2 shape3_scroll_speed = vec2(0.);
uniform float shape3_rotation_offset: hint_range(0.0, 6.28318530718) = 0.;
uniform float shape3_rotation_speed = 0.;
group_uniforms;
group_uniforms shape3.contrast_brightness;
uniform float shape3_contrast: hint_range(0.0, 10) = 1.;
uniform float shape3_brightness: hint_range(-1., 1.) = 0.;
group_uniforms;
group_uniforms shape3.distortion;
uniform sampler2D shape3_distortion_texture: source_color;
uniform vec2 shape3_distortion_texture_scale = vec2(1.);
uniform vec2 shape3_distortion_texture_offset = vec2(0.);
uniform float shape3_distortion_amount: hint_range(0.0, 10) = 0.0;
uniform vec2 shape3_distortion_speed = vec2(0.1);
group_uniforms;
group_uniforms shape3.polar_uv;
uniform bool shape3_use_polar_uv = false;
uniform vec2 shape3_polar_uv_center = vec2(0.5);
uniform bool shape3_distortion_polar_uvs = false;
group_uniforms;
group_uniforms shape3.screenspace_uv;
uniform bool shape3_use_screenspace_uv;
group_uniforms;
#endif
group_uniforms combine_shapes;
#if defined(SHAPE2) || defined(SHAPE3)
uniform bool combine_additive = false;
uniform float shape1_color_weight: hint_range(0.0, 5.) = 1;
uniform float shape1_alpha_weight: hint_range(0.0, 5.) = 1;
#endif
#if defined(SHAPE2)
uniform float shape2_color_weight: hint_range(0.0, 5.) = 1;
uniform float shape2_alpha_weight: hint_range(0.0, 5.) = 1;
#endif
#if defined(SHAPE3)
uniform float shape3_color_weight: hint_range(0.0, 5.) = 1;
uniform float shape3_alpha_weight: hint_range(0.0, 5.) = 1;
#endif
group_uniforms;
group_uniforms uv_pixelate;
uniform bool use_uv_pixelate = false;
group_uniforms;
#if defined(UV_PIXELATE)
#include "Effects/vfez_uv_pixelate.gdshaderinc"
#endif
group_uniforms uv_twist;
uniform bool use_uv_twist = false;
group_uniforms;
#if defined(UV_TWIST)
#include "Effects/vfez_uv_twist.gdshaderinc"
#endif
group_uniforms uv_handrawn;
uniform bool use_uv_handrawn = false;
group_uniforms;
#if defined(UV_HANDRAWN)
#include "Effects/vfez_uv_handrawn.gdshaderinc"
#endif
group_uniforms uv_shake;
uniform bool use_uv_shake = false;
group_uniforms;
#if defined(UV_SHAKE)
#include "Effects/vfez_uv_shake.gdshaderinc"
#endif
group_uniforms uv_wave;
uniform bool use_uv_wave = false;
group_uniforms;
#if defined(UV_WAVE)
#include "Effects/vfez_uv_wave.gdshaderinc"
#endif
group_uniforms uv_round_wave;
uniform bool use_uv_round_wave = false;
group_uniforms;
#if defined(UV_ROUND_WAVE)
#include "Effects/vfez_uv_round_wave.gdshaderinc"
#endif
group_uniforms uv_global_distortion;
uniform bool use_uv_global_distortion = false;
#if defined(UV_GLOBAL_DISTORTION)
uniform vec2 uv_global_distortion_texture_scale = vec2(1.);
uniform vec2 uv_global_distortion_texture_offset = vec2(0.);
uniform sampler2D uv_global_distortion_texture: source_color;
uniform vec2 uv_global_distortion_speed;
uniform float uv_global_distortion_amount: hint_range(0.0, 10.0) = 0.5;
#endif
group_uniforms;
group_uniforms alpha_disolve;
uniform bool use_alpha_disolve = false;
group_uniforms;
#if defined(ALPHA_DISOLVE)
#include "Effects/vfez_alpha_disolve.gdshaderinc"
#endif
group_uniforms color_face_tint;
uniform bool use_color_face_tint = false;
group_uniforms;
#if defined(COLOR_FACE_TINT)
#include "Effects/vfez_color_face_tint.gdshaderinc"
#endif
group_uniforms color_toning;
uniform bool use_color_toning = false;
group_uniforms;
#if defined(COLOR_TONING)
#include "Effects/vfez_color_toning.gdshaderinc"
#endif
group_uniforms color_ramp;
uniform bool use_color_ramp = false;
group_uniforms;
#if defined(COLOR_RAMP)
#include "Effects/vfez_color_ramp.gdshaderinc"
#endif
group_uniforms color_posterize;
uniform bool use_color_posterize = false;
group_uniforms;
#if defined(COLOR_POSTERIZE)
#include "Effects/vfez_color_posterize.gdshaderinc"
#endif
group_uniforms color_rim;
uniform bool use_color_rim = false;
group_uniforms;
#if defined(COLOR_RIM)
#include "Effects/vfez_color_rim.gdshaderinc"
#endif
group_uniforms color_glow;
uniform bool use_color_glow = false;
group_uniforms;
#if defined(COLOR_GLOW)
#include "Effects/vfez_color_glow.gdshaderinc"
#endif
group_uniforms color_hsv_shift;
uniform bool use_color_hsv_shift = false;
group_uniforms;
#if defined(COLOR_HSV_SHIFT)
#include "Effects/vfez_hsv_shift.gdshaderinc"
#endif
group_uniforms alpha_mask;
uniform bool use_alpha_mask = false;
group_uniforms;
#if defined(ALPHA_MASK)
#include "Effects/vfez_alpha_mask.gdshaderinc"
#endif
group_uniforms alpha_remap;
uniform bool use_alpha_remap = false;
group_uniforms;
#if defined(ALPHA_REMAP)
#include "Effects/vfez_alpha_remap.gdshaderinc"
#endif
group_uniforms alpha_cutoff;
uniform bool use_alpha_cutoff = false;
group_uniforms;
#if defined(ALPHA_CUTOFF)
#include "Effects/vfez_alpha_cutoff.gdshaderinc"
#endif
group_uniforms vertex_offset;
uniform bool use_vertex_offset = false;
group_uniforms;
#if defined(VERTEX_OFFSET)
#include "Effects/vfez_vertex_offset.gdshaderinc"
#endif
group_uniforms vertex_expand;
uniform bool use_vertex_expand;
group_uniforms;
#if defined(VERTEX_EXPAND)
#include "Effects/vfez_vertex_expand.gdshaderinc"
#endif
group_uniforms particle;
uniform bool use_particle_trails = false;
uniform bool use_particle_anim = false;
group_uniforms;
#if defined(PARTICLE_ANIM)
#include "Effects/vfez_particle_anim.gdshaderinc"
#endif
varying vec3 view_direction;
varying vec3 world_normal;
varying vec2 screenspace_uv;
// calculate single shape function ------------------------------
vec4 calculate_shape(
vec2 baseUV,
sampler2D shape_main_texture,
vec2 shape_main_texture_scale,
vec2 shape_main_texture_offset,
sampler2D shape_distortion_texture,
vec2 shape_distortion_texture_scale,
vec2 shape_distortion_texture_offset,
float shape_distortion_amount,
vec2 shape_distortion_speed,
float shape_rotation_speed,
float shape_rotation_offset,
vec2 shape_scroll_speed,
bool shape_red_as_alpha,
vec4 shape_color,
float shape_contrast,
float shape_brightness,
bool shape_use_polar_uv,
vec2 shape_polar_uv_center,
bool shape_distortion_polar_uvs
)
{
vec2 shapeUV = baseUV;
if (shape_use_polar_uv)
{
shapeUV = uv_polar(shapeUV, shape_polar_uv_center);
}
shapeUV = transform_uv(
shapeUV,
shape_main_texture_scale,
shape_main_texture_offset,
false);
if (shape_distortion_amount > 0.)
{
vec2 distort_uvs = baseUV;
//distort_uvs
vec2 distortionUV = baseUV;
distortionUV = transform_uv(
distortionUV,
shape_distortion_texture_scale,
shape_distortion_texture_offset,
false);
if (shape_use_polar_uv && shape_distortion_polar_uvs)
{
distortionUV = uv_polar(distortionUV, shape_polar_uv_center);
}
shapeUV = uv_distortion(shapeUV, shape_distortion_texture, distortionUV,
shape_distortion_amount, shape_distortion_speed, false);
}
shapeUV = rotate_uvs(
shapeUV,
shape_rotation_offset + mod(shape_rotation_speed * TIME, TAU),
shape_main_texture_scale,
shape_main_texture_offset);
vec4 shape = sample_texture_with_scroll(
shape_main_texture,
shapeUV,
shape_scroll_speed,
TIME);
if (shape_red_as_alpha)
{
shape = vec4(shape_color.rgb, shape.r);
}
else
{
shape *= shape_color;
}
bool apply_contrast = shape_contrast != 1. || shape_brightness != 0.;
if (apply_contrast)
{
if (shape_red_as_alpha)
{
shape.a = clamp(
(shape.a - 0.5) * shape_contrast + 0.5 + shape_brightness,
0.,
1.);
}
else
{
shape.rgb = vec3(
max(0, (shape.r - 0.5) * shape_contrast + 0.5 + shape_brightness),
max(0, (shape.g - 0.5) * shape_contrast + 0.5 + shape_brightness),
max(0, (shape.b - 0.5) * shape_contrast + 0.5 + shape_brightness)
);
}
}
return shape;
}
bool is_using_screen_space_uv()
{
bool using_shape2_screenspace_uv = false;
bool using_shape3_screenspace_uv = false;
#if defined(SHAPE2)
using_shape2_screenspace_uv = shape2_use_screenspace_uv;
#endif
#if defined(SHAPE3)
using_shape3_screenspace_uv = shape3_use_screenspace_uv;
#endif
return shape1_use_screenspace_uv || using_shape2_screenspace_uv || using_shape3_screenspace_uv;
}
// ---------------------------------------------------
void vertex() {
#if defined(BILLBOARD_ENABLED)
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(
MAIN_CAM_INV_VIEW_MATRIX[0],
MAIN_CAM_INV_VIEW_MATRIX[1],
MAIN_CAM_INV_VIEW_MATRIX[2],
MODEL_MATRIX[3]);
#elif defined(BILLBOARD_Y)
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(
vec4(normalize(cross(vec3(0.0, 1.0, 0.0), MAIN_CAM_INV_VIEW_MATRIX[2].xyz)), 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(normalize(cross(MAIN_CAM_INV_VIEW_MATRIX[0].xyz, vec3(0.0, 1.0, 0.0))), 0.0),
MODEL_MATRIX[3]);
#elif defined(BILLBOARD_PARTICLE)
mat4 mat_world = mat4(
normalize(INV_VIEW_MATRIX[0]),
normalize(INV_VIEW_MATRIX[1]),
normalize(INV_VIEW_MATRIX[2]),
MODEL_MATRIX[3]);
mat_world = mat_world * mat4(
vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0),
vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 0.0, 1.0));
MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;
#endif
#if (defined(BILLBOARD_ENABLED) || defined(BILLBOARD_Y) || defined(BILLBOARD_PARTICLE)) && defined(BILLBOARD_KEEP_SCALE)
MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(
vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0),
vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0),
vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0),
vec4(0.0, 0.0, 0.0, 1.0));
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
#endif
view_direction = normalize((
INV_VIEW_MATRIX[3] - MODEL_MATRIX * vec4(VERTEX, 1.0)).rgb);
world_normal = normalize((MODEL_MATRIX * vec4(NORMAL, 1.0)).rgb);
#if defined(VERTEX_OFFSET)
if (use_vertex_offset)
{
VERTEX = vertex_offset(VERTEX, NORMAL, UV);
}
#endif
#if defined(VERTEX_EXPAND)
if (use_vertex_expand)
{
VERTEX = vertex_expand(VERTEX);
}
#endif
#if defined(PARTICLE_ANIM)
if (use_particle_anim)
{
UV = particle_anim(INSTANCE_CUSTOM.z, UV);
}
#endif
bool using_screen_space_uv = is_using_screen_space_uv();
// only calculate screenspace uv if used at least by 1 shape
if (using_screen_space_uv)
{
vec4 position_v = MODELVIEW_MATRIX * vec4(VERTEX, 1.0);
vec4 position_cs = PROJECTION_MATRIX * vec4(position_v.xyz, 1.0);
vec2 ndc = position_cs.xy / position_cs.w;
screenspace_uv = ndc.xy * 0.5 + 0.5;
}
}
void fragment() {
// clamp UVS near edges (0., 1., 2., 3., 4., 5.) to reduce folding artifacts
vec2 uv_floor_top_included = max(vec2(0.), ceil(UV) - vec2(1.));
vec2 clampedUV = clamp(UV, vec2(0.001) + uv_floor_top_included, vec2(0.999) + uv_floor_top_included);
vec2 baseUV = clampedUV;
#if defined(UV_PIXELATE)
if (use_uv_pixelate)
{
baseUV = uv_pixelate(baseUV, VIEWPORT_SIZE);
}
#endif
#if defined(UV_TWIST)
if (use_uv_twist)
{
baseUV = uv_twist(baseUV, shape1_main_texture_scale);
}
#endif
#if defined(UV_HANDRAWN)
if (use_uv_handrawn)
{
baseUV = uv_handrawn(baseUV);
}
#endif
#if defined(UV_SHAKE)
if (use_uv_shake)
{
baseUV = uv_shake(baseUV);
}
#endif
#if defined(UV_WAVE)
if (use_uv_wave)
{
baseUV = uv_wave(baseUV, VIEWPORT_SIZE, shape1_main_texture_scale);
}
#endif
#if defined(UV_ROUND_WAVE)
if (use_uv_round_wave)
{
vec2 main_tex_size = vec2(textureSize(shape1_main_texture, 0));
baseUV = uv_round_wave(baseUV, main_tex_size, shape1_main_texture_scale);
}
#endif
#if defined(UV_GLOBAL_DISTORTION)
if (use_uv_global_distortion)
{
vec2 global_distortion_uv =
transform_uv(baseUV,
uv_global_distortion_texture_scale,
uv_global_distortion_texture_offset,
false);
baseUV = uv_distortion(baseUV, uv_global_distortion_texture, global_distortion_uv,
uv_global_distortion_amount, uv_global_distortion_speed, false);
}
#endif
vec2 shape1UV;
if (shape1_use_screenspace_uv)
{
shape1UV = screenspace_uv;
}
else
{
shape1UV = baseUV;
}
// calculate shape 1
vec4 shape1 = calculate_shape(
shape1UV,
shape1_main_texture,
shape1_main_texture_scale,
shape1_main_texture_offset,
shape1_distortion_texture,
shape1_distortion_texture_scale,
shape1_distortion_texture_offset,
shape1_distortion_amount,
shape1_distortion_speed,
shape1_rotation_speed,
shape1_rotation_offset,
shape1_scroll_speed,
shape1_red_as_alpha,
shape1_color,
shape1_contrast,
shape1_brightness,
shape1_use_polar_uv,
shape1_polar_uv_center,
shape1_distortion_polar_uvs
);
// calculate shape2 if defined
#if defined(SHAPE2)
vec2 shape2UV;
if (shape2_use_screenspace_uv)
{
shape2UV = screenspace_uv;
}
else
{
shape2UV = baseUV;
}
vec4 shape2 = calculate_shape(
shape2UV,
shape2_main_texture,
shape2_main_texture_scale,
shape2_main_texture_offset,
shape2_distortion_texture,
shape2_distortion_texture_scale,
shape2_distortion_texture_offset,
shape2_distortion_amount,
shape2_distortion_speed,
shape2_rotation_speed,
shape2_rotation_offset,
shape2_scroll_speed,
shape2_red_as_alpha,
shape2_color,
shape2_contrast,
shape2_brightness,
shape2_use_polar_uv,
shape2_polar_uv_center,
shape2_distortion_polar_uvs
);
#endif
// calculate shape3 if defined
#if defined(SHAPE3)
vec2 shape3UV;
if (shape3_use_screenspace_uv)
{
shape3UV = screenspace_uv;
}
else
{
shape3UV = baseUV;
}
vec4 shape3 = calculate_shape(
shape3UV,
shape3_main_texture,
shape3_main_texture_scale,
shape3_main_texture_offset,
shape3_distortion_texture,
shape3_distortion_texture_scale,
shape3_distortion_texture_offset,
shape3_distortion_amount,
shape3_distortion_speed,
shape3_rotation_speed,
shape3_rotation_offset,
shape3_scroll_speed,
shape3_red_as_alpha,
shape3_color,
shape3_contrast,
shape3_brightness,
shape3_use_polar_uv,
shape3_polar_uv_center,
shape3_distortion_polar_uvs
);
#endif
// ---combine shapes if more than one defined.---
vec4 color = shape1;
#if defined(SHAPE2) || defined(SHAPE3)
if (combine_additive)
{
color.rgb = shape1.rgb * shape1_color_weight * shape1.a;
color.a = shape1.a * shape1_alpha_weight;
}
else
{
if (shape1_color_weight > 0.)
color.rgb = shape1.rgb * shape1_color_weight;
else
color.rgb = vec3(1.);
if (shape1_alpha_weight > 0.)
color.a = shape1.a * shape1_alpha_weight;
else
color.a = 1.;
}
#endif
#if defined(SHAPE2)
if (combine_additive)
{
color.rgb += shape2.rgb * shape2_color_weight * shape2.a;
color.a = max(color.a, shape2.a * shape2_alpha_weight);
}
else
{
if (shape2_color_weight > 0.)
color.rgb *= shape2.rgb * shape2_color_weight;
if (shape2_alpha_weight > 0.)
color.a *= shape2.a * shape2_alpha_weight;
}
#endif
#if defined(SHAPE3)
if (combine_additive)
{
color.rgb += shape3.rgb * shape3_color_weight * shape3.a;
color.a = max(color.a, shape3.a * shape3_alpha_weight);
}
else
{
if (shape3_color_weight > 0.)
color.rgb *= shape3.rgb * shape3_color_weight;
if (shape3_alpha_weight > 0.)
color.a *= shape3.a * shape3_alpha_weight;
}
#endif
color.a = clamp(color.a, 0., 1.);
// ----------------------------------------------
// apply premultiply color
if (premultiply_color)
{
float luminance = get_color_luminance(color);
color.a = min(luminance, color.a);
}
color.rgb *= global_color * COLOR.rgb;
/// apply premultiply alpha
if (premultiply_alpha)
{
color.rgb *= color.a;
}
#if defined(ALPHA_DISOLVE)
if (use_alpha_disolve)
{
float luminance = get_color_luminance(color);
float pre_disolve_alpha = color.a;
if (additive_config && !premultiply_color)
{
pre_disolve_alpha *= luminance;
}
color = alpha_disolve(color, pre_disolve_alpha, COLOR.a, baseUV, false);
}
#endif
#if defined(COLOR_FACE_TINT)
if (use_color_face_tint)
{
color.rgb = color_face_tint(color.rgb, world_normal, view_direction);
}
#endif
// apply color grading if defined
#if defined(COLOR_TONING)
if (use_color_toning)
{
color.rgb = color_toning(color);
}
#endif
// apply color ramp if defined
#if defined(COLOR_RAMP)
if (use_color_ramp)
{
color = color_ramp(color);
}
#endif
#if defined(COLOR_POSTERIZE)
if (use_color_posterize)
{
color.rgb = color_posterize(color.rgb);
}
#endif
#if defined(COLOR_RIM)
if (use_color_rim)
{
color = color_rim(color, NORMAL, VIEW);
}
#endif
#if defined(COLOR_GLOW)
if (use_color_glow)
{
float glow_mult = 1.;
if (additive_config)
{
float luminance = get_color_luminance(color);
glow_mult = luminance;
}
color.rgb = color_glow(color, baseUV, glow_mult);
}
#endif
#if defined(COLOR_HSV_SHIFT)
if (use_color_hsv_shift)
{
color.rgb = hsv_shift(color.rgb);
}
#endif
#if defined(ALPHA_MASK)
if (use_alpha_mask)
{
color.a = alpha_mask(color.a, clampedUV, false);
}
#endif
#if defined(ALPHA_REMAP)
if (use_alpha_remap)
{
color.a = alpha_remap(color.a);
}
#endif
#if defined(ALPHA_CUTOFF)
if (use_alpha_cutoff)
{
color.a = alpha_cutoff(color.a);
}
#endif
color.a = color.a * global_alpha * COLOR.a;
if (additive_config)
{{
color.rgb *= color.a;
}}
ALBEDO = color.rgb;
ALPHA = color.a;
}