<p>Bidirectional path tracing is not required, but it would be good to have one if you have free time to kill (since it is complex):</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th style="text-align: center;">BDPT</th>
<th style="text-align: center;">PT</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><a href="https://i.sstatic.net/65EwIoAB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/65EwIoAB.png" alt="enter image description here" /></a></td>
<td style="text-align: center;"><a href="https://i.sstatic.net/yrC3Amh0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yrC3Amh0.png" alt="enter image description here" /></a></td>
</tr>
</tbody>
</table></div>
<p>It's obvious that for complex situations (the ray penetrates 6 layers of medium interfaces), caustics under the jugs can be successfully rendered yet PT completely fails. Yet surely as you say, for simpler cases (like a glass sphere) PT might work, too.</p>
<p>@lightbulb offered some choices, but as you know:</p>
<ul>
<li>Photon mapping is quite <em>bidirectional</em>, as you will first trace photon pass and cache all the photons in a tree, which is even more laborous.</li>
<li>Metropolis light transport is a very good method for rendering caustics, yet it is also complex and might have more inferior results in caustics-free scenes.</li>
</ul>
<p>Here are two other possible ways:</p>
<h4>Specular manifold exploration</h4>
<p>Check <a href="https://blogs.autodesk.com/media-and-entertainment/wp-content/uploads/sites/162/SpecularManifolds_Sig2020.pdf" rel="nofollow noreferrer">Specular Manifold Exploration</a> for more details. This method can be integrated into a undirectional PT. Simply put, the algorithm works in the following way. Let's take a look at the simple example setup where we consider the NEE problem in a refractive medium. As you can see in the figure, the direct connection is blocked due to the medium interface and this direction is simply invalidated, due to refraction. Yet we know that this scene is actually very simple, if we can find a refraction light path, the NEE problem is solved. So we will take a <em>manifold walk</em> on the geometry (through tangential steps and projection, etc.), starting from an incorrect path and converging to the correct root (yes, this is a root finding problem):</p>
<p><a href="https://i.sstatic.net/gwd9H29I.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gwd9H29I.png" alt="enter image description here" /></a></p>
<p>Also, you can check this <a href="https://github.com/tizian/manifold-visualizer" rel="nofollow noreferrer">2D-manifold-visualizer</a> they offered. They even have built-in MNEE.</p>
<h4>Blender</h4>
<p>Blender supports <strong>path guiding</strong>. Path guiding is a way to: (1) trace adjoint paths and record incident rays to train a (typically) probability mixture model, and then during path tracing, we query the space of the current hit point and sample from the mixture to get better ray directions (whose sampling probability better approximate the Monte Carlo integrand and thus has lower variance). I can't find the option on my device since my blender is too old (3.0), I think it is supported since 3.6 or 3.7? Can't recall, but I do have used this before. MNEE is also supported since 3.2 for caustics rendering.</p>
<p>Path guiding is not so easy to implement, since not only should you construct a spatial partitioning structure, you might also need to partition the direction space. Training the mixture (or neural net) also takes some time. Yet if you work on Intel CPU (I know you don't since your path tracer is based on HITRT), intel does provide a library for path guiding.</p>

CC BY-SA 4.0
2024-06-25T17:19:42.353Z
Is there a "naive" equivalent to the algorithm proposed in this paper? I'm thinking something very simple to start with, like lightxbulb proposed if that's a reasonable approach
Tom Clabault
CC BY-SA 4.0
2024-06-26T02:02:14.743Z
I myself have implemented BDPT in my own renderer and the implementation is based on things learned from pbr-book (edition 3). In terms of difficulty, BDPT might be the one that has the most references, as pointed out by @lightxbulb. Yet BDPT is not simple either (its MIS is not). As for naive equivalent, AFAIK there is none, you can check this [discussion](https://devtalk.blender.org/t/thoughts-on-including-specular-manifold-sampling-metropolis-implementation/18542) out. Note that specular manifold sampling and path guiding both have opensource code.
Enigmatisms
CC BY-SA 4.0
2024-06-26T02:02:45.003Z
Or you can try light tracing and try to merge light tracing with path tracing.
Enigmatisms
CC BY-SA 4.0
2024-06-26T10:26:42.543Z
Light tracing + standard path tracing is bdpt, as is NEE + standard path tracing. It's all special cases where only some subset of the strategies are considered.
lightxbulb
CC BY-SA 4.0
2024-06-26T12:07:33.297Z
You bet, but BDPT surely considers more cases. The most pain-inducing ones are forward / backward PDF recording and MIS, they are basically why BDPT is so powerful but it is easy to write buggy code for them. Naively fusing light tracing and path tracing won't request that much work.
Enigmatisms
CC BY-SA 4.0
2024-06-25T16:19:08.627Z
2024-06-25T16:19:08.627Z
Enigmatisms
<p>When doing next event estimation, you trace a shadow ray to a light source to test visibility. What if there's a glass/transmissive object in the way? The light will be occluded and we won't get any caustics at all (not even talking about convergence).</p>
<p>Not doing next event estimation (only accounting for emission when directly hitting emissive geometry) does produce caustics though. However, not doing direct lighting estimation does hurt convergence a lot.</p>
<p>Isn't there some way to have caustics even with next event estimation? Would recursively tracing a ray when our shadow ray hits something until we hit an emissive object be a solution?</p>
<p>How does Blender do it for example?</p>
<p>Is bi-directional path tracing of some sort <strong>required</strong>?</p>
<p>There are some posts already which discuss this issue but I couldn't really find a satisfactory answer.</p>

CC BY-SA 4.0
2024-06-25T14:25:47.860Z
You combine NEE with the standard approach using multiple importance sampling. This will not improve the covergence though. Bi-directional path tracing further generalizes this. You can also look at photon mapping and vertex connection and merging. Additionally metropolis light transport and path guiding. All of the things mentioned can boost convergence.
lightxbulb
CC BY-SA 4.0
2024-06-25T15:37:22.547Z
@lightxbulb So do you mean that, if I'm already sampling my direct lighting with MIS BSDF + light sample, I would add another sampling strategy which is just tracing a ray recursively to try and directly hit emissive geometry?
Tom Clabault
CC BY-SA 4.0
2024-06-25T19:58:35.633Z
Just read some exposition on bdpt. There are nice pictures illustrating it in Veach's thesis, in Georgiev's thesis, in pbrt, in mitsuba, etc. The simplest thing you can do is use standard solid angle sampling + NEE with MIS which would give you some of the benefits of both. This is in fact a special case of bdpt, the latter just adds extra strategies and complexity.
lightxbulb
CC BY-SA 4.0
2024-06-26T05:34:34.560Z
@lightxbulb Sounds good thanks!
Tom Clabault
<raytracing><pathtracing><refraction>
How to have caustics at all in a path tracer with next event estimation?
Tom Clabault
# How to have caustics at all in a path tracer with next event estimation?

(Asked by: username_0 on 2024-06-23)

When doing next event estimation, you trace a shadow ray to a light source to test visibility. What if there's a glass/transmissive object in the way? The light will be occluded and we won't get any caustics at all (not even talking about convergence).

Not doing next event estimation (only accounting for emission when directly hitting emissive geometry) does produce caustics though. However, not doing direct lighting estimation does hurt convergence a lot.

Isn't there some way to have caustics even with next event estimation? Would recursively tracing a ray when our shadow ray hits something until we hit an emissive object be a solution?

How does Blender do it for example?

Is bi-directional path tracing of some sort **required**?

There are some posts already which discuss this issue but I couldn't really find a satisfactory answer.

**Tags:** raytracing, pathtracing, refraction

> **Comments:**
> **username_1**: You combine NEE with the standard approach using multiple importance sampling. This will not improve the covergence though. Bi-directional path tracing further generalizes this. You can also look at photon mapping and vertex connection and merging. Additionally metropolis light transport and path guiding. All of the things mentioned can boost convergence.  
> **username_0**: @username_1 So do you mean that, if I'm already sampling my direct lighting with MIS BSDF + light sample, I would add another sampling strategy which is just tracing a ray recursively to try and directly hit emissive geometry?  
> **username_1**: Just read some exposition on bdpt. There are nice pictures illustrating it in Veach's thesis, in Georgiev's thesis, in pbrt, in mitsuba, etc. The simplest thing you can do is use standard solid angle sampling + NEE with MIS which would give you some of the benefits of both. This is in fact a special case of bdpt, the latter just adds extra strategies and complexity.  
> **username_0**: @username_1 Sounds good thanks!  

---

## 1 answers

### Answer by username_2 on 2024-06-25. Score: 4 | Accepted answer

Bidirectional path tracing is not required, but it would be good to have one if you have free time to kill (since it is complex):

| BDPT | PT |
| --- | --- |
| [enter image description here](https://i.sstatic.net/65EwIoAB.png) | [enter image description here](https://i.sstatic.net/yrC3Amh0.png) |

It's obvious that for complex situations (the ray penetrates 6 layers of medium interfaces), caustics under the jugs can be successfully rendered yet PT completely fails. Yet surely as you say, for simpler cases (like a glass sphere) PT might work, too.

@lightbulb offered some choices, but as you know:

* Photon mapping is quite *bidirectional*, as you will first trace photon pass and cache all the photons in a tree, which is even more laborous.
* Metropolis light transport is a very good method for rendering caustics, yet it is also complex and might have more inferior results in caustics-free scenes.

Here are two other possible ways:

#### Specular manifold exploration

Check [Specular Manifold Exploration](https://blogs.autodesk.com/media-and-entertainment/wp-content/uploads/sites/162/SpecularManifolds_Sig2020.pdf) for more details. This method can be integrated into a undirectional PT. Simply put, the algorithm works in the following way. Let's take a look at the simple example setup where we consider the NEE problem in a refractive medium. As you can see in the figure, the direct connection is blocked due to the medium interface and this direction is simply invalidated, due to refraction. Yet we know that this scene is actually very simple, if we can find a refraction light path, the NEE problem is solved. So we will take a *manifold walk* on the geometry (through tangential steps and projection, etc.), starting from an incorrect path and converging to the correct root (yes, this is a root finding problem):

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

Also, you can check this [2D-manifold-visualizer](https://github.com/tizian/manifold-visualizer) they offered. They even have built-in MNEE.

#### Blender

Blender supports **path guiding**. Path guiding is a way to: (1) trace adjoint paths and record incident rays to train a (typically) probability mixture model, and then during path tracing, we query the space of the current hit point and sample from the mixture to get better ray directions (whose sampling probability better approximate the Monte Carlo integrand and thus has lower variance). I can't find the option on my device since my blender is too old (3.0), I think it is supported since 3.6 or 3.7? Can't recall, but I do have used this before. MNEE is also supported since 3.2 for caustics rendering.

Path guiding is not so easy to implement, since not only should you construct a spatial partitioning structure, you might also need to partition the direction space. Training the mixture (or neural net) also takes some time. Yet if you work on Intel CPU (I know you don't since your path tracer is based on HITRT), intel does provide a library for path guiding.

> **Comments:**
> **username_0**: Is there a "naive" equivalent to the algorithm proposed in this paper? I'm thinking something very simple to start with, like username_1 proposed if that's a reasonable approach  
> **username_2**: I myself have implemented BDPT in my own renderer and the implementation is based on things learned from pbr-book (edition 3). In terms of difficulty, BDPT might be the one that has the most references, as pointed out by @username_1. Yet BDPT is not simple either (its MIS is not). As for naive equivalent, AFAIK there is none, you can check this [discussion](https://devtalk.blender.org/t/thoughts-on-including-specular-manifold-sampling-metropolis-implementation/18542) out. Note that specular manifold sampling and path guiding both have opensource code.  
> **username_2**: Or you can try light tracing and try to merge light tracing with path tracing.  
> **username_1**: Light tracing + standard path tracing is bdpt, as is NEE + standard path tracing. It's all special cases where only some subset of the strategies are considered.  
> **username_2**: You bet, but BDPT surely considers more cases. The most pain-inducing ones are forward / backward PDF recording and MIS, they are basically why BDPT is so powerful but it is easy to write buggy code for them. Naively fusing light tracing and path tracing won't request that much work.  

---

