Skip to content

Conversation

stan4dbunny
Copy link

Hi! Erica here:)

I've created a toggle in GI-1.1 for a completed multibounce feature!

SingleBounce_Sponza_Alcove_None_1691_0 016666
Singlebounce with temporal radiance feedback.

Multibounce_Sponza_Alcove_None_644_0 016668
Multibounce without temporal radiance feedback.

Multibounce

The general idea with multibounce is to extend the ray-path by adding another bounce. The
first bounce cells (the hash grid cells created by the screen probes) will trace rays and create second bounce cells at the hit point. The first bounce cells will then additionally to doing a direct light evaluation, also get the contribution from the second bounce cell, thereby improving the bounce lighting. The contribution from the second bounce cells becomes the
indirect light for the first bounce cells.

The amount of direct light samples and indirect light samples for a cell might be different, and because they are sampled independently we can divide them up into two Monte Carlo estimators and add these together. Because these estimators are estimated over time, we have to have two separate buffers, one for direct and one for indirect light, for each first bounce cell, compared to just the one buffer in singlebounce. There might be ways to minimize the memory stored, but this has not been looked into.

The same visisibilitycellbuffer and visibilityquerybuffer are used, but the multibounce entries come after all the singlebounce (first bounce cell and screen probe) entries.

I've concluded that you don't want to combine multibounce and the normal temporal radiance feedback feature, but there was one scene where it seemed to improve the render.

GI-1 1 1_SingleBounce_BreakfastRoom__User_Reflection__2256_0 016679Reflection
Singlebounce + temporal radiance feedback.

Multibounce_normal_temp
Multibounce + normal temporal radiance feedback.

image
The sections that have been changed.

Steps

Creating second bounce cells

  • After the first bounce cells have been created (PopulateScreenProbes), rays are sent out from the first bounce cells, with the directions determined by cosine-weighted hemisphere sampling, and hash grid cells are created at the hit points, making them the second bounce cells.

Generate reservoirs

  • Now, first bounce cells are added into a "resolve buffer" if temporal radiance feedback wasn't available. The resolve buffer is later gone through when the first bounce cells are resolved into the screen probes.

Generate multibounce reservoirs

  • No filtered bypass as of now, and they aren't added into the resolve buffer. There is a multibounce temporal radiance feedback thing, and sometimes it seems to improve the render but not always.

Update tiles

  • Here the values from the "update value" buffers are accumulated into the "final" value buffers. Because the indirect and directions have to be split, we now have two separate value buffers, as well as two separate "update value" buffers. These are filtered separately based on their sample count.

Resolving second bounce cells into first bounce cells

  • The filtered direct radiance is fetched for the second bounce cells and divided by the sample count, multiplied by the brdf of the first bounce cell, as well as divided by the pdf of the sample. This product is then resolved into the "update indirect value" buffer of the first bounce cell.

Resolving first bounce cells into second bounce cells

  • The filtered direct and indirect radiance is fetched and divided by their respective sample counts, added together finally, and resolved into the screen probe.

Notes

I haven't completely fixed the debug hash grid cell view, because I wasn't sure if there should be for example two separate "filtered gain" views for direct and indirect.

Also, I only fixed multibounce for in-line ray-tracing.

I haven't really optimized anything. Currently, with multibounce, the frame time for GI-1.1 increases (up to 1ms), but there is at least one thing that can be optimized. For example, right now the brdf is evaluated in GenerateReservoirs and again in PopulateMultibounceCells, and sent with the pdf as a float4, as a parameter to PopulateMultibounceCellsTraceRay but it's only used if the ray hits something.

It also seems as if UpdateTiles takes considerable longer now, probably because I added the filtering for the indirect radiance as well, so maybe this could be optimized somehow.

Debug reflection view in PT

Because I wanted to make sure the reflections were correct in multibounce, I tried to recreated the debug reflection view that existed in GI-1.1.

SingleBounce_Sponza_User_Reflection_1350_0 016731Reflection
Singlebounce in reflection view.

Multibounce_Sponza_User_Reflection_806_0 016669Reflection
Multibounce in reflection view.

Pt_Sponza_User_Reflection_1276_0 040956
The path-tracer in reflection view.

I'm not sure if this view works for all settings of the path-tracer, but it works for the default settings at least.

Also

Added support for png screenshots.

Final notes

I'm almost done with my thesis report, so I thought I would maybe link it here when I'm done in case anyone wants to read more, but let me know if anything should be clarified!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant