Adaptive sampling improvements

Discussion related to the LuxCore functionality, implementations and API.
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: Adaptive sampling improvements

Post by lacilaci »

One more thing.

Can this whole adaptivity be tweaked to prioritize undersampled areas even before noise?

look at this image:
03.jpg
to me this looks like noise is picked up ok, but there are areas that are not noisy, but more like almost not even sampled/completely black. So I don't know if this makes sense but if this could somehow force luxcore to first push at least some samples where are the super dark areas it maybe could be better...?

Now, eventually some samples end there and adaptivity picks it up
04.jpg
But I'm thinking if it could speed up rendering some more if those parts would be somehow first to render... Not sure if this makes sense, just a thought. Overal I really like this improved adaptivity now! :D
marcatore
Donor
Donor
Posts: 463
Joined: Wed Jan 10, 2018 8:04 am

Re: Adaptive sampling improvements

Post by marcatore »

is this feature already in the daily BlendLuxCore build?If yes, it's just using the adaptive settings? right?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Adaptive sampling improvements

Post by B.Y.O.B. »

marcatore wrote: Wed Oct 30, 2019 9:13 am is this feature already in the daily BlendLuxCore build?
In about 20 minutes when the build is done, yes.
marcatore wrote: Wed Oct 30, 2019 9:13 am If yes, it's just using the adaptive settings? right?
It is active without any user interaction. When using adaptivity > 0, the new behaviour will be used.
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Adaptive sampling improvements

Post by alpistinho »

lacilaci wrote: Wed Oct 30, 2019 7:25 am to me this looks like noise is picked up ok, but there are areas that are not noisy, but more like almost not even sampled/completely black.
I don't what setting you were using for step size and warmup but what is happening is that the metric is considering that after (warmup+step) samples, this region is closer to convergence than the rest of the image. Up until (warmup+step) it should have received just the same amount of samples.

After that every step samples the current convergence will be reevaluated according to the result of these last samples.

That means that this region being undersampled is simply the result of the metric we're using. I couldn't find anything reasonably simple that looked better though.

If we somehow changed the sampler to always shoot samples if the region is super dark like this, we would probably harm other scenarios.
lacilaci wrote: Wed Oct 30, 2019 7:25 am Now, eventually some samples end there and adaptivity picks it up
As you've noticed, after the other regions get closer to their own convergence, this region starts getting samples.
The adaptiveness is not the same in the time domain. It tries to keep the noise constant accross the image, instead of keeping the amount of samples constant.

It is interesting putting both warmup and step as 1 and seeing the adaptive jump around the image, much like metropolis does. In the tests I've done it ends up converging to the same result as using a longer step size
lacilaci wrote: Wed Oct 30, 2019 7:25 am Overal I really like this improved adaptivity now! :D
Glad to hear :D
Support LuxCoreRender project with salts and bounties
zeealpal
Posts: 59
Joined: Wed Jan 10, 2018 12:25 pm

Re: Adaptive sampling improvements

Post by zeealpal »

Doesn't setting the adaptive strength to a lower value achieve the same pretty much; If its 0.7 then are 30% just sampled across the image and 70% use the adaptive map?

Feel free to correct my understanding it's more of a guess :lol:
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Adaptive sampling improvements

Post by alpistinho »

zeealpal wrote: Wed Oct 30, 2019 9:13 pm Doesn't setting the adaptive strength to a lower value achieve the same pretty much; If its 0.7 then are 30% just sampled across the image and 70% use the adaptive map?
Yes it would more or less.

As future reference, here it is the complete flow with some small steps ommited:
  • During (warmup + step) samples the sampling is uniform
  • At this moment, the current image is saved as reference
  • After step samples the current result is saved is compared to the current reference
  • The convergence metric [1] is calculated per pixel, as in a map
  • The values are filtered by a 2D box filter to make the adaptiveness smoother in the space domain
  • The mean and standard deviation for the map is calculated
  • The standard score [2] is calculated for each pixel metric, clamping it to 6 standard deviations
  • The map is normalized according to its max and minimum value so all pixels are in the 0-1 range (that will be the likelihood of being sampled every time this pixel is considered. Also is the content for the NOISE channel)
  • The current image is copied as reference
During sampling, the Sobol/Random samplers will go over every pixel and draw a random value in the 0-1 range. If the drawn value is smaller than the NOISE value for that pixel, it is sampled. If it is higher, it is not sampled.
The adaptive strength is used as the minimum likelihood a given pixel can have of being sampled in a given sampling attempt. (A strength of 0.95 means that every pixel has at least 5% chance of being sampled.)


[1] Dammertz, H. A Hierarchical Automatic Stopping Condition for Monte Carlo Global Illumination
[2] https://en.wikipedia.org/wiki/Standard_score
Support LuxCoreRender project with salts and bounties
Post Reply