[Soc-2018-dev] Weekly Report #04 - Many Light Sampling

Erik Englesson erikenglesson at gmail.com
Fri Jun 8 19:22:39 CEST 2018


Hi all,

I hope you had a nice week. I have some figures so I created a wiki entry
for the weekly report and it can be found here
<https://wiki.blender.org/index.php/User:Erikenglesson/GSoC_2018/Reports/Week_4#Weekly_Report_-_Week_4>.
I have also copy-pasted the report at the end of this e-mail.

I hope you enjoy the report and have a great weekend!

Thanks,
Erik

----------
This week:

Before this week the light BVH construction code used a simple method to
split a node into two child nodes which was only based on the bounding box
of the node. This week, I have been implementing a new splitting method
that uses the Surface Area Orientation Heuristic(SAOH). This splitting
method considers the energy and directions of the lights within the nodes
as well as the area of the bounding boxes of the nodes. For more
information, see the paper
<https://sites.google.com/site/ckulla/home/many-lights>.

To be more precise, this is what I have been working on this week:

   - *BVH Construction*: Implemented the SAOH method
   - *BVH Construction*: Added energy based on emission to each node (only
   considering point and spotlights)
   - *Light Sampling*: The lights in the scene are not sampled with the
   same probability when using the light BVH. Therefore, the PDFs have to be
   changed to use the correct probabilities. This has been changed to work for
   normal lights but not for mesh lights.
   - *GUI*: Added a checkbox to turn on/off the new light sampling method.
   It is in the Sampling section of the Render tab for now.

The changes mentioned in the first three bullet points are in this commit
<https://developer.blender.org/rB4f55918a5e93e7ab18ea46e3874002986719518b>.
The GUI changes can be found in this commit
<https://developer.blender.org/rBa3826bf41c6a4de9486a0c60c5c3b67587cd2e5f>.

Test:

This is a good point to test the new light sampling method. My brother set
up a simple test scene for me with 100 light sources in a closed room with
some pillars. Below I have some equal time comparisons between the current
light sampling method and the new method I am implementing.

Figure 1 <https://wiki.blender.org/uploads/9/93/Points-old-2m-34s.png>. The
current method with 100 point lights

Figure 2 <https://wiki.blender.org/uploads/3/34/Points-new-2m-34s.png>. The
new method with 100 point lights

Figure 3 <https://wiki.blender.org/uploads/8/86/Spots-old-2m-15s.png>. The
current method with 100 spots

Figure 4 <https://wiki.blender.org/uploads/a/a5/Spots-new-2m-15s.png>. The
new method with 100 spots

Figures 1 and 3 are using the current method and are rendered until they
are finished using 128 samples per pixel and figures 2 and 4 uses the new
method but they were canceled before they were finished. Figure 1 and 2 use
point lights and figures 3 and 4 use spotlights. Figure 1 and 2 took 2m 34s
to render and rendering 100 point lights with the new method using 128
samples until it finished took 3m 6s. Figure 3 and 4 took 2m 15s to render
and rendering 100 spots with the new method using 128 samples until it
finished took 3m 27s.


To summarize, the new method takes longer to finish rendering a picture
using a fixed number of samples per pixels compared to the current method.
However, the rendered picture with the new method is closer to
convergence(less noisy) than the picture rendered with the current method.
Even after the same amount of time.


The construction of the light BVH seems to be really quick so most of the
difference in time seems to come from the light tree BVH traversal. Which
makes sense since it is done so many times.

Plan for next week:

I wanted to quickly implement something that I could test. However, in
doing so, I have cut some corners. I would like to spend next week to clean
up the code, add support for more lights and to prepare the code for the
implementation of the light sampling splitting algorithm. Here are some
parts of the code I am currently not happy with:

   - *intern/cycles/render/light.cpp*: There is some code duplication in
   device_update_tree_distribution() and device_update_distribution()
   - *intern/cycles/render/light_tree.cpp*: Extend get_bbox(), get_bcone()
   and get_energy() to more light sources
   - *intern/cycles/render/light_tree.cpp*: The get_energy() needs to
   correctly extract and convert emission to a single float energy
   - *intern/cycles/kernel/kernel_light.h*: The way I changed the PDFs is a
   bit hacky and I have not updated PDFs for mesh lights. Doing this properly
   would probably require a larger structural change of the existing code. I
   will discuss this with Brecht and Lukas next week.

Also, I would like to make sure the code consistently follows the code
style guidelines.


The light sampling splitting algorithm essentially just picks several light
sources while traversing the light BVH instead of a single one. It seems
the current kernel code would require a structural change to be able to
handle sampling of several light sources at the same time. This is also
something I will discuss with my mentors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/soc-2018-dev/attachments/20180608/46cf70bd/attachment.html>


More information about the Soc-2018-dev mailing list