Fast Poisson Disk Sampling in Arbitrary Dimensions

2024-03-14 23:48

本文主要是介绍Fast Poisson Disk Sampling in Arbitrary Dimensions,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

转自:https://www.jasondavies.com/poisson-disc/

http://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf

Robert Bridson
University of British Columbia

Abstract

In many applications in graphics, particularly rendering, generating samples from a blue noise distribution is important. However, existing efficient techniques do not easily generalize beyond two dimensions. Here I demonstrate a simple modification to dart throwing which permits generation of Poisson disk samples in O(N) time, easily implemented in arbitrary dimension.
CR Categories: I.3.0 [Computer Graphics]: General
Keywords: sampling, blue noise, Poisson disk

1 Introduction

Blue noise sample patterns—for example produced by Poisson disk distributions, where all samples are at least distance r apart for some user-supplied density parameter r—are generally considered ideal for many applications in rendering (see Cook’s landmark paper for example [1986]). Unfortunately the na¨ıve rejection-based approach for generating Poisson disk samples, dart throwing, is impractically inefficient.

Many papers have overcome this inefficiency in two dimensions; I focus on one approach in particular, due to Dunbar and Humphreys [2006]. Their algorithm maintains a “scalloped sector” data structure which efficiently encodes the geometry of the region of the plane at distance between r and 2r from existing samples, and permits efficient uniform sampling from this region. Since every point in this region is an allowable sample, and since every maximal Poisson disk sampling containing the existing samples must also contain a point from this region, their algorithm can very efficiently generate the desired distribution.

However, many sampling applications use three or more dimensions: rendering with motion blur or depth-of-field, many particle systems for animation, etc. Existing two-dimensional fast blue noise samplers do not easily generalize to higher dimensions, thus practitioners tend to use either uniform random distributions (despite undesirable clustering), jittered/stratified sampling (which reduces but doesn’t eliminate clustering), or more structured distributions which induce anisotropy.

In this sketch I present a new algorithm, easily implemented in arbitrary dimensions, that is guaranteed to take O(N) time to generate N Poisson disk samples. Similar to the approach of Dunbar and Humphreys, sample candidates are drawn only from a region near existing samples, but instead of exactly computing the allowed region, rejection sampling is used to discover it.

2 The Algorithm

The algorithm takes as input the extent of the sample domain in R^n, the minimum distance r between samples, and a constant k as the limit of samples to choose before rejection in the algorithm (typically k = 30).

Step 0. Initialize an n-dimensional background grid for storing samples and accelerating spatial searches. We pick the cell size to be bounded by r/√n, so that each grid cell will contain at most one sample, and thus the grid can be implemented as a simple ndimensional array of integers: the default −1 indicates no sample, a non-negative integer gives the index of the sample located in a cell.

Step 1. Select the initial sample, x0, randomly chosen uniformly from the domain. Insert it into the background grid, and initialize the “active list” (an array of sample indices) with this index (zero).

Step 2. While the active list is not empty, choose a random index from it (say i). Generate up to k points chosen uniformly from the spherical annulus between radius r and 2r around xi. For each point in turn, check if it is within distance r of existing samples (using the background grid to only test nearby samples). If a point is adequately far from existing samples, emit it as the next sample and add it to the active list. If after k attempts no such point is found, instead remove i from the active list.

3 Analysis

Step 2 is executed exactly 2N−1 times to produce N samples: each iteration either produces a new sample and adds it to the active list, or removes an existing sample from the active list. Each iteration of step 2 takes O(k) time, and since k is held constant (typically quite small) the algorithm is linear.

Figure 1: Two-dimensional sample pattern from the algorithm and corresponding periodogram averaged over many runs.

Figure 1 shows results in two dimensions; the accompanying material shows results in three dimensions. The accompanying prototype code illustrates a simple implementation which takes the dimension of the space as a parameter.

Acknowledgements

This work was in part supported by a grant from the Natural Sciences and Engineering Research Council of Canada.

References

COOK, R. L. 1986. Stochastic sampling in computer graphics. ACM Trans. Graph. 5, 1.

DUNBAR, D., AND HUMPHREYS, G. 2006. A spatial data structure for fast poisson-disk sample generation. ACM Trans. Graph. 25, 3, 503–508.

这篇关于Fast Poisson Disk Sampling in Arbitrary Dimensions的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/810118

相关文章

每天一道面试题(2):fail-safe 机制与 fail-fast 机制分别有什么作用?

当谈论Java集合的 fail-fast 和 fail-safe 机制时,涉及的是在集合被并发修改时的行为和处理方式。这些机制对保证程序的正确性和稳定性非常重要,尤其是在多线程环境中。 1. Fail-Fast 机制 定义: Fail-fast 机制的核心是在检测到集合在遍历过程中被修改时,立即抛出 ConcurrentModificationException 异常,从而中断迭代操作。这种

UVa 11992 Fast Matrix Operations 线段树

UVa 11992 Fast Matrix Operations 题目大意:有一个r行c列的全0矩阵,支持三种操作: 1 x1 y1 x2 y2 v 子矩阵(x1,y1,x2,y2)的所有元素增加v(v > 0)。 2 x1 y1 x2 y2 v 子矩阵(x1,y1,x2,y2)的所有元素设为v(v > 0)。 3 x1 y1 x2 y2    查询子矩阵(x1,y1,x2,y2

【HDU】4965 Fast Matrix Calculation 矩阵快速幂

传送门:【HDU】4965 Fast Matrix Calculation 题目分析:因为比赛的时候写的太匆忙。。写的不堪入目,所以赛后重写了一次,顺便就贴一下了。 因为A*B=C,所以C^(N*N-1) = A*B*A*B*A*...*B*A*B,因为满足结合律所以变成A*( (B*A)^(N*N-2) )*B,因为中间得到的矩阵最大不超过K(K<=6),所以可以对中间的矩阵快速幂,然

Fast Image Cache

https://github.com/path/FastImageCache   Fast Image Cache is an efficient, persistent, and—above all—fast way to store and retrieve images in your iOS application. Part of any good iOS applica

NCBI-get-GCFIDs_fast.py

import requestsimport osimport redef download_genome_first(gcf_id):# 构建FTP下载路径base_url = "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/"# 提取GCF号的数字部分并按三位分割parts = gcf_id.split('_')[1] # 提取数字部分path_

Fast Power

Calculate the an % b where a, b and n are all 32bit non-negative integers. Example For 231 % 3 = 2 For 1001000 % 1000 = 0 Challenge O(logn) 思想:recursion算一半,然后base case,处理算完一半以后的情况; 公式就是 (a*b) %

解决svn:E200030: sqlite[S11]:database disk image is malformed

一,问题产生原因:我的电脑突然蓝屏,然后重启电脑后,更新项目提示这个鬼东西 二,解决方法: 1,下载sqlite3并把sqlite3.exe放到项目文件夹.svn同级目录 2,在项目文件夹的上面路径那里输入cmd 3,执行下面的命令 4,sqlite3.exe .svn/wc.db “reindex nodes” 5,sqlite3.exe .svn/wc.db “reindex pristin

fast-voice-assistant

首先我们来到这个据说50行代码就可以创建个人语音助手的github地址GitHub - dsa/fast-voice-assistant: ⚡ Insanely fast AI voice assistant with <500ms response times 按照readme 完成环境的配置 but,你发现,这只是第一步,真正的难点在于完成.env中各个key的配置 1)Using th

[论文笔记]Arbitrary-Oriented Scene Text Detection via Rotation Proposals

Arbitrary-Oriented Scene Text Detection via Rotation Proposals 论文地址:https://arxiv.org/abs/1703.01086 github地址:https://github.com/mjq11302010044/RRPN 该论文是基于faster-rcnn框架,在场景文字识别领域的应用。 创新点:生成带文字

[目标检测]Fast RCNN算法详解

转载来自:http://blog.csdn.net/shenxiaolu1984/article/details/51036677 继2014年的RCNN之后,Ross Girshick在15年推出Fast RCNN,构思精巧,流程更为紧凑,大幅提升了目标检测的速度。在Github上提供了源码。 同样使用最大规模的网络,Fast RCNN和RCNN相比,训练时间从84小时减少为9.5小时