godot-psd-training/shaders/mtd_fault.gdshader

47 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-05-09 13:51:55 +08:00
// NOTE: Shader automatically converted from Godot Engine 4.2.2.stable's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : source_color;
uniform sampler2D texture_light : source_color,filter_linear_mipmap,repeat_enable;
uniform sampler2D texture_dark : source_color,filter_linear_mipmap,repeat_enable;
uniform float point_size : hint_range(0,128);
uniform float roughness : hint_range(0,1);
uniform sampler2D texture_metallic : hint_default_white,filter_linear_mipmap,repeat_enable;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_roughness_r,filter_linear_mipmap,repeat_enable;
uniform float specular;
uniform float metallic;
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
uniform bool is_dark;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
if(is_dark) {
vec4 albedo_tex = texture(texture_dark,base_uv);
2024-05-09 14:41:40 +08:00
ALBEDO = albedo.rgb * albedo_tex.rgb * 0.8;
2024-05-09 13:51:55 +08:00
} else {
vec4 albedo_tex = texture(texture_light,base_uv);
2024-05-09 14:41:40 +08:00
ALBEDO = albedo.rgb * albedo_tex.rgb * 1.5;
2024-05-09 13:51:55 +08:00
}
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
METALLIC = metallic_tex * metallic;
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;
SPECULAR = specular;
}