You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
939 B
24 lines
939 B
shader_type spatial; |
|
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx; |
|
|
|
uniform sampler2DArray textures : source_color, filter_linear_mipmap, repeat_enable; |
|
uniform sampler2DArray blend_textures : source_color, filter_nearest_mipmap, repeat_enable; |
|
|
|
void fragment() { |
|
int num_textures = textureSize(textures, 0).z; |
|
int num_blend_textures = textureSize(blend_textures, 0).z; |
|
|
|
float tex_primary_index = COLOR.r * float(num_textures); |
|
float tex_secondary_index = COLOR.g * float(num_textures); |
|
float tex_blend_index = COLOR.b * float(num_blend_textures); |
|
|
|
vec4 tex_primary = texture(textures, vec3(UV, tex_primary_index)); |
|
vec4 tex_secondary = texture(textures, vec3(UV, tex_secondary_index)); |
|
|
|
vec4 blend = texture(blend_textures, vec3(UV, tex_blend_index)); |
|
ALBEDO = mix(tex_secondary, tex_primary, blend.a).rgb; |
|
|
|
METALLIC = 0.0; |
|
SPECULAR = 0.5; |
|
ROUGHNESS = 1.0; |
|
}
|
|
|