Previous | Next --- Slide 31 of 64
Back to Lecture Thumbnails
SlimShady

How do we decide the direction of the ray that the light source shoots out? And when do we connect it to the ray that the camera shoots out? I guess I'm still somewhat unclear about how this bidirectional path tracing works...

billiam

I'm also pretty unclear on this. I fail to see how this is can be implemented efficiently. Instead of shooting rays from only the light source, it seems like we shoot rays from both the light source AND the camera and hope that at some point the rays intersect. This would be significantly more costly than just shooting rays out of a single point.

If $\texttt{rc}$ is a ray from the camera and $\texttt{rl}$ is a ray from the light, we need to make a query $\texttt{intersect(rc, rl)}$. But we have to do this for every single pair of camera and light source rays...

motoole2

@SlimShady @billiam The procedure for Bidirectional path tracing is as follows:

Generate a random N-bounce light path, starting from your camera; let's represent this as c -> x_1 -> x_2 -> ... -> x_N-1 (i.e a path defined by N vertices). Now generate a random M-bounce light path, starting from one of your sources; let's represent this path as y_M-1 -> ... -> y_2 -> y_1 -> s`.

Bidirectional path tracing takes these two random paths and connects them together to generate a new path from light source to camera. Given this N-bounce path from the camera and M-bounce path from the source, we can connect the two path segments by drawing a line segment between any two vertices.

For example, we can generate a N+M bounce light path by deterministically connecting the two end points by drawing a line segment between them. That is, we generate a path c -> ... -> x_N-1 -> y_M-1 -> ... s. Now, sometimes this light path won't be valid, because there's an occluder between the vertices x_N-1 and y_M-1. If this is the case, then that path provides no contribution to the image. Other times, this light path is valid and will provide some contribution to the image.

We can also generate two N+M-1 bounce light paths in a similar way: (1) c -> ... -> x_N-2 -> y_M-1 -> ... s, and (2) c -> ... -> x_N-1 -> y_M-2 -> ... s. Or three N+M-2 bounce light paths. And so on. So even though we generated only two initial paths from the camera/source, bidirectional path tracing then creates a bunch more paths by deterministically connecting the vertices in all possible ways.

hii

How do we decide when to connect with the light? We are connecting after 1 bounce on the light side but 2 bounces on the camera side.

motoole2

@hii In bidirectional path tracking, we perform all possible connections. Referring to the slide above where we are given a light path x0->x1 and a camera path x4->x3->x2, the possible paths include:

1. x0->x4
2. x0->x1->x4
3. x0->x3->x4
4. x0->x1->x3->x4
5. x0->x2->x3->x4
6. x0->x1->x2->x3->x4

Each of these paths makes a connection between two vertices from both paths, but not all such paths are valid. For example, in light path 4, if the line segment x1->x3 intersects an object, then this path is culled.