<p>I am studying Monte Carlo Path Tracing from different sources. However, I have some confusion about the <code>sampling</code> part and dare to post here for experts' clarification.</p>
<p>Most of the <a href="https://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing/introduction-global-illumination-path-tracing.html" rel="nofollow noreferrer">sources</a> present path tracing as figure below:</p>
<p><a href="https://i.sstatic.net/qGWLom.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qGWLom.png" alt="enter image description here" /></a></p>
<p>This represents, the light ray starts from the camera/eye, has 3 bounces (whatever is the predefined bounce number), and then hits the light source (<code>L_e &gt;0</code>). If I am not wrong, when a ray hits the surface, it has surface information like <code>normal</code> and <code>material</code>. So if it hits a diffuse surface, it will flow the output angle wrt. the normal anywhere in the scene until the next hit (below figure).</p>
<p>I assume in this figure above, I have one sample per pixel, and that sample is traveling throughout the scene (the deep orange color ray). The rest of the 5 rays are randomly generated reflected rays over the hemisphere (point <code>P</code> in the above figure).</p>
<p><a href="https://i.sstatic.net/2wSpum.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2wSpum.png" alt="enter image description here" /></a></p>
<blockquote>
<p><strong>Question:</strong> Can I call this one primary ray to 5 other reflected ray creation <code>ray splitting</code>? How do I define these 5 random <code>splitting</code>? Is it the <code>hemisphere sampling</code>? with some pseudorandom number generation like <code>LCG, TEA</code>?</p>
</blockquote>
<p>Now come to the second confusing point, according to <code>pbr book</code>, each sample is a complete path in the path tracing algorithm. If that is true, according to the first figure, I am just shooting one sample (one path) like below. but the first figure shows I am actually creating <code>6*6*6 =216</code> paths within 3 bounces. How that could be possible?</p>
<p><a href="https://i.sstatic.net/oZXESs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oZXESs.png" alt="enter image description here" /></a></p>
<p>Now, if I shoot multiple samples per pixel, like the figure below, I guess that should follow some pattern as well (lets say, adaptive sampling)</p>
<p><a href="https://i.sstatic.net/Hf9D3s.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Hf9D3s.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/IctW4m.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IctW4m.png" alt="enter image description here" /></a></p>
<p>Now, instead of shooting at a point, the <code>light rays</code> will hit in a similar area and finally the average the <code>final color</code> value.</p>
<blockquote>
<p><strong>Question</strong> How this <code>pixel sampling</code> is different than the hemisphere sampling?</p>
</blockquote>
<p>My whole understanding is like this, I guess if I shoot 5 primary rays, they will hit the surface in 5 different points (similar area), and reflect according to the material and attenuation. However, I need to create <code>hemisphere sampling</code> separately for the hemisphere and determine, how many random points I am going to create over the hemisphere. <strong>Am I right?</strong></p>
<p>Instead of these two types of sampling, I also see there are <code>material sampling</code>, <code>light sampling</code>, etc. Is there any other type of sampling?</p>

CC BY-SA 4.0
2023-11-28T17:23:56.663Z
In most cases you do not want to split, just pick a direction for your current ray at each bounce. The sampling is typically done wrt some demsity that would cancel some terms causing variance in the rendering equation.
lightxbulb
CC BY-SA 4.0
2023-11-28T18:56:36.473Z
@lightxbulb, u mean generating multiple samples per pixel, and that multiple samples hitting the the surface, then taking random directions over the hemisphere? How can it be a random direction when their reflecting direction should follow their properties, e.g., mirror will reflect most of the rays parallel.
bim
CC BY-SA 4.0
2023-11-28T19:04:49.720Z
Perfect specular interactions are special (perfect reflection and perfect refraction) - there you don't really sample anything and reflect/refract along the only possible path. The physically plausible materials however scatter in multiple directions so they require an integral to model this scattering. The random sampling is a strategy for the numerical estimation of that integral.
lightxbulb
CC BY-SA 4.0
2023-12-07T09:00:13.563Z
`sampling is typically done wrt some density`- recently I was reading about Importance Sampling, where sampling either happens wrt the material, or the light source, and Multiple Importance Sampling does consider both. Instead of perfect specular material, most material has BRDF properties (specular+diffuse). So that means, once the light ray/s hit the surface, I have to make some random sampling choice (not exactly following the light path as they should reflect or refract according to the physics)? But make it Randomly? Right?
bim
CC BY-SA 4.0
2023-12-07T09:01:14.970Z
And, if the above case is right, then I still have another sampling left at the pixel space where the multiple samples are shot from. Right?
bim
CC BY-SA 4.0
2023-12-07T20:58:03.400Z
If you have $k$ iterated integrals you would typically sample $k$ random numbers in Monte Carlo in order to account for the integrals. E.g. without additional constraints at each bounce you would sample two numbers for the direction of the bounce. At the pixel you would sample 2 numbers for the point within it. If you have a non-pinhole camera you wouod use another 2 numbers for the aperture, etc. If you have a spectral path tracer you would sample also wavelength, if you need motion blur - then you would sample also time and so on. Read Veach's thesis.
lightxbulb
<raytracing><pathtracing><importance-sampling><monte-carlo><hemisphere>
Confusion about different sampling strategies in Monte Carlo Path Tracing
bim
# Confusion about different sampling strategies in Monte Carlo Path Tracing

(Asked by: username_0 on 2023-11-28)

I am studying Monte Carlo Path Tracing from different sources. However, I have some confusion about the `sampling` part and dare to post here for experts' clarification.

Most of the [sources](https://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing/introduction-global-illumination-path-tracing.html) present path tracing as figure below:

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

This represents, the light ray starts from the camera/eye, has 3 bounces (whatever is the predefined bounce number), and then hits the light source (`L_e >0`). If I am not wrong, when a ray hits the surface, it has surface information like `normal` and `material`. So if it hits a diffuse surface, it will flow the output angle wrt. the normal anywhere in the scene until the next hit (below figure).

I assume in this figure above, I have one sample per pixel, and that sample is traveling throughout the scene (the deep orange color ray). The rest of the 5 rays are randomly generated reflected rays over the hemisphere (point `P` in the above figure).

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

> **Question:** Can I call this one primary ray to 5 other reflected ray creation `ray splitting`? How do I define these 5 random `splitting`? Is it the `hemisphere sampling`? with some pseudorandom number generation like `LCG, TEA`?

Now come to the second confusing point, according to `pbr book`, each sample is a complete path in the path tracing algorithm. If that is true, according to the first figure, I am just shooting one sample (one path) like below. but the first figure shows I am actually creating `6*6*6 =216` paths within 3 bounces. How that could be possible?

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

Now, if I shoot multiple samples per pixel, like the figure below, I guess that should follow some pattern as well (lets say, adaptive sampling)

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

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

Now, instead of shooting at a point, the `light rays` will hit in a similar area and finally the average the `final color` value.

> **Question** How this `pixel sampling` is different than the hemisphere sampling?

My whole understanding is like this, I guess if I shoot 5 primary rays, they will hit the surface in 5 different points (similar area), and reflect according to the material and attenuation. However, I need to create `hemisphere sampling` separately for the hemisphere and determine, how many random points I am going to create over the hemisphere. **Am I right?**

Instead of these two types of sampling, I also see there are `material sampling`, `light sampling`, etc. Is there any other type of sampling?

**Tags:** raytracing, pathtracing, importance-sampling, monte-carlo, hemisphere

> **Comments:**
> **username_1**: In most cases you do not want to split, just pick a direction for your current ray at each bounce. The sampling is typically done wrt some demsity that would cancel some terms causing variance in the rendering equation.  
> **username_0**: @username_1, u mean generating multiple samples per pixel, and that multiple samples hitting the the surface, then taking random directions over the hemisphere? How can it be a random direction when their reflecting direction should follow their properties, e.g., mirror will reflect most of the rays parallel.  
> **username_1**: Perfect specular interactions are special (perfect reflection and perfect refraction) - there you don't really sample anything and reflect/refract along the only possible path. The physically plausible materials however scatter in multiple directions so they require an integral to model this scattering. The random sampling is a strategy for the numerical estimation of that integral.  
> **username_0**: `sampling is typically done wrt some density`- recently I was reading about Importance Sampling, where sampling either happens wrt the material, or the light source, and Multiple Importance Sampling does consider both. Instead of perfect specular material, most material has BRDF properties (specular+diffuse). So that means, once the light ray/s hit the surface, I have to make some random sampling choice (not exactly following the light path as they should reflect or refract according to the physics)? But make it Randomly? Right?  
> **username_0**: And, if the above case is right, then I still have another sampling left at the pixel space where the multiple samples are shot from. Right?  
> **username_1**: If you have $k$ iterated integrals you would typically sample $k$ random numbers in Monte Carlo in order to account for the integrals. E.g. without additional constraints at each bounce you would sample two numbers for the direction of the bounce. At the pixel you would sample 2 numbers for the point within it. If you have a non-pinhole camera you wouod use another 2 numbers for the aperture, etc. If you have a spectral path tracer you would sample also wavelength, if you need motion blur - then you would sample also time and so on. Read Veach's thesis.  

---

## 0 answers

