Blue noise dithered Sobol

Discussion related to the Engine functionality, implementations and API.
User avatar
alpistinho
Developer
Posts: 190
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Blue noise dithered Sobol

Post by alpistinho » Sun Mar 15, 2020 2:07 pm

Hi,

I have been investigating this topic lately and wanted to discuss if we have some reasonable way to implement that.

1st idea:
I basically stole Cycles implementation (https://developer.blender.org/D2149)

The idea is basically to use a blue noise mask to offset the samples between pixels. Instead of using a white RNG to apply the Cranley-Patterson rotation, I am using a blue-noise mask (the same as Cycles).

This seems to work ok and it is not a huge cost (basically a fetch from a matrix instead of a random number generation)

Limitations:
[*] I had to disable the pass scrambling, which generates correlation artifacts for LIGHTCPU and PATHCPU. Maybe only applying the pass scrambling for the light path is a sensible solution, but the interface does get a bit weird.
[*] This only improves for low sample counts. It degrades to white noise as rendering goes on.

Comparison:
At 1spp:
blue_dither_cornell_1spp.png
original_cornell_1spp.png
At 4spp:
blue_dither_cornell_4spp.png
original_cornell_4spp.png
2nd idea

I tried implementing the method described in A Low-Discrepancy Sampler that Distributes Monte Carlo Errors as a Blue Noise in Screen Space (Eric Heitz et al.)
They have a sample code that I've hacked into Luxcore, but although the convergence might be a little bit better, I don't see an obvious blue noise appearance such as the one they display in the paper (https://belcour.github.io/blog/research ... noise.html)
I am probably doing something stupid.

Any suggestions are welcome.
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 3883
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Blue noise dithered Sobol

Post by Dade » Sun Mar 15, 2020 2:37 pm

Have you tested the interaction with the Denoiser ? It may be a critical point.
Support LuxCoreRender project with salts and bounties

User avatar
alpistinho
Developer
Posts: 190
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Blue noise dithered Sobol

Post by alpistinho » Sun Mar 15, 2020 2:43 pm

Not yet, but the reports from Cycles is that blue noise improves denoise performance.
I will check it
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 3883
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Blue noise dithered Sobol

Post by Dade » Sun Mar 15, 2020 2:44 pm

P.S. I hardly see any improvement compared to normal SOBOL (but it is a while I have some serious doubt about the utility of Blue noise) however this may be a better method to solve the sample correlation problem, you should try some glass and/or long path rendering where the old code still shows some correlation :idea:
Support LuxCoreRender project with salts and bounties

User avatar
alpistinho
Developer
Posts: 190
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Blue noise dithered Sobol

Post by alpistinho » Sun Mar 15, 2020 2:50 pm

The improvement is only for very low sample counts.
I can see that the pattern is a bit more pleasing, but it is not a huuuge deal.

I actually made the newer paper method work:
(Besides having the blue-noise properties it also uses Owen-scrambled Sobol points, so it should have somewhat better convergence properties, mostly on smooth gradients)

16 spp:
official_16spp_28s.png
owen_food_16spp.png
128 spp:
official_128spp.png
owen_food_128spp.png
I am using the new method for the first 256 samples and then revert to the usual one.

About the correlation issue, do you have a specially problematic scene for me to test?
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 3337
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Blue noise dithered Sobol

Post by B.Y.O.B. » Sun Mar 15, 2020 3:12 pm

The reflections on the glass seem to have much less noise in the new method.

I'm seeing some repeating patterns in the noise in the upper left.
But I'm unsure if this is caused by the sampler or by the wall bump texture, I think it was tiled in this old version of the scene, although I don't think the tiles were this small. You could try the updated scene where the wall texture is no longer tiled: https://github.com/LuxCoreRender/LuxCor ... romage.zip
Attachments
owen_food_16spp_patterns.png

User avatar
alpistinho
Developer
Posts: 190
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Blue noise dithered Sobol

Post by alpistinho » Sun Mar 15, 2020 3:23 pm

Hi,

The both sampling are tiled over 128x128 pixels, so it is completely reasonable that there are correlation artifacts.
I will download the new scene to test.

About the noise, it is most likely due to the Owen scrambling. I saw the same effect when using my PMJ02 patch
Support LuxCoreRender project with salts and bounties

User avatar
alpistinho
Developer
Posts: 190
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Blue noise dithered Sobol

Post by alpistinho » Sun Mar 15, 2020 4:32 pm

Hi,

Now I've hacked it into my PMJ02 patch:

I'm doing the same thing we do with the current sobol samples. Applying the Cranley-Patterson rotation to the samples but using the blue mask.
According to the Siggraph "My favorite samples" panel we have to apply this rotation but only inside each stratum, so there might be some margin for improvement here

16 spp:
pmj02_dither_food_16spp.png
128 spp:
pmj02_dither_food_128spp.png
Support LuxCoreRender project with salts and bounties

juangea
Donor
Posts: 104
Joined: Thu Jan 02, 2020 6:23 pm

Re: Blue noise dithered Sobol

Post by juangea » Tue Mar 17, 2020 9:05 am

In the examples you show I don’t see the same effect as in cycles at all, there must be something different because with Cycles you can see the "gif" effect in no time, meanwhile in those tests the dithering effect is barely present, so something is off with the implementation, may be because of the way Lux samples lights? Because Insee a lot of noise from the light in the Cornell box example, but there is something definitely wrong with this.

Do you have at hand the blend file for the Cornell box? I would like to try to reproduce the example with the exact same scene, because the benefit is way more than the one visible here, definitely. :)

BTw thanks for looking into this :)

User avatar
Dade
Developer
Posts: 3883
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Blue noise dithered Sobol

Post by Dade » Tue Mar 17, 2020 10:40 am

juangea wrote:
Tue Mar 17, 2020 9:05 am
Do you have at hand the blend file for the Cornell box? I would like to try to reproduce the example with the exact same scene, because the benefit is way more than the one visible here, definitely. :)
The scene is here: https://github.com/LuxCoreRender/LuxCor ... nell.blend
Support LuxCoreRender project with salts and bounties

Post Reply