Poisson disk sampling for arbitrary surfaces

Duan Gao

1568123441253 1568123467628

Algorithm (Euclidean distance)

This algorithm was proposed in [1]. The goal is to sample a set of points with poisson disk distribution on surfaces.

Alogirhtm pipeline:

  1. Compute a dense initial random point sets on the surface ()

    1. build 1D distribution based on the surface area of shapes;
    2. sampling points from the distribution.

    In Mitsuba [2], the default is . Mitsuba has implemented this algorithm too (bluenoise.cpp).

  2. Parition into cells

    • compute cell size and grid resolution
    • For each point in , compute the cell it belongs to and assign the cell id to each point.

    For each cell, we need to maintain a list of all points inside it.

    We don't need to allocate such list actually, just sort with cell_id as the key.

    Due to the surface that we sampled is always sparse in 3D, it's better to use a hash table to represent the grid instead of 3D arrays. (invalid cells (no point inside it) will never be considered.)

    We can use std::unordered_map<size_t, Cell> to store all the valid cells.

  3. Create phase group

    There will be conflicts if we just perform sampling in each cell parallelly. (nearby cell (mininum distance smaller than ) may have conflicts).

    Phase group is a set of cells and there are no conflicts when processed in parallel.

    1567673705772

    For example, in this figure (from original paper), all cells with the same color with 1 are in one phase group:

    1568116878795

    And all cell with the same color with 2 are in one phase group too, etc.

    1568116942101

    The cells in one phase group are far enough so there in no conflicts between them.

  4. Sample blue noise points

    For each phase group:

    for each cell in this phase group:

    for t in range(K): // maximum number of trials per grid cell

    cell[t] is current candidate point.

    if there is some point already be sampled in this cell, ignore it.

    check is there any conflict with the sampled point in neighboring cells.

    if yes, ignore;

    else, accept this candidate.

 

Sampling with Geodesic distance

 

Results

I implement this algorithm in my renderer Elegans.

Here are some examples:

Note: is a quality criteria of poisson disk sampling.(Eq-6 in [1])

 

blue_noise_sampling_all

blue_noise_sampling_all

Notes about the visualization:

For more details, please see the source code of ELEGANS::test_blue_noise_sampling() in test_blue_noise_sampling.cpp.

 

[1] Bowers J, Wang R, Wei L Y, et al. Parallel Poisson disk sampling with spectrum analysis on surfaces[C]//ACM Transactions on Graphics (TOG). ACM, 2010, 29(6): 166. http://graphics.cs.umass.edu/pubs/sa_2010.pdf [2] Wenzel J. Mitsuba renderer. http://www.mitsuba-renderer.org. 2010.