Calculate BRDF and PDF when doing direct light sampling I learned in PBRT that to sample direct lighting for a surface a integrator usually calculates the sample as
$$
Sample = \frac{L_d(p,\omega_r) f(p,\omega_o,\omega_r)|cos\theta_i|}{p(\omega_r)}
$$
where BRDF $f(p,\omega_o,\omega_r)$ is the sum of brdf from all the components (for instance microfacet specular &amp; lambertian diffuse), and PDF $p(\omega_r)$ is the average of all the components. My question is why for $f$ we calculate sum while for $p$ it's average. I have the intuition that for $f$ we should also calculate average.
In addition, why can we use the distribution of importance sampling to evaluate $p(\omega_r)$ for the given $\omega_r$?
1) When we have multiple BRDFs, adding thier components together can break energy conservation, as I think you suspect. However most renderers will handle this problem when constructing the layered BRDFs. For example you would might weight each layer or use a fresnel term to decide the weight for each layer.

Here is the spec for arnolds standard shader:



https://autodesk.github.io/standard-surface/

Each layer is multiplied by 1 - previous layer weight, which the artist is setting. This is done inside the fr function, which means that energy conservation is solved here.

2) The pdf is an average, I think, if each bxdf has an equal chance of being sampled. You therefore average the pdf even though each layer may contribute different amounts.

Note: Becareful which value you use for p(wr), this will be the pdf you used to sample your direction, so either the bxdf pdf or the light pdf. (You still need to calculate both pdfs at some point for MIS though.)