Open dictoon opened 10 years ago
Some details:
Currently, to sample so-called mesh lights (i.e. mesh objects with a light-emitting material), we proceed as follow:
Before rendering:
During rendering, when a light sample is needed:
The problem with this very naïve approach is when you mix area lights with few triangles and area lights with many triangles. The algorithm above will allocate many more samples to area lights with few triangles, resulting in a lot of noise from area lights with many triangles.
A simple fix is to group triangles by area lights, and first pick a random area light, then pick a random triangle on that area light (and finally pick a random point on that triangle, but that part doesn't change).
I believe all the changes should happen in lightsampler.cpp (and the corresponding header file).
Is every triangle should have a factor depending on its surface area (or energy)?
In the current implementation, the probability of picking a given triangle is already proportional to its surface area. We could however pick triangles according to their "non-occluded contribution", i.e. taking their emission power into account. However Nathan's BVH-guided sampling approach is more general and I think that's where we should be heading next.
Sampling a mixture of area lights where some have many polygons and some have few results in massive noise for those that have few polygons.
The solution is to allocate the same number of samples to all lights, regardless of the number of polygons they have (it is then possible to allocate more samples to lights contributing the most noise by adjusting their importance multiplier).