PhotonGI cache

Discussion related to the LuxCore functionality, implementations and API.
epilectrolytics
Donor
Donor
Posts: 790
Joined: Thu Oct 04, 2018 6:06 am

Re: PhotonGI cache

Post by epilectrolytics »

epilectrolytics wrote: Thu Feb 14, 2019 11:55 am I will do some testing later with the newest build, thanks for those examples!
Now I did some tests with glossy material and still don't understand what's going on :?

When a potential bias is caused by view dependent information lost because of averaging this should only affect the appearance of glossy cashed materials but never of any diffuse materials.
Because the photon tracing works correctly all resulting cache entries on diffuse surfaces should be true.
Only glossy materials have the problem that directional reflection cannot be represented in the cache and is therefore turned into diffuse by averaging.
So they could be looking different to an unbiased reference depending from view angle.
But diffuse surfaces have always got correct cache values from photon tracing.

I'm setting up an interior with a dark shiny floor (roughness 0.21) that would reflect incoming sunlight towards the ceiling which is diffuse white (walls too).
I render the floor material included in the indirect cache (left side) and excluded from cache (right side, mirrored for better comparison).
Walls and ceiling are always included in caching.
I'm expecting the render on the right side to be unbiased because the problematic glossy floor material has no cache and is rendered by pathtracing only.
Also I expect no difference in ceiling brightness because it is diffuse and has a correct cache representation.

That's what the bottom row debug renders show, both ceilings look the same no matter if the floor is cached or not.
But in the renders above, both PhotonGI on, show different ceiling brightness.
The right one is brighter and I assume that is the correct way because no bias from glossy ground cache in this render.
But the left side shows a darker ceiling though its cache is no different from the right version.
How is that possible?
I thought in case of diffuse when the camera ray hits there is a cache lookup and it is done, no further bouncing, so walls and ceiling should look the same no matter the floor is cached or not.
Is the pathtracing somehow overriding cache lookup?
glosstest.jpg
glosstest_LuxCore.zip
(7.15 KiB) Downloaded 149 times
Last edited by epilectrolytics on Thu Feb 14, 2019 7:46 pm, edited 1 time in total.
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: PhotonGI cache

Post by CodeHD »

I've only read through all the 36 pages today :D
Looks really nice how this works and the results you all show! Thanks for the development effort!

I think it might be useful to make a little recap of the pros and cons of caching, and similarly when to use it and when not. This might be helpful for beginners, and also I want to know if I understood it right ;)

I understand the following from this thread:

- It somewhat bridges the worlds of path tracing and BiDir, although it cannot replace BiDir for scenes that really require it (complex scenes, volumetric stuff?).
- The largest benefit would come when doing animations (with only camera movement?), since the pre-processing is not done for every frame.
- It is biased (at least in the implementation used here)
- It requires diffuse surfaces in the scene because of the requirement of view-angle independence. Actually in that case, does it make a difference if I have a Lambertian or Oren-Nayar surface (matte roughness value)?

What I am unsure about is the animation vs. stills part. Is there any actual performance boost, i.e. will I never want to use Path without cache again? Does it only perform better in a still because I can use path instead of BiDir and get a "good enough" approximation of caustics thourgh the cache?

Let me know if my assessment is correct :D
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: PhotonGI cache

Post by Dade »

epilectrolytics wrote: Thu Feb 14, 2019 7:12 pm
epilectrolytics wrote: Thu Feb 14, 2019 11:55 am I will do some testing later with the newest build, thanks for those examples!
Now I did some tests with glossy material and still don't understand what's going on :?

When a potential bias is caused by view dependent information lost because of averaging this should only affect the appearance of glossy cashed materials but never of any diffuse materials.
Because the photon tracing works correctly all resulting cache entries on diffuse surfaces should be true.
Only glossy materials have the problem that directional reflection cannot be represented in the cache and is therefore turned into diffuse by averaging.
So they could be looking different to an unbiased reference depending from view angle.
But diffuse surfaces have always got correct cache values from photon tracing.
Correct.
epilectrolytics wrote: Thu Feb 14, 2019 7:12 pm I'm setting up an interior with a dark shiny floor (roughness 0.21) that would reflect incoming sunlight towards the ceiling which is diffuse white (walls too).
I render the floor material included in the indirect cache (left side) and excluded from cache (right side, mirrored for better comparison).
Walls and ceiling are always included in caching.
I'm expecting the render on the right side to be unbiased because the problematic glossy floor material has no cache and is rendered by pathtracing only.
Also I expect no difference in ceiling brightness because it is diffuse and has a correct cache representation.

That's what the bottom row debug renders show, both ceilings look the same no matter if the floor is cached or not.
But in the renders above, both PhotonGI on, show different ceiling brightness.
The right one is brighter and I assume that is the correct way because no bias from glossy ground cache in this render.
But the left side shows a darker ceiling though its cache is no different from the right version.
How is that possible?
Is the pathtracing somehow overriding cache lookup?
Nope, you are missing an important point, a cache entry on the ceiling is not used to directly render the ceiling but all other point receiving light from the ceiling. It is an indirect cache after all.

The ceiling is darker because it uses the cache entries on the floor. It is the cache floor to have bias, not the cache ceiling. So the cache has correct ceiling but biased floor. The render has biased ceiling and correct floor. Like I said, it is an indirect cache, not a direct one.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: PhotonGI cache

Post by Dade »

CodeHD wrote: Thu Feb 14, 2019 7:35 pm I've only read through all the 36 pages today :D
Looks really nice how this works and the results you all show! Thanks for the development effort!

I think it might be useful to make a little recap of the pros and cons of caching, and similarly when to use it and when not. This might be helpful for beginners, and also I want to know if I understood it right ;)

I understand the following from this thread:

- It somewhat bridges the worlds of path tracing and BiDir, although it cannot replace BiDir for scenes that really require it (complex scenes, volumetric stuff?).
Correct, it is like a Bidir with a finite number of light paths.
CodeHD wrote: Thu Feb 14, 2019 7:35 pm - The largest benefit would come when doing animations (with only camera movement?), since the pre-processing is not done for every frame.
99% correct, there will be the need only to add to the cache entries for new visible portion of the scene.
CodeHD wrote: Thu Feb 14, 2019 7:35 pm - It is biased (at least in the implementation used here)
Yes.
CodeHD wrote: Thu Feb 14, 2019 7:35 pm - It requires diffuse surfaces in the scene because of the requirement of view-angle independence. Actually in that case, does it make a difference if I have a Lambertian or Oren-Nayar surface (matte roughness value)?
You can use any type of materials but there will be less bias with Lambertian surfaces.
CodeHD wrote: Thu Feb 14, 2019 7:35 pm What I am unsure about is the animation vs. stills part. Is there any actual performance boost, i.e. will I never want to use Path without cache again?
Probably, yes (at least for indirect cache).
CodeHD wrote: Thu Feb 14, 2019 7:35 pm Does it only perform better in a still because I can use path instead of BiDir and get a "good enough" approximation of caustics thourgh the cache?
What do you mean ? Single frame Vs Animation when using caustic cache ?
Support LuxCoreRender project with salts and bounties
epilectrolytics
Donor
Donor
Posts: 790
Joined: Thu Oct 04, 2018 6:06 am

Re: PhotonGI cache

Post by epilectrolytics »

Dade wrote: Thu Feb 14, 2019 7:40 pm Nope, you are missing an important point, a cache entry on the ceiling is not used to directly render the ceiling but all other point receiving light from the ceiling. It is an indirect cache after all.

The ceiling is darker because it uses the cache entries on the floor. It is the cache floor to have bias, not the cache ceiling. So the cache has correct ceiling but biased floor. The render has biased ceiling and correct floor. Like I said, it is an indirect cache, not a direct one.
Thanks for quick response, now it makes sense!
I thought "indirect" meant second and subsequent bounces during the initial photon tracing (photon first hit being direct) and did not imagine it describes render behaviour.
Now finally I get how this thing is working and what the actual difference to photon map final gather is!
:D
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: PhotonGI cache

Post by CodeHD »

Thanks for the quick response Dade!
Dade wrote: Thu Feb 14, 2019 7:47 pm You can use any type of materials but there will be less bias with Lambertian surfaces.
Really ANY? E.g. if you have a scene that is composed of a few light emitters and a bunch of mirrors - a Kaleidoscope?
Dade wrote: Thu Feb 14, 2019 7:47 pm What do you mean ? Single frame Vs Animation when using caustic cache ?
When reading the posts, everyone seemed happy about the fast render times to achieve some noise level. (I can't judge the performance of these architecture scenes myself due to the lack of experience in modelling them ;) ). As these obviously were stills and not animations, it must mean the cache is an improvement even for a single image.

Together with your confirmation of my first point
Dade wrote: Thu Feb 14, 2019 7:47 pm Correct, it is like a Bidir with a finite number of light paths.
let me rephrase my last point:

- Rendering a scene with path only (no cache) may lack important features such as caustics
- BiDir provides good caustics but may be disproportionately slow
- As a result, Path + cache can deliver a good-looking approximation of caustics w/o the additional performance requirement of BiDir. (This would be equivalent to saying it is biased)
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: PhotonGI cache

Post by lacilaci »

CodeHD wrote: Thu Feb 14, 2019 8:19 pm Thanks for the quick response Dade!
Dade wrote: Thu Feb 14, 2019 7:47 pm You can use any type of materials but there will be less bias with Lambertian surfaces.
Really ANY? E.g. if you have a scene that is composed of a few light emitters and a bunch of mirrors - a Kaleidoscope?
Dade wrote: Thu Feb 14, 2019 7:47 pm What do you mean ? Single frame Vs Animation when using caustic cache ?
When reading the posts, everyone seemed happy about the fast render times to achieve some noise level. (I can't judge the performance of these architecture scenes myself due to the lack of experience in modelling them ;) ). As these obviously were stills and not animations, it must mean the cache is an improvement even for a single image.

Together with your confirmation of my first point
Dade wrote: Thu Feb 14, 2019 7:47 pm Correct, it is like a Bidir with a finite number of light paths.
let me rephrase my last point:

- Rendering a scene with path only (no cache) may lack important features such as caustics
- BiDir provides good caustics but may be disproportionately slow
- As a result, Path + cache can deliver a good-looking approximation of caustics w/o the additional performance requirement of BiDir. (This would be equivalent to saying it is biased)
Indirect cache is a cache for indirect lighting.
Caustic cache is a different thing.

As far as performance goes, cache is huge boost for still rendering. Animations will require temporal stability (no flickering) but the performance gain is the same.

Regarding bias. As long as there is no reference it is near impossible to tell the difference. So all the talk about bias is not much worth in real work until there is visibly something wrong(like fireflies or bleeding).

BiDir is not a magical solution. Unless you can use some alternative boost for indirect light, render sds, and use gpus... Real production has little to gain from bidir, performance penalty is too big and while it is still useful, 80-90% of the time you get away with pathtracing. Look at some of the best work from corona or vray...
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: PhotonGI cache

Post by CodeHD »

lacilaci wrote: Thu Feb 14, 2019 8:39 pm Regarding bias. As long as there is no reference it is near impossible to tell the difference. So all the talk about bias is not much worth in real work until there is visibly something wrong(like fireflies or bleeding).
Yeah, that is true if you are interested mostly in visualisations or artistic work. But there are also cases where you want to simulate an optical system and need to have physically reliable results, even correct brightness ratios.
After all, LuxCore is advertised with a big orange "Physically based rendering" as the first thing you see on the homepage. That may raise expectations ;)
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: PhotonGI cache

Post by lacilaci »

CodeHD wrote: Thu Feb 14, 2019 9:01 pm
lacilaci wrote: Thu Feb 14, 2019 8:39 pm Regarding bias. As long as there is no reference it is near impossible to tell the difference. So all the talk about bias is not much worth in real work until there is visibly something wrong(like fireflies or bleeding).
Yeah, that is true if you are interested mostly in visualisations or artistic work. But there are also cases where you want to simulate an optical system and need to have physically reliable results, even correct brightness ratios.
After all, LuxCore is advertised with a big orange "Physically based rendering" as the first thing you see on the homepage. That may raise expectations ;)
Can you use a renderer and not be interested in visualisations?

"physically based" doesn't mean anything, same goes for "unbiased". Marketing terms, that's all...
Nothing is unbiased

But let's stay on topic...
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: PhotonGI cache

Post by Sharlybg »

So the only con of this cache is that you can't get boost if your average scene surface reflectivity is below 0.2 (wich is a default value that can be raise or lower down, but lowering it can produce heavy undesirable Bias)

So if you want to benefit a lot from it be carefull on the large surface area of you render ( floor/wall/ceilling/large furniture).
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
Post Reply