## 8.3 Lambertian Reflection

One of the simplest BRDFs is the Lambertian model. It models a perfect diffuse surface that scatters incident illumination equally in all directions. Although this reflection model is not physically plausible, it is a reasonable approximation to many real-world surfaces such as matte paint.

<<BxDF Declarations>>+=
class LambertianReflection : public BxDF { public: <<LambertianReflection Public Methods>>
LambertianReflection(const Spectrum &R) : BxDF(BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)), R(R) { } Spectrum f(const Vector3f &wo, const Vector3f &wi) const; Spectrum rho(const Vector3f &, int, const Point2f *) const { return R; } Spectrum rho(int, const Point2f *, const Point2f *) const { return R; }
private: <<LambertianReflection Private Data>>
const Spectrum R;
};

The LambertianReflection constructor takes a reflectance spectrum , which gives the fraction of incident light that is scattered.

<<LambertianReflection Public Methods>>=
LambertianReflection(const Spectrum &R) : BxDF(BxDFType(BSDF_REFLECTION | BSDF_DIFFUSE)), R(R) { }

<<LambertianReflection Private Data>>=
const Spectrum R;

The reflection distribution function for LambertianReflection is quite straightforward, since its value is constant. However, the value must be returned, rather than the reflectance supplied to the constructor. This can be seen by equating to Equation (8.1), which defined , and solving for the BRDF’s value.

<<BxDF Method Definitions>>+=
Spectrum LambertianReflection::f(const Vector3f &wo, const Vector3f &wi) const { return R * InvPi; }

The directional-hemispherical and hemispherical-hemispherical reflectance values for a Lambertian BRDF are trivial to compute analytically, so the derivations are omitted in the text.

<<LambertianReflection Public Methods>>+=
Spectrum rho(const Vector3f &, int, const Point2f *) const { return R; } Spectrum rho(int, const Point2f *, const Point2f *) const { return R; }

It’s also useful to be able to represent perfect Lambertian transmission through a surface; this BTDF is implemented in LambertianTransmission. Its implementation closely follows LambertianReflection and thus isn’t included here.