Direct Light Sampling Cache (aka Light cache part I)

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Direct Light Sampling Cache (aka Light cache part I)

Post 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
Support LuxCoreRender project with salts and bounties
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

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

Post by Sharlybg »

So beautifull and wonderfull to have such power under your finger. The first time an opensource engine enter caching tech.
;)
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

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

Post by B.Y.O.B. »

I'm on the edge of my seat :)
Attachments
1524877785581.png
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

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

Post 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.
Support LuxCoreRender project with salts and bounties
patrickawalz
Supporting Users
Posts: 35
Joined: Tue Dec 05, 2017 1:45 pm

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

Post 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?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

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

Post 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
Support LuxCoreRender project with salts and bounties
patrickawalz
Supporting Users
Posts: 35
Joined: Tue Dec 05, 2017 1:45 pm

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

Post 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
User avatar
Dez!
Posts: 368
Joined: Sun Apr 08, 2018 1:09 am
Location: Ekaterinburg
Contact:

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

Post by Dez! »

What will it be? Even faster rendering?
Linux Plasma | Ryzen 5, 32Gb, SSD M2, GT 590 RX | BenQ 27 | Wacom One | Microsoft Ergo | Tie Guan Yin tea
http://dezigner.tilda.ws/
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

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

Post 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.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
Dez!
Posts: 368
Joined: Sun Apr 08, 2018 1:09 am
Location: Ekaterinburg
Contact:

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

Post 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?
Linux Plasma | Ryzen 5, 32Gb, SSD M2, GT 590 RX | BenQ 27 | Wacom One | Microsoft Ergo | Tie Guan Yin tea
http://dezigner.tilda.ws/
Post Reply