Description
Changelog
Reviews
This is an addon for Godot 4.4+ that adds the Lambert node to the visual shader system. This node outputs the Diffuse Light based on the Lambertian reflectance model.

GDSL:
shader_type spatial;
const float INV_PI = 0.31830988618379067154; // 1.0 / PI.
group_uniforms _Lambert;
uniform vec3 _DiffuseColor : source_color = vec3(1.0);
float diffuse_lambert(
in vec3 n, // Normal.
in vec3 l // Light.
)
{
float NdotL = dot(n, l); // cos(theta_l) == cos(theta_i).
if(NdotL < 0.0)
{
return 0.0;
}
return INV_PI * NdotL;
}
void fragment() {
ALBEDO = _DiffuseColor;
}
void light() {
vec3 n = normalize(NORMAL);
vec3 l = normalize(LIGHT);
/* Lambert */
float fd = diffuse_lambert(n, l);
// To compare with the Slice-Image.
//vec3 radiance = (LIGHT_COLOR / PI) * ATTENUATION;
// In PI light units.
vec3 radiance = LIGHT_COLOR * ATTENUATION;
DIFFUSE_LIGHT += radiance * fd;
}
[ Support Email: [email protected] ]
Changelog for version v1.0.6
No changelog provided for this version.