The jump flooding algorithm (JFA) is a flooding algorithm used in the construction of Voronoi diagrams and distance transforms. The JFA was introduced by Rong Guodong at an ACM symposium in 2006.1
The JFA has desirable attributes in GPU computation, notably for its efficient performance. However, it is only an approximate algorithm and does not always compute the correct result for every pixel, although in practice errors are few and the magnitude of errors is generally small.1
Implementation
The JFA original formulation is simple to implement.
Take an grid of pixels2 (like an image or texture). All pixels will start with an "undefined" color unless it is a uniquely-colored "seed" pixel. As the JFA progresses, each undefined pixel will be filled with a color corresponding to that of a seed pixel.
For each step size , run one iteration of the JFA:
- Iterate over every pixel at .
- For each neighbor at where :
- if is undefined and is colored, change 's color to 's
- if is colored and is colored, if where and are the seed pixels for and , respectively, then change 's color to 's.
- For each neighbor at where :
Note that pixels may change color more than once in each step, and that the JFA does not specify a method for resolving cases where distances are equal, therefore the last-checked pixel's color is used above.
The JFA finishes after evaluating the last pixel in the last step size. Regardless of the content of the initial data, the innermost loop runs a total of times over each pixel, for an overall computational complexity of .
Variants
Some variants of JFA are:
- Additional pass at the end: JFA+1 has one additional pass with step size of 1, i.e. the step sizes are N/2, N/4, ..., 1, 1; JFA+2 has two additional passes with step sizes of 2 and 1, i.e. the step sizes are N/2, N/4, ..., 1, 2, 1; JFA has additional passes, i.e. the step sizes are N/2, N/4, ..., 1, N/2, N/4, ..., 1. JFA+1 has much fewer errors than JFA, and JFA+2 has even fewer errors.1
- Additional pass at the beginning: 1+JFA has one additional pass with step size of 1, i.e. the step sizes are 1, N/2, N/4, ..., 1. 1+JFA has very low error rate (similar to JFA+2) and the same performance as JFA+1.3
- Half resolution: This variant runs normal JFA at a half resolution, and enlarge the result into the original resolution and run one additional pass with step size of 1. Because most of the passes has only half resolution, the speed of this variant is much faster than the full resolution JFA.3
- Randomized variants (JFA+ and JFA*): Introduced by Maciej A. Czyzewski in 2019, these variants modify the step size, sampling directions, and initial grid state to achieve faster convergence.4
- JFA+ utilizes a pre-filled random noise mask. By treating empty pixels as random seeds initially, the algorithm mimics path compression in disjoint-set data structures. This passive grouping accelerates convergence, allowing the algorithm to terminate early and reducing the required steps to roughly while maintaining the standard step sequence.
- JFA* (JFA-star) shifts the time complexity dependency from the grid resolution () to the total number of initial seeds (). It adjusts the step sequence to base-3 () and replaces the 8-way fixed square sampling with a 12-way circular sampling. This circular sampling is designed to eliminate disconnected "wedge artifacts"—a known flaw in the standard JFA where narrow Voronoi cells can "steal" a center pixel without including neighboring pixels, causing them to appear visually disconnected.1 Combined with the noise mask, the loop terminates early based on the iterated logarithm, converging in steps followed by one final pass with a step size of 1. While empirically faster, formal proof of its absolute correctness remains open.
Complexity Comparison
Numerous variants of the JFA modify the step sequences or sampling mechanics to trade between execution speed and error rates. The table below assumes an grid and initial seeds.
| Variant | Step Sequence | Total Steps | Characteristics |
|---|---|---|---|
| JFA (2006) | Baseline 8-way sampling.1 | ||
| JFA+1 | One additional pass. Much fewer errors than standard JFA.1 | ||
| JFA+2 | Two additional passes. Even fewer errors than JFA+1.1 | ||
| 1+JFA | Initial pass added. Very low error rate (similar to JFA+2) with speed of JFA+1.3 | ||
| Half-res | Runs at half resolution, then enlarges with one final pass. Execution speed is significantly faster because the grid contains 75% fewer pixels per pass.3 | ||
| JFA+ (2019) | Injects a random noise mask to pre-fill the grid, accelerating convergence and allowing early termination.4 | ||
| JFA* (2019) | Scales by seed count (). Uses base-3 steps, 12-way circular sampling to fix wedge artifacts, early termination, and a final step size of 1. Correctness unproven.4 |
Because JFA* (JFA-star) scales with the number of seeds rather than the grid resolution, it requires significantly fewer passes for sparse datasets. For example, generating a Voronoi diagram on a 720×720 grid with 2,000 seeds requires roughly 10 passes using standard JFA, but only 4 passes using JFA*.
Uses

The jump flooding algorithm and its variants may be used for calculating Voronoi maps13 and centroidal Voronoi tessellations (CVT),5 generating distance fields,6 point-cloud rendering,7 feature matching,8 the computation of power diagrams,9 and soft shadow rendering.10 The grand strategy game developer Paradox Interactive uses the JFA to render borders between countries and provinces.11
Further developments
The JFA has inspired the development of numerous similar algorithms. Some have well-defined error properties which make them useful for scientific computing.12
In the computer vision domain, the JFA has inspired new belief propagation algorithms to accelerate the solution of a variety of problems.1314
References
References
- Rong, Guodong; Tan, Tiow-Seng (2006-03-14). "Jump flooding in GPU with applications to Voronoi diagram and distance transform" (PDF). Proceedings of the 2006 symposium on Interactive 3D graphics and games - SI3D '06. Redwood City, California: Association for Computing Machinery. pp. 109–116. doi:10.1145/1111411.1111431. ISBN 978-1-59593-295-2. S2CID 7282879.
- The original paper uses the optimal case, a square grid, as an example, but a grid of any size works. Albeit with reduced efficiency. See this StackOverflow question for more.
- Rong, Guodong; Tan, Tiow-Seng (July 2007). "Variants of Jump Flooding Algorithm for Computing Discrete Voronoi Diagrams". 4th International Symposium on Voronoi Diagrams in Science and Engineering (ISVD 2007). pp. 176–181. doi:10.1109/ISVD.2007.41. ISBN 978-0-7695-2869-4. S2CID 386735.
- Czyzewski, Maciej A. (2019-05-27). GPU-Accelerated Jump Flooding Algorithm for Voronoi Diagram in log*(n) (PDF) (Report).
- Guodong Rong; Yang Liu; Wenping Wang; Xiaotian Yin; Gu, X D; Xiaohu Guo (2011-03-25). "GPU-Assisted Computation of Centroidal Voronoi Tessellation". IEEE Transactions on Visualization and Computer Graphics. 17 (3): 345–356. Bibcode:2011ITVCG..17..345R. doi:10.1109/TVCG.2010.53. hdl:10722/132211. ISSN 1077-2626. PMID 21233516. S2CID 11970070.
- Golus, Ben (2021-04-01). "The Quest for Very Wide Outlines". Medium. Retrieved 2021-08-19.
- Farias, Renato (2014). "POINT CLOUD RENDERING USING JUMP FLOODING" (PDF).
- Yu, Pei; Yang, Xiaokang; Chen, Li (2012). "Parallel-Friendly Patch Match Based on Jump Flooding". In Zhang, Wenjun; Yang, Xiaokang; Xu, Zhixiang; An, Ping; Liu, Qizhen; Lu, Yue (eds.). Advances on Digital Television and Wireless Multimedia Communications. Communications in Computer and Information Science. Vol. 331. Berlin, Heidelberg: Springer. pp. 15–21. doi:10.1007/978-3-642-34595-1_3. ISBN 978-3-642-34595-1.
- Zheng, Liping (2019-05-01). "GPU-based efficient computation of power diagram". Computers & Graphics. 80: 29–36. doi:10.1016/j.cag.2019.03.011. ISSN 0097-8493. S2CID 131923624.
- Rong, Guodong; Tan, Tiow-Seng (2006-11-01). "Utilizing jump flooding in image-based soft shadows". Proceedings of the ACM symposium on Virtual reality software and technology. VRST '06. Limassol, Cyprus: Association for Computing Machinery. pp. 173–180. doi:10.1145/1180495.1180531. ISBN 978-1-59593-321-8. S2CID 15339123.
- Boczula, Bartosz; Eriksson, Daniel (2020). "Optimized Gradient Border Rendering in Imperator: Rome". Intel. Retrieved 2021-03-28.
- Schneider, Jens; Kraus, Martin; Westermann, Rüdiger (2010). "GPU-Based Euclidean Distance Transforms and Their Application to Volume Rendering". In Ranchordas, AlpeshKumar; Pereira, João Madeiras; Araújo, Hélder J.; Tavares, João Manuel R. S. (eds.). Computer Vision, Imaging and Computer Graphics. Theory and Applications. Communications in Computer and Information Science. Vol. 68. Berlin, Heidelberg: Springer. pp. 215–228. doi:10.1007/978-3-642-11840-1_16. ISBN 978-3-642-11840-1.
- Alchatzidis, Stavros; Sotiras, Aristeidis; Paragios, Nikos (2011-11-06). "Efficient parallel message computation for MAP inference". 2011 International Conference on Computer Vision (PDF). pp. 1379–1386. doi:10.1109/ICCV.2011.6126392. ISBN 978-1-4577-1102-2. S2CID 17554205.
- Choi, Jungwook; Rutenbar, Rob A. (2016-08-29). "Configurable and scalable belief propagation accelerator for computer vision". 2016 26th International Conference on Field Programmable Logic and Applications (FPL). pp. 1–4. doi:10.1109/FPL.2016.7577316. ISBN 978-2-8399-1844-2. S2CID 10923625.
As of this edit, this article uses content from "Is Jump Flood Algorithm Separable?", authored by alan-wolfe, trichoplax at Stack Exchange, which is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License, but not under the GFDL. All relevant terms must be followed.