LYGIA Shader Library

lambert (lygia/lighting/diffuse/lambert)

calculate diffuse contribution using lambert equation

Dependencies:

Use:

<float> diffuseLambert(<vec3> light, <vec3> normal [, <vec3> view, <float> roughness] )
<float> diffuseLambert(<vec3> L, <vec3> N, <vec3> V, <float> NoV, <float> NoL, <float> roughness)

Check it on Github



#ifndef FNC_DIFFUSE_LAMBERT
#define FNC_DIFFUSE_LAMBERT
float diffuseLambert() { return INV_PI; }
float diffuseLambert(const in vec3 L, const in vec3 N) { return max(0.0, dot(N, L)); }
float diffuseLambert(const in vec3 L, const in vec3 N, const in vec3 V, const in float roughness) { return diffuseLambert(L, N); }
float diffuseLambert(const in vec3 L, const in vec3 N, const in vec3 V, const in float NoV, const in float NoL, const in float roughness) { return max(0.0, NoL); }
#endif

Use:

<float> diffuseLambert(<float3> light, <float3> normal [, <float3> view, <float> roughness] )
<float> diffuseLambert(<float3> L, <float3> N, <float3> V, <float> NoV, <float> NoL, <float> roughness)

Check it on Github


#ifndef FNC_DIFFUSE_LAMBERT
#define FNC_DIFFUSE_LAMBERT
float diffuseLambert(float3 L, float3 N) { return max(0.0, dot(N, L)); }
float diffuseLambert(float3 L, float3 N, float3 V, float roughness) { return diffuseLambert(L, N); }
float diffuseLambert(float3 L, float3 N, float3 V, float NoV, float NoL, float roughness) { return diffuseLambert(L, N); }
#endif

License

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository