// -*- mode: glsl -*- shader_type spatial; render_mode depth_prepass_alpha; #define USE_MASK #include "common.gdshaderinc" void fragment() { vec3 uvt = scale_uvt(UV, TIME); float value = sample_noise(uvt); ALBEDO = base_albedo(UV, value); ROUGHNESS = base_roughness(value); EMISSION = base_emission(UV, value); SPECULAR = base_specular(); // vec3 nmap = minimal_convolution(UV, uvt); // vec3 nmap = cross_convolution(UV, uvt); vec3 nmap = sobel_convolution(UV, uvt); // vec3 nmap = sobel_5x5_convolution(UV, uvt); // vec3 nmap = scharr_convolution(UV, uvt); // vec3 nmap = godot_convolution(UV, uvt); NORMAL_MAP = nmap / 2.0 + 0.5; // add fresnel vec3 world_normal = mat3(TANGENT, BINORMAL, NORMAL) * nmap; EMISSION += rim_glow( world_normal, VIEW, fresnel_gradient, fresnel_color, fresnel_power, fresnel_intensity ); // add iridescence ALBEDO += rim_glow( world_normal, VIEW, iridescence_gradient, iridescence_color, iridescence_power, iridescence_intensity ); // Hardish edge float mask = texture(gunk_mask, UV).r; ALPHA = hardstep(1.0 - mask + edge_bleed); }