Description
Changelog
Reviews
This is an addon for Godot 4.4+ that adds the Burley node to the visual shader system. This node outputs the Diffuse Light based on the Disney Principled PBS Diffuse.

GDSL:
shader_type spatial;
const float INV_PI = 0.31830988618379067154; // 1.0 / PI.
group_uniforms _Burley;
uniform vec3 _DiffuseColor : source_color = vec3(1.0);
uniform float _Roughness : hint_range(0.0, 1.0, 1e-3) = 1.0;
float schlick_fresnel(float u)
{
float m = clamp(1.0 - u, 0.0, 1.0);
return m * m * m * m * m; // pow(m, 5.0).
}
float diffuse_burley(
in vec3 n, // Normal.
in vec3 l, // Light.
in vec3 v, // View.
in float roughness
)
{
float NdotL = dot(n, l); // cos(theta_l) == cos(theta_i).
if(NdotL < 0.0)
{
return 0.0;
}
vec3 h = normalize(v + l);
float NdotV = min(max(dot(n, v), 1e-3), 1.0); // cos(theta_v) == cos(theta_r).
float HdotL = dot(h, l); // cos(theta_d).
float FD_l = schlick_fresnel(NdotL), FD_v = schlick_fresnel(NdotV);
float FD90 = 0.5 + 2.0 * roughness * HdotL * HdotL;
return INV_PI * mix(1.0, FD90, FD_l) * mix(1.0, FD90, FD_v) * NdotL;
}
void fragment() {
ALBEDO = _DiffuseColor;
ROUGHNESS = _Roughness;
}
void light() {
vec3 n = normalize(NORMAL);
vec3 l = normalize(LIGHT);
vec3 v = normalize(VIEW);
/* Burley */
// https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf
float fd = diffuse_burley(n, l, v, ROUGHNESS);
// 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.4
No changelog provided for this version.