diffuse VEX function
Returns the diffuse (Lambertian) illumination given the normalized surface normal.
Context: surface
See also: wirediffuse, Writing a PBR shader
-
vector diffuse(vector nml) -
vector diffuse(vector nml, vector V, float roughness) -
bsdf diffuse() -
bsdf diffuse(vector nml)
See writing a PBR shader for information on BSDFs.
Returns the diffuse (Lambertian) illumination given the normalized surface normal.
The diffuse(vector nml, V; float roughness, ...) form uses the Oren-Nayar lighting model to compute the diffuse illumination for the surface. The Oren-Nayar lighting model is a more sophisticated lighting model than Lambertian lighting. The V vector represents a vector from the surface to the eye (i.e. -normalize(I)). With a roughness of 0, the Oren-Nayar lighting model is equivalent to the Lambertian model. As roughness increases toward 1, the illumination changes to mimic rougher materials (like clay). The Oren-Nayar form of diffuse() is more expensive than Lambertian diffuse lighting.
You can optionally specify a light mask.
BSDF version
-
bsdf diffuse() -
bsdf diffuse(vector nml)
Diffuse reflections. This BSDF has an albedo of 0.5.