<p>I believe you have a misunderstanding for the BRDF sampling process: PDF can be almost arbitrary if PDF is non-zero at the correspondig point where the  integrand is non-zero. We don't even have to importance sampling BRDF just for simplicity (though uniformly sampling everything can be extremely inefficient). So, &quot;in the pdf here&quot;, we don't know whether there should be a cosine term unless we know exactly what kind of sampling method you are using.</p>
<p>Normally, we wish to be more efficient so we will importance-sample the integrand, then we wish to match the sampling PDF with the integrand  as closely as possible . So, let's therefore look at the Blinn-Phong (or Phong) BRDF, it has a power cosine term so the best practice is to use power cosine-weighted hemisphere sampling, but the original cosine hemisphere sampling would work, too. For these two sampling methods, you can refer to <a href="https://ameye.dev/notes/sampling-the-hemisphere/" rel="nofollow noreferrer">Sampling the hemisphere</a>, which has thorough explanation and derivation for how you get the sample and its PDF.</p>
<p>So for your question: Lambertian BRDF indeed has a cosine term which means that your are correct, Phong and Blinn-Phong have power cosine term so the throughput is proportional to <span class="math-container">$(\cos\theta)^\alpha$</span>, but it won't hurt to use the same sampling method as Lambertian BRDF and get the same PDF for each sample, though it's suboptimal.</p>
<p>BTW, I think your question should be improved in the following ways:</p>
<ul>
<li>Use Latex to improve the readability of your post.</li>
<li>Clearly list your question and related subjects. For example, I am not sure whether you are confused about Phong model or Blinn-Phong model since these two differ in what kind of vector they sample. For clearer understanding of sampling Blinn-Phong model, you can refer to another answer of mine <a href="https://computergraphics.stackexchange.com/questions/13633/importance-sampling-of-the-blinn-phong-brdf-in-pathtracing/13636#13636">sampling-of-the-blinn-phong-brdf-in-pathtracing</a>.</li>
</ul>
<hr />
<p>Update for further explanation, and I need to remind you that you can <strong>comment</strong> below my answer or my comment instead of posting your own answer.</p>
<p>Well let's get this straight. The following figure shows the local light interaction:
<a href="https://i.sstatic.net/3jGRG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3jGRG.png" alt="enter image description here" /></a></p>
<p>So, your modified Phong BRDF is actually:
<span class="math-container">$$
k_d \frac{1}{\pi} + k_s \frac{n+2}{2\pi}\cos^n\alpha
$$</span>
Yes, like I said, there is only one cosine term in the BRDF, which is <span class="math-container">$\cos\alpha$</span>. Note that 'outgoing' direction is <span class="math-container">$\pmb{v}$</span> since this follows the convention of light tracing.</p>
<p>So are we done? No, the surface rendering equation is:
<span class="math-container">$$
I(x, w) = \int_{\Omega}f(x, w, w')&lt;w, w'&gt;dw'
$$</span>
and here, <span class="math-container">$&lt;w, w'&gt;$</span> means normalized dot product (cosine). So it doesn't matter whether you are dealing with diffusive lobe or specular lobe (unless it is mirror-specular), <span class="math-container">$\cos\theta$</span> always follows. You can find this in the code of PBR-book (from pbrt-v3, <code>src/integrator/path.cpp</code>):</p>
<pre class="lang-cpp prettyprint-override"><code>// Account for the indirect subsurface scattering component
Spectrum f = pi.bsdf-&gt;Sample_f(pi.wo, &amp;wi, sampler.Get2D(), &amp;pdf,
                                BSDF_ALL, &amp;flags);
if (f.IsBlack() || pdf == 0) break;
beta *= f * AbsDot(wi, pi.shading.n) / pdf;
</code></pre>
<p>You see, <code>pi.bsdf-&gt;Sample_f</code> will evaluate BRDF value and assign it to f, but to get the real path through put <code>beta</code>, one must have <span class="math-container">$\cos\theta$</span> (<code>AbsDot(wi, pi.shading.n)</code>) since this is the <strong>geometry term that would convert the solid angle measure to area product measure</strong> (see <a href="https://graphics.stanford.edu/courses/cs348b-03/papers/veach-chapter8.pdf" rel="nofollow noreferrer">Veach Chapter 8: A Path Integral Formulation of Light Transport</a> for more information on this topic). So the problem falls back to: (1) I need to incorporate all cosine term to get the correct radiance (but for BRDF evaluation, <span class="math-container">$\cos\theta$</span> is not needed) (2) the PDF in the denominator (as I explained in the upper part of this answer).</p>

CC BY-SA 4.0
2023-10-07T08:05:58.123Z
2023-10-08T02:14:17.230Z
2023-10-08T02:14:17.230Z
Enigmatisms
<p>thanks a lot for your given informations! Let me summarize what I want to do:</p>
<ol>
<li><p>I have a sun ray (parallel light) which is reflected at the inner wall of a cylinder,i.e. I have the input vector and direction theta_in.</p>
</li>
<li><p>From this I can calculate the reflected vector. Now, I can generate a outgoing vector with the help of importance sampling of the - say modified Phong model. How to do this is given in the Lafortune &amp; Williams paper.</p>
</li>
<li><p>If I'm correct, this modified Phong model includes the input direction via the cosine term which gives the cosine between the perfect specular reflective direction and the outgoing direction.</p>
</li>
<li><p>The diffusive part of the modified Phong model doesn't include any input direction.</p>
</li>
<li><p>Is it correct to multiply these values by I0*cos(theta_in) in order to get the output intensity?</p>
</li>
</ol>
<p>Thanks again,</p>
<p>Uwe</p>

CC BY-SA 4.0
2023-10-07T14:46:44.837Z
If I recall correctly, the power cosine term in modified Phong BRDF is the cosine value between reflected light direction and the outgoing direction. There should be yet another cosine term representing the geometry term $n\cdot l$. So there should be two different cosine terms. You should multiply mod-Phong power cosine with $I_0 \cos\theta_{in}$. However, diffusive part does include input direction from the emitter (its own cosine term $n\cdot l$). That is, almost all the surface reflection should carry this cosine attenuation term after being multiplied by its own BRDF throughput.
Enigmatisms
CC BY-SA 4.0
2023-10-07T11:52:47.513Z
2023-10-07T11:52:47.513Z
Uwe Nass
<p>thanks Enigmatisms for your answer. But unfortunately I thought it is just the other way around..... Is there anybody else who can contribute to this problem.</p>
<p>Rereading your first (edited?) answer, I came to the conclusion, that if f is the modified Phong probability function, then both parts have to be multiplied by the cosine of the angle between the incoming light ray and the oütgoing one. Correct?</p>
<p>Uwe</p>

CC BY-SA 4.0
2023-10-08T02:14:53.090Z
I edit my answer to give more information on this topic, you can take a look at it.
Enigmatisms
CC BY-SA 4.0
2023-10-08T15:17:43.760Z
Yes, but be sure to distinguish between probability function $p(x)$ and evaluation function $f(x)$ (MC estimator is $f(x) / p(x)$). f is, more precisely, modified Phong BRDF evaluation function (which is the nominator). The denominator (PDF) can have any form.
Enigmatisms
CC BY-SA 4.0
2023-10-09T03:33:01.283Z
Hi, Uwe! Welcome to site! Just a heads up, you can click "add comment" at the bottom of answers to your question to ask for clarification or whatever. Try to use the answer box just for answers. BTW it's ok to answer your own question if you're writing, you know, an *answer* to the question. Like if you figure out a different way than the others. You can always comment on your own question. After a few upvotes you can comment everywhere.
luser droog
CC BY-SA 4.0
2023-10-07T15:50:38.397Z
2023-10-08T11:00:18.473Z
2023-10-08T11:00:18.473Z
Uwe Nass
<p>to get the radiance of the Lambertian diffuse reflected light, I have to multiply the constant pdf (rho/pi) with the incoming intensity I0*cos(theta_i), where cos(theta_i) is given by the scalar Product &lt;n *I&gt; and n is the normal vector for this problem (correct?). Now, if I add the Phong BRDF I'm confused. In the pdf here, there is an &lt;n * I&gt; in the denominator or not. In the first case the reflected intensity is proportional to &lt;n * I&gt;, but not in the second case. What's right?</p>
<p>Uwe</p>

<raytracing><brdf>
How to calculate the radiance of the reflected light ray using the Blin Phong BRDF
Uwe Nass
# How to calculate the radiance of the reflected light ray using the Blin Phong BRDF

(Asked by: username_0 on 2023-10-06)

to get the radiance of the Lambertian diffuse reflected light, I have to multiply the constant pdf (rho/pi) with the incoming intensity I0\*cos(theta\_i), where cos(theta\_i) is given by the scalar Product <n \*I> and n is the normal vector for this problem (correct?). Now, if I add the Phong BRDF I'm confused. In the pdf here, there is an <n \* I> in the denominator or not. In the first case the reflected intensity is proportional to <n \* I>, but not in the second case. What's right?

Uwe

**Tags:** raytracing, brdf


---

## 3 answers

### Answer by username_1 on 2023-10-07. Score: 1

I believe you have a misunderstanding for the BRDF sampling process: PDF can be almost arbitrary if PDF is non-zero at the correspondig point where the integrand is non-zero. We don't even have to importance sampling BRDF just for simplicity (though uniformly sampling everything can be extremely inefficient). So, "in the pdf here", we don't know whether there should be a cosine term unless we know exactly what kind of sampling method you are using.

Normally, we wish to be more efficient so we will importance-sample the integrand, then we wish to match the sampling PDF with the integrand as closely as possible . So, let's therefore look at the Blinn-Phong (or Phong) BRDF, it has a power cosine term so the best practice is to use power cosine-weighted hemisphere sampling, but the original cosine hemisphere sampling would work, too. For these two sampling methods, you can refer to [Sampling the hemisphere](https://ameye.dev/notes/sampling-the-hemisphere/), which has thorough explanation and derivation for how you get the sample and its PDF.

So for your question: Lambertian BRDF indeed has a cosine term which means that your are correct, Phong and Blinn-Phong have power cosine term so the throughput is proportional to $(\cos\theta)^\alpha$, but it won't hurt to use the same sampling method as Lambertian BRDF and get the same PDF for each sample, though it's suboptimal.

BTW, I think your question should be improved in the following ways:

* Use Latex to improve the readability of your post.
* Clearly list your question and related subjects. For example, I am not sure whether you are confused about Phong model or Blinn-Phong model since these two differ in what kind of vector they sample. For clearer understanding of sampling Blinn-Phong model, you can refer to another answer of mine [sampling-of-the-blinn-phong-brdf-in-pathtracing](https://computergraphics.stackexchange.com/questions/13633/importance-sampling-of-the-blinn-phong-brdf-in-pathtracing/13636#13636).

---

Update for further explanation, and I need to remind you that you can **comment** below my answer or my comment instead of posting your own answer.

Well let's get this straight. The following figure shows the local light interaction:
[![enter image description here](https://i.sstatic.net/3jGRG.png)](https://i.sstatic.net/3jGRG.png)

So, your modified Phong BRDF is actually:
$$
k\_d \frac{1}{\pi} + k\_s \frac{n+2}{2\pi}\cos^n\alpha
$$
Yes, like I said, there is only one cosine term in the BRDF, which is $\cos\alpha$. Note that 'outgoing' direction is $\pmb{v}$ since this follows the convention of light tracing.

So are we done? No, the surface rendering equation is:
$$
I(x, w) = \int\_{\Omega}f(x, w, w')<w, w'>dw'
$$
and here, $<w, w'>$ means normalized dot product (cosine). So it doesn't matter whether you are dealing with diffusive lobe or specular lobe (unless it is mirror-specular), $\cos\theta$ always follows. You can find this in the code of PBR-book (from pbrt-v3, `src/integrator/path.cpp`):

```cpp
// Account for the indirect subsurface scattering component
Spectrum f = pi.bsdf->Sample_f(pi.wo, &wi, sampler.Get2D(), &pdf,
                                BSDF_ALL, &flags);
if (f.IsBlack() || pdf == 0) break;
beta *= f * AbsDot(wi, pi.shading.n) / pdf;

```

You see, `pi.bsdf->Sample_f` will evaluate BRDF value and assign it to f, but to get the real path through put `beta`, one must have $\cos\theta$ (`AbsDot(wi, pi.shading.n)`) since this is the **geometry term that would convert the solid angle measure to area product measure** (see [Veach Chapter 8: A Path Integral Formulation of Light Transport](https://graphics.stanford.edu/courses/cs348b-03/papers/veach-chapter8.pdf) for more information on this topic). So the problem falls back to: (1) I need to incorporate all cosine term to get the correct radiance (but for BRDF evaluation, $\cos\theta$ is not needed) (2) the PDF in the denominator (as I explained in the upper part of this answer).


---

### Answer by username_0 on 2023-10-07. Score: 0

thanks a lot for your given informations! Let me summarize what I want to do:

1. I have a sun ray (parallel light) which is reflected at the inner wall of a cylinder,i.e. I have the input vector and direction theta\_in.
2. From this I can calculate the reflected vector. Now, I can generate a outgoing vector with the help of importance sampling of the - say modified Phong model. How to do this is given in the Lafortune & Williams paper.
3. If I'm correct, this modified Phong model includes the input direction via the cosine term which gives the cosine between the perfect specular reflective direction and the outgoing direction.
4. The diffusive part of the modified Phong model doesn't include any input direction.
5. Is it correct to multiply these values by I0\*cos(theta\_in) in order to get the output intensity?

Thanks again,

Uwe

> **Comments:**
> **username_1**: If I recall correctly, the power cosine term in modified Phong BRDF is the cosine value between reflected light direction and the outgoing direction. There should be yet another cosine term representing the geometry term $n\cdot l$. So there should be two different cosine terms. You should multiply mod-Phong power cosine with $I_0 \cos\theta_{in}$. However, diffusive part does include input direction from the emitter (its own cosine term $n\cdot l$). That is, almost all the surface reflection should carry this cosine attenuation term after being multiplied by its own BRDF throughput.  

---

### Answer by username_0 on 2023-10-07. Score: 0

thanks username_1 for your answer. But unfortunately I thought it is just the other way around..... Is there anybody else who can contribute to this problem.

Rereading your first (edited?) answer, I came to the conclusion, that if f is the modified Phong probability function, then both parts have to be multiplied by the cosine of the angle between the incoming light ray and the oütgoing one. Correct?

Uwe

> **Comments:**
> **username_1**: I edit my answer to give more information on this topic, you can take a look at it.  
> **username_1**: Yes, but be sure to distinguish between probability function $p(x)$ and evaluation function $f(x)$ (MC estimator is $f(x) / p(x)$). f is, more precisely, modified Phong BRDF evaluation function (which is the nominator). The denominator (PDF) can have any form.  
> **username_2**: Hi, Uwe! Welcome to site! Just a heads up, you can click "add comment" at the bottom of answers to your question to ask for clarification or whatever. Try to use the answer box just for answers. BTW it's ok to answer your own question if you're writing, you know, an *answer* to the question. Like if you figure out a different way than the others. You can always comment on your own question. After a few upvotes you can comment everywhere.  

---

