<p>You probably want to set sigma to be a fraction of the radius, rather than a fixed value. Sigma controls the actual shape of the filter, while radius just controls how far out the filter gets cut off (as Gaussians truly have infinite radius, so we have to cut them off somewhere to use them in practice). With sigma set to 0.5, you're making a filter that's very sharply peaked within a radius of 0.5 pixels, which is consistent with the image you're getting.</p>
<p>Instead, try setting sigma = 0.25 or 0.3 times the radius. Or alternatively, make sigma your main parameter and then set the radius to 3 or 4 times sigma.</p>

CC BY-SA 4.0
2021-03-12T19:53:16.763Z
2021-03-12T19:53:16.763Z
Nathan Reed
<p>I want to plot the <a href="https://github.com/mmp/pbrt-v4/blob/08418214e4df767a4e6aa95230821e05f3621da9/src/pbrt/filters.h#L80" rel="nofollow noreferrer">Gaussian filter of pbrt-v4</a> with a radius <span class="math-container">$(100,100)$</span> and a standard deviation (<span class="math-container">$\sigma$</span>) of <span class="math-container">$0.5$</span>.</p>
<p>I would expect something like this:</p>
<p><a href="https://i.sstatic.net/4vlMD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4vlMD.png" alt="enter image description here" /></a></p>
<p>When I plot the pbrt-v4 Gaussian filter with radius <span class="math-container">$(100,100)$</span> and <span class="math-container">$\sigma=0.5$</span> I get:</p>
<p><a href="https://i.sstatic.net/amEEn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/amEEn.png" alt="enter image description here" /></a></p>
<p>Is the 2nd plot correct? I varied the radius form <span class="math-container">$1$</span> to <span class="math-container">$1000$</span> but the the filter size changes only 2 pixels in total (I get a similar results).
Any ideas?
How does the correct plot look like?</p>

<rendering><filtering><gaussian-blur><pbrt><pbrt-v3>
Plotting pbrt-v3 Gaussian filter
Vertexwahn
# Plotting pbrt-v3 Gaussian filter

(Asked by: username_0 on 2021-03-11)

I want to plot the [Gaussian filter of pbrt-v4](https://github.com/mmp/pbrt-v4/blob/08418214e4df767a4e6aa95230821e05f3621da9/src/pbrt/filters.h#L80) with a radius $(100,100)$ and a standard deviation ($\sigma$) of $0.5$.

I would expect something like this:

[![enter image description here](https://i.sstatic.net/4vlMD.png)](https://i.sstatic.net/4vlMD.png)

When I plot the pbrt-v4 Gaussian filter with radius $(100,100)$ and $\sigma=0.5$ I get:

[![enter image description here](https://i.sstatic.net/amEEn.png)](https://i.sstatic.net/amEEn.png)

Is the 2nd plot correct? I varied the radius form $1$ to $1000$ but the the filter size changes only 2 pixels in total (I get a similar results).
Any ideas?
How does the correct plot look like?

**Tags:** rendering, filtering, gaussian-blur, pbrt, pbrt-v3


---

## 1 answers

### Answer by username_1 on 2021-03-12. Score: 3 | Accepted answer

You probably want to set sigma to be a fraction of the radius, rather than a fixed value. Sigma controls the actual shape of the filter, while radius just controls how far out the filter gets cut off (as Gaussians truly have infinite radius, so we have to cut them off somewhere to use them in practice). With sigma set to 0.5, you're making a filter that's very sharply peaked within a radius of 0.5 pixels, which is consistent with the image you're getting.

Instead, try setting sigma = 0.25 or 0.3 times the radius. Or alternatively, make sigma your main parameter and then set the radius to 3 or 4 times sigma.


---

