gmtk24/textures/building_block.gdshader

26 lines
779 B
Plaintext
Raw Permalink Normal View History

2024-08-17 20:52:00 +02:00
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, depth_prepass_alpha;
uniform vec4 albedo : source_color;
uniform float roughness : hint_range(0.0, 1.0);
uniform float specular : hint_range(0.0, 1.0, 0.01);
uniform float metallic : hint_range(0.0, 1.0, 0.01);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform sampler2D texture_albedo_for_alpha : source_color, filter_linear_mipmap, repeat_enable;
void vertex() {
UV = UV * uv1_scale.xy + uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex_for_alpha = texture(texture_albedo_for_alpha, base_uv);
ALBEDO = albedo.rgb;
METALLIC = metallic;
SPECULAR = specular;
ROUGHNESS = roughness;
ALPHA *= albedo.a * albedo_tex_for_alpha.a;
}