rj-action-library/Runtime/Shading/Shaders/Development/Template_Spatial.gdshader

45 lines
1.3 KiB
Plaintext
Raw Normal View History

2025-01-03 12:09:23 +00:00
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_burley, specular_schlick_ggx, alpha_to_coverage_and_one;
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc"
uniform vec4 albedo : source_color;
uniform sampler2D screenTexture:
hint_screen_texture,
repeat_disable,
filter_linear_mipmap;
uniform float effectStrength: hint_range(0,1) = 1;
void vertex()
{
mat3 viewMatrix = VIEW_MATRIX;
UV = UV * uv1_scale.xy + uv1_offset.xy;
VERTEX += NORMAL * grow;
}
void fragment()
{
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo, base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic, base_uv), metallic_texture_channel);
METALLIC = metallic_tex * metallic;
SPECULAR = specular;
vec4 roughness_texture_channel = vec4(1.0, 0.0, 0.0, 0.0);
float roughness_tex = dot(texture(texture_roughness, base_uv), roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
ALPHA *= albedo.a * albedo_tex.a;
ALPHA_SCISSOR_THRESHOLD = alpha_scissor_threshold;
ALPHA_ANTIALIASING_EDGE = alpha_antialiasing_edge;
ALPHA_TEXTURE_COORDINATE = UV * vec2(albedo_texture_size);
}