Multimedia Tools and Applications

, Volume 75, Issue 23, pp 15881–15899 | Cite as

Efficient kd-tree construction for ray tracing using ray distribution sampling

  • Xiao Liang
  • Hongyu Yang
  • Yanci ZhangEmail author
  • Jun Yin
  • Yue Cao


Although regarded as a standard heuristic for constructing a kd-tree, Surface Area Heuristic (SAH) suffers from degrading traversal performance as well as unnecessary acceleration structure construction due to its assumption of uniform ray distribution. In this paper, first, we propose a Grid based Ray Distribution Heuristic (GRDH) to construct a high quality kd-tree. The information of ray distribution is sampled and recorded in a sparse grid, which is also utilized to partition primitives efficiently. The heuristic only evaluating traversal cost on limited splitting candidates, is fast and easy to be implemented. Then, we introduce a novel ray tracing pipeline with two-pass construction and two-pass tracing routine to enable an on-demand construction algorithm. In the pipeline, after constructing a partially structured kd-tree, rays are classified by whether triggering transitions to construct unstructured leaf nodes, and being traced in different tracing passes. For on-demand construction, this raises the barrier of interleaving with traversal routine, as well as enables the algorithm to be flexible on multi-core computation platform. Additionally, GRDH is also combined into on-demand construction for high traversal performance. The experimental results demonstrate that the on-demand GRDH construction algorithm can achieve a speedup of 1.63 ~ 1.95 in overall frame performance for scenes with more than 360K primitives.


Kd-tree Ray distribution On-demand construction Ray tracing 



The authors wish to thank the anonymous reviewers. The research is supported by National Natural Science Foundation of China with grant No. 61472261, National Key Technology R&D Program of China with grant No. 2012BAH62F03, Youth Foundation of Southwest Petroleum University with grant No. 0202002131285, Talent Project of Science and Technology Innovation of Sichuan Province with grant No. 14-YCG052, Science Project of Education Department of Sichuan Province with grant No. 020402000091.

Supplementary material


(MP4 13062 kb)


  1. 1.
    Bentley JL (1975) Multidimensional binary search trees used for associative searching. Commun ACM 18(9):509–517MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Bittner J, Havran V (2009) RDH: ray distribution heuristics for construction of spatial data structures, Proceedings of the 25th Spring Conference on Computer Graphics, pp 51–58Google Scholar
  3. 3.
    Choi B, Chang B, Ihm I (2012) Construction of efficient kd-trees for static scenes using voxel-visibility heuristic. Comput Graph 36(1):38–48CrossRefGoogle Scholar
  4. 4.
    Choi B, Komuravelli R, Lu V, Sung H, Bocchino RL, Adve SV, Hart JC (2010) Parallel SAH k-D tree construction for fast dynamic scene ray tracing, high performance graphics, pp 77–86Google Scholar
  5. 5.
    Djeu P, Hunt W, Wang R, Elhassan I, Stoll G, Mark WR (2011) Razor: an architecture for dynamic multiresolution ray tracing. ACM Trans Graph 30(5):115:1–115:26CrossRefGoogle Scholar
  6. 6.
    Fabianowski B, Fowler C, Dingliana J (2009) A cost metric for scene-interior ray origins, Eurographics Short Papers, pp 49–52Google Scholar
  7. 7.
    Feltman N, Lee M, Fatahalian K (2012) SRDH: specializing BVH construction and traversal order using representative shadow ray sets, Eurographics Conference on High-Performance Graphics, pp 49–55Google Scholar
  8. 8.
    Fujimoto A, Tanaka T, Iwata K (1986) Arts: accelerated ray-tracing system. IEEE Comput Graph Appl 6(4):16–26CrossRefGoogle Scholar
  9. 9.
    Havran V (2000) Heuristic ray shooting algorithms, Ph.D. ThesisGoogle Scholar
  10. 10.
    Hunt W, Mark WR, Fussel D (2007) Fast and lazy build of acceleration structure from scene hierarchies, IEEE Symposium on Interactive Ray Tracing, pp 47–54Google Scholar
  11. 11.
    Hunt W, Mark WR, Stoll G (2006) Fast kd-tree construction with an adaptive error-bounded heuristic, symposium on interactive ray tracing, Los Alamitos, CA, USA, pp 81–88Google Scholar
  12. 12.
    Hurley J, Kapustin E, Reshetov E, Soupikov A (2002) Fast ray tracing for modern general purpose CPU, In Proceedings of Graphicon, 7(5):2002Google Scholar
  13. 13.
    Kang Y-S, Nah J-H, Park W-C, Yang S-B (2013) gkDtree: a group-based parallel update kd-tree for interactive ray tracing. J Sys Archit, pp 166–175Google Scholar
  14. 14.
    Lauterbach C, Garland M, Sengupta S, Luebke D, Manocha D (2009) Fast BVH construction on GPUs. Comput Graphics Forum 28(1):375–384CrossRefGoogle Scholar
  15. 15.
    Liang X, Yang H, Qian Y, Zhang Y (2014) A fast Kd-tree construction for ray tracing based on efficient ray distribution. J Softw 9(3):596–604Google Scholar
  16. 16.
    MacDonald J, Booth K (1990) Heuristics for ray tracing using space subdivision. Vis Comput 6(3):153–166CrossRefGoogle Scholar
  17. 17.
    Pharr M, Humphreys G (2010) Physically based rendering, 2nd edn, From theory to implementation. Morgan Kaufmann Publishers Inc, San FranciscoGoogle Scholar
  18. 18.
    Popov S, Günther J, Seidel H-P, Slusallek P (2006) Experiences with streaming construction of SAH KD-trees, Proceedin of the 17th Eurographics Ysmposium on Rendering, pp 139–149Google Scholar
  19. 19.
    Reshetov A, Soupikov A, Hurley J (2005) Multi-level ray tracing algorithm. ACM Trans Graph 24(3):1176–1185CrossRefGoogle Scholar
  20. 20.
    Rubin S, Whitted T (1980) A 3-dimensional representation for fast rendering of complex scenes, In Proceedings of SIGGRAPH, pp 110–116Google Scholar
  21. 21.
    Shevtsov M, Soupikov A, Kapustin A (2007) Highly parallel fast KD-tree construction for interactive ray tracing of dynamic scenes. Comput Graphics Forum 26(3):395–404CrossRefGoogle Scholar
  22. 22.
    Solomon H (1978) Geometric probability, J.W. Arrowsmith LtdGoogle Scholar
  23. 23.
    Vinkler M, Havran V, Sochor J (2012) Visibility driven BVH build up algorithm for ray tracing. Comput Graph 36(4):283–296CrossRefGoogle Scholar
  24. 24.
    Wächter C, Keller A (2006) Instant ray tracing: the bounding interval hierarchy, Proceedings of the 17th Eurographics Symposium on Rendering, pp 139–149Google Scholar
  25. 25.
    Wald I, Ize T, Kensler A, Knoll A, Parker SG (2006) Ray Tracing Animated Scenes using Coherent Grid Traversal. ACM Trans Graph (Proc ACM SIGGRAPH) 25(3):485–493CrossRefGoogle Scholar
  26. 26.
    Wald I, Slusallek P, Benthin C, Wagner M (2006) On building fast kd-trees for ray tracing, and on doing that in O(N log(N), Proceedings of the 2006 I.E. Symposium on Interactive Ray Tracing, pp 61–69Google Scholar
  27. 27.
    Wu Z, Zhao F, Liu X (2011) SAH KD-tree construction on GPU. high performance graphics, pp 71–78Google Scholar
  28. 28.
    Zhou K, Hou Q, Wang R, Guo B (2008) Real-time KD-tree construction on graphics hardware, ACM SIGGRAPH Asia, pp 126:1–126:11Google Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  • Xiao Liang
    • 1
    • 2
  • Hongyu Yang
    • 1
  • Yanci Zhang
    • 1
    Email author
  • Jun Yin
    • 1
  • Yue Cao
    • 3
  1. 1.College of Computer ScienceSichuan UniversityChengduChina
  2. 2.School of Computer ScienceSouthwest Petroleum UniversityChengduChina
  3. 3.School of Computer Science and EngineeringUniversity of Electronic Science and Technology of ChinaChengduChina

Personalised recommendations