Page 1 of 5

Direct Light Sampling Cache (aka Light cache part I)

Posted: Sun Jun 10, 2018 4:28 pm
by Dade
Introduction

Direct Light Sampling Cache is intended to accelerate a specific type of scenes where:

1) many light sources are present;

2) light sources affect a limited part of the scene;

like a city with many lamps or a room with many small spot light sources.

Properties

The list of properties, with their default value, for DLSC in a .cfg are:

Code: Select all

lightstrategy.type = DLS_CACHE
lightstrategy.entry.radius = 0.15
lightstrategy.entry.normalangle = 10.0
lightstrategy.entry.maxpasses = 1024
# 0.01 = 1%
lightstrategy.entry.convergencethreshold = 0.01
lightstrategy.entry.volumes.enable = 0
# 0.01 = 1%
lightstrategy.lightthreshold = 0.01
lightstrategy.targetcachehitratio = 0.995
lightstrategy.maxdepth = 4
lightstrategy.maxsamplescount = 10000000;
The only parameter you have to adapt for the scene is the "lightstrategy.entry.radius", it is the cache entry area of validity ad it is expressed in real word unit. So 0.15 means a 15 cm radius if you are rendering with 1m units.

All other parameters should be useful only to handle very specific cases and the default value should work fine for most scenes.

===============================================================================
Original post
===============================================================================

I'm working on the support for Direct Light Sampling Cache (aka Light cache part I or DLSC).

This result shows as little white spheres where the cache entries are placed:
denoised.png
Quite funny, so many little spheres :D

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Sun Jun 10, 2018 4:55 pm
by Sharlybg
So beautifull and wonderfull to have such power under your finger. The first time an opensource engine enter caching tech.
;)

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Sun Jun 10, 2018 5:19 pm
by B.Y.O.B.
I'm on the edge of my seat :)

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Mon Jun 11, 2018 10:21 am
by Dade
DLSC is mostly intended to reduce noise when there are many light sources however, one of the results I will able to obtain, it is to disable direct light sampling for entries that are totally in shadow. This allows me to avoid to trace a shadow ray and speed up the rendering (i.e. less nose, more samples/sec).

This is a rendering with white little spheres on cache entries receiving light and red glowing little spheres for entries in pitch black (from direct light sampling point of view):
cornell.jpg
It isn't a result I originally planned but it is going to be quite useful. Even in a simple scene like the Cornell box, there is a significative amount of shadow rays saved.

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Mon Jun 11, 2018 2:05 pm
by patrickawalz
another thought that is somewhat related (I think) tungsten and pbrt v3 both use a spatial light cache, albeit not exactly what you're doing. tungsten is using solid angle sampling iirc which is supposed to help calculate things faster. I believe pbrt v3 even has solid angle sampling of triangles in their code but doesn't employ it in their light cache. is this something you have looked into?

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Mon Jun 11, 2018 4:24 pm
by Dade
patrickawalz wrote: Mon Jun 11, 2018 2:05 pm another thought that is somewhat related (I think) tungsten and pbrt v3 both use a spatial light cache, albeit not exactly what you're doing. tungsten is using solid angle sampling iirc which is supposed to help calculate things faster. I believe pbrt v3 even has solid angle sampling of triangles in their code but doesn't employ it in their light cache. is this something you have looked into?
I'm working in a somewhat different direction, my idea is to accelerate the rendering of many lights scenes so I build an octree of points where I compute the incoming radiance from all light sources and I use the value to build a Distribution (in PBRT speaking) to samples the light sources according their contribution.

So when I need to compute the direct light of any point in the scene I can use the Distribution of the nearest cached point to sample the most "important" light sources for the point. If the distribution is empty I can even skip direct light sampling all together. Indeed, I have to handle hard shadow borders careful but I have an idea for that problem.

In scenes with many light sources, this method should be vastly superior to the current generic light strategy.

This method is also unbiased.

This idea should be similar to "Adaptive Lights" used in VRay: https://www.chaosgroup.com/blog/underst ... ive-lights

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Mon Jun 11, 2018 4:49 pm
by patrickawalz
interesting - the many light problem has been a hot topic the last couple of years - with a lot of people tackling it - it's always nice to pick your brain and get the reasons behind your decisions and directions you are taking

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Thu Jun 14, 2018 3:24 pm
by Dez!
What will it be? Even faster rendering?

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Thu Jun 14, 2018 4:21 pm
by Sharlybg
Dez! wrote: Thu Jun 14, 2018 3:24 pm What will it be? Even faster rendering?
Fast rendering and super efficient sampling in scene with many light source.

Re: Direct Light Sampling Cache (aka Light cache part I)

Posted: Fri Jun 15, 2018 7:23 am
by Dez!
Sharlybg wrote: Thu Jun 14, 2018 4:21 pm Fast rendering and super efficient sampling in scene with many light source.
Ouuu!!!
Photorealism will remain the same?