Files
godot-shader-experiments/test.gdshader

19 lines
452 B
Plaintext

shader_type spatial;
//render_mode vertex_lighting;
uniform sampler2D textureMap : source_color;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
ALBEDO = texture(textureMap, UV).rgb;
//LIGHT_VERTEX = vec3(0.0);
}
void light() {
float lambert = clamp(dot(NORMAL, LIGHT), 0.0, 1.0);
float halfLambert = pow(lambert*0.5 + 0.5, 5);
DIFFUSE_LIGHT += halfLambert * ATTENUATION * LIGHT_COLOR / PI;
}