Page 1 of 3

Implementation for Blue-noise Dithered Sampling

Posted: Sun Jan 22, 2017 7:30 pm
by josh247
Just sharing this implementation for sample mask construction required in the SIGGRAPH 2016 paper "Blue-noise Dithered Sampling" by Iliyan Georgiev and Marcos Fajardo. You can access the paper here: https://www.solidangle.com/arnold/research

As there didn't appear to be a strict implementation of the simulated annealing process found in the paper online, I thought this simple example might be helpful for someone. It should be fairly efficient using SSE3 instructions and TBB for multithreading.

https://github.com/joshbainbridge/blue-noise-generator

Re: Implementation for Blue-noise Dithered Sampling

Posted: Tue Jan 24, 2017 8:15 am
by papaboo
Thanks. I will definitely have a look at that. I'm currently using an LCG and that's fast but it doesn't take a lot of high frequency phenomena to break convergence. Do you have any rendering results?

Re: Implementation for Blue-noise Dithered Sampling

Posted: Tue Jan 24, 2017 2:46 pm
by jbikker
That is very interesting, thanks for the links!

Re: Implementation for Blue-noise Dithered Sampling

Posted: Wed Jan 25, 2017 2:14 pm
by stefan
Thanks for sharing this. I have a Python version floating around somewhere, but that was painfully slow and then other priorities kept me from working on it.

Re: Implementation for Blue-noise Dithered Sampling

Posted: Wed Jan 25, 2017 10:56 pm
by josh247
Unfortunately I've not got any rendered images to share, but it shouldn't be too hard to implement. When the values are written out to the data file they are converted to an unsigned 32bit integer range. This is so that a toroidal shift can easily be applied (to particular sampling patterns) with a simple addition while taking advantage of integer overflow. Although this is assuming that the samplers are also working within the same unsigned integer range, and that the addition is done before converting the value to a floating point representation. You may also find that the current parameters are set rather low, to get a high quality result the iterations should be set much higher.

I'll try and get around to putting together some images of the fourier power spectra soon. Hopefully at some point I'll also find some time to create a simple example using pbrt v3.

Re: Implementation for Blue-noise Dithered Sampling

Posted: Thu Jan 26, 2017 8:57 am
by jbikker
I set the tile size to 64, iterations to 65536 * 2 and depth to 10 (for: lens, pixel, light sample 1, diffuse bounce, light sample 2); in that case the code takes about 1.5 *hours* to execute on a 12-core Xeon system (admittedly, old Xeons)... How long did your 128x128 tiles take? :)

Re: Implementation for Blue-noise Dithered Sampling

Posted: Sun Jan 29, 2017 8:23 pm
by josh247
I'll run the program tomorrow at a resolution of 128x128 and record the simulation time. I've not done this yet as the implementation here isn't (and does not claim to be) the same as the one found in the original paper :) There was a sizable performance gain when using AVX2 instructions, but this would have limited compatibility. As a result I've left the available code using SSE3 instructions on the master branch. Also thought it would be helpful to add a simple Fourier transform to give a better indication of the resulting quality, the images are attached.

Re: Implementation for Blue-noise Dithered Sampling

Posted: Mon Jan 30, 2017 3:14 pm
by toxie
There are some minor issues getting this to work with MSVC:
a) The _mm_andnot_si128 should be a _mm_andnot_ps
b) a separate code path that uses _aligned_malloc instead of posix_memalign on MSVC
c) same for free (_aligned_free)
Maybe you can patch this then.. And thanks for sharing..

Re: Implementation for Blue-noise Dithered Sampling

Posted: Mon Jan 30, 2017 4:08 pm
by toxie
jbikker wrote:I set the tile size to 64, iterations to 65536 * 2 and depth to 10 (for: lens, pixel, light sample 1, diffuse bounce, light sample 2); in that case the code takes about 1.5 *hours* to execute on a 12-core Xeon system (admittedly, old Xeons)... How long did your 128x128 tiles take? :)


Would be interesting to hear your experiences when rendering with it, when optimizing for this 10D case. Cause IMHO the scheme should fall apart when using a large number of dimensions.

Re: Implementation for Blue-noise Dithered Sampling

Posted: Tue Jan 31, 2017 6:33 pm
by ingenious
toxie wrote:Would be interesting to hear your experiences when rendering with it, when optimizing for this 10D case. Cause IMHO the scheme should fall apart when using a large number of dimensions.


Indeed, in my experience it's hard (impossible?) to achieve high-quality blue noise in high dimensions :(