This is an addon for Godot 4.4+ that adds the Lambert-Wrap node to the visual shader system. This node outputs the Diffuse Light based on the Energy-Conserving wrapped Lambertian reflectance model.


Mathematical Formula:

diffuse = (ρ/π) * ((cos(θᵢ) + w) / (1 + w)²)

Where:

  • ρ is the albedo of surface.
  • w is the wrap factor.


Godot Shader Language:

const float INV_PI = 0.31830988618379067154; // 1.0 / PI.

float diffuse_lambert_wrap(
    in vec3 n,
    in vec3 l,
    in float w
)
{
    float NdotL = dot(n, l); // cos(theta_l) == cos(theta_i).
    return INV_PI * ((NdotL + w) / ((1.0 + w) * (1.0 + w)));
}


ko-fi | InterDreamSoft


Lambert-Wrap Diffuse Reflectance Model (Node).


Links & Support


[ Support Email: interdreamsoft@gmail.com ]

Download

Download NowName your own price

Click download now to get access to the following files:

diffuse_lambert_wrap_v1.0.4.zip 118 kB

Leave a comment

Log in with itch.io to leave a comment.