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

Erik Englesson erikenglesson at gmail.com
Sat May 26 08:01:25 CEST 2018


Hi all,

I hope you have had a good week!

This week I had a look at the code related to the building of a bounding
volume hierarchy(BVH) in intern/cycles/bvh/. In my project, I will create a
BVH of light sources instead of geometry, which is why I had a look at this
part of the code. See below for some notes.

*/cycles/bvh/bvh.h/cpp*

*/cycles/bvh/bvh2.h/cpp/cycles/bvh/bvh4.h/cpp*:
Code for BVHs where each node has 2 or 4 children. (BVH2,BVH4 inherits from
BVH) It seems to have two functions of interest:
*BVH::create*: Based on the BVHParams input parameter a BVH2 or BVH4 is
created.
*BVH::build*: Builds the BVH by using a helper class called BVHBuilder

*/cycles/bvh/bvh_params.h*:
Parameters sent to the BVH::create algorithm, e.g. to use BVH2/BVH4,
splitting thresholds, min primitives in leaf nodes etc.

*/cycles/bvh/bvh_node.h/cpp:*
There is a node base class called BVHNode and then InnerNode and LeafNode
inherit from BVHNode. It seems each leaf stores indices to the first and
last triangle they contain in a linear array of triangles. InnerNodes
always stores two pointers to children. Is bvh4 using some other code or
what am I missing?

*/cycles/bvh/bvh_build.cpp:*
Creates the actual BVH in BVHBuilder::run(). The most interesting method
here seems to be build_node(). It is a recursive function that first checks
if it is deep enough to create a leaf, otherwise it splits the node into
child nodes and calls build_node on each child.

BVHBuild takes a vector of Objects to its constructor, but from what I can
see in cycles/render/scene.h, the lights are not part of this array. I will
have to get them into my BVH in another way.

*/cycles/bvh/bvh_split.cpp:*
Algorithms to split a node into two child nodes. There is an object split
method and a spatial split method and a combination of both. This is where
the surface area heuristic(SAH) calculations happen.

Note: BVHBuilder::run() decides which splitting method is used.

*Plan for next week*
I have my final exam on Monday and then I can finally start this project
full-time!

Next week I will have a look a bit more at the code in /cycles/bvh/ and
then start to build my own BVH of lamps. It should be possible to reuse a
lot of the code in bvh_build/bvh_split and I will have to figure out what
the best way to implement my parts will be. Create new classes that uses
code from existing classes either through inheritance or refactor or modify
existing classes, etc.

I will have to get access to light sources in the bvh building process
somehow and create my own splitting method that uses a Surface Area
Orientation Heuristic(SAOH) instead of SAH. To be able to create the SAOH
splitting method, I need more information in each node related to lights,
so I will have to create/modify the node data structure too.

I have planned for all of the mentioned steps to take two weeks to
implement.

Thanks,
Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/soc-2018-dev/attachments/20180526/0dcd1427/attachment-0001.html>


More information about the Soc-2018-dev mailing list