Open Access
ARTICLE
A Fast and Memory-Efficient Direct Rendering Method for Polynomial-Based Implicit Surfaces
1 Graduate School of Information Science and Engineering, Ritsumeikan University, Ibaraki, Osaka, 567-8570, Japan
2 College School of Information Science and Engineering, Ritsumeikan University, Ibaraki, Osaka, 567-8570, Japan
* Corresponding Author: Jiayu Ren. Email:
Computer Modeling in Engineering & Sciences 2024, 141(2), 1033-1046. https://doi.org/10.32604/cmes.2024.054238
Received 22 May 2024; Accepted 12 August 2024; Issue published 27 September 2024
Abstract
Three-dimensional surfaces are typically modeled as implicit surfaces. However, direct rendering of implicit surfaces is not simple, especially when such surfaces contain finely detailed shapes. One approach is ray-casting, where the field of the implicit surface is assumed to be piecewise polynomials defined on the grid of a rectangular domain. A critical issue for direct rendering based on ray-casting is the computational cost of finding intersections between surfaces and rays. In particular, ray-casting requires many function evaluations along each ray, severely slowing the rendering speed. In this paper, a method is proposed to achieve direct rendering of polynomial-based implicit surfaces in real-time by strategically narrowing the search range and designing the shader to exploit the structure of piecewise polynomials. In experiments, the proposed method achieved a high framerate performance for different test cases, with a speed-up factor ranging from 1.1 to 218.2. In addition, the proposed method demonstrated better efficiency with high cell resolution. In terms of memory consumption, the proposed method saved between 90.94% and 99.64% in different test cases. Generally, the proposed method became more memory-efficient as the cell resolution increased.Keywords
Surface modeling from three-dimensional (3D) scattered points has many important applications including computer graphics, physics-based simulations, and medical imaging. A target object can be expressed by the implicit surface
Meanwhile, various methods have also been developed for visualizing implicit surfaces. A common strategy is polygonization or indirect rendering, which involves converting implicit surfaces to polygonal surfaces by using the marching cubes algorithm [22] or other advanced techniques [23,24]. Visualization is then performed by using standard polygonal rendering techniques. In contrast, direct rendering utilizes ray-casting to detect points on the original surface that correspond to screen pixels at the rendering stage. The simplest form of direct rendering is ray marching [25], which involves detecting the closest point on a surface corresponding to a single pixel by tracing a ray from the camera. More advanced direct rendering techniques such as sphere tracing [26] and adaptive marching points [27] help reduce the cost of finding intersections. In general, however, direct rendering suffers from high computational costs because surface points are searched iteratively for all screen pixels in every rendering frame. Thus, this approach is not suitable for fast rendering applications, especially when the field has a complicated expression.
In this paper, we propose a method for fast direct rendering of implicit surfaces that does not use intermediate polygonal representations. The proposed method comprises two main strategies: reducing the computational cost and narrowing the search range. For the first strategy, we employ piecewise polynomials [9,10] to represent the field of the implicit surface. For the second strategy, we limit the domain of the field to cells that intersect with the surface to exclude cells far from the surface. Fast rendering is achieved by designing the shader to exploit the structure of piecewise polynomials for efficient execution. The proposed method has several similarities with real-time ray casting [28], particularly in its capability for fast direct rendering of isosurfaces from discretely sampled fields such as volume data. This resemblance stems from the strategies of detecting cells intersecting the implicit surface and restricting the ray marching range to the detected cells. The proposed method is distinctive because it was designed for fields represented by piecewise polynomials. This design enables compatibility not only with standard grid cells but also with more general structures such as hierarchical B-splines.
2 Standard Rendering of Polynomial-Based Implicit Surfaces
2.1 Representing the Field of an Implicit Surface as Piecewise Polynomials
An implicit surface can be defined as
where
In this paper, we assume that the field is positive inside the implicit surface and negative outside the implicit surface. An arbitrary field defined in
when
2.2 The Ray Marching Algorithm
As shown in Fig. 2, ray marching renders the implicit surface
For fast rendering, the ray marching process should be parallelized on a graphics processing unit (GPU) shader. The conventional rendering method [9] is to parallelize the entire rendering process for a single frame, which is executed by a fragment shader of the GPU. If
3 Proposed Method: Efficient Rendering for Polynomial Implicit Surfaces
The proposed method achieves fast direct rendering using piecewise polynomials and by limiting the ray marching range to around the surface. If the piecewise polynomials
Active cells are identified by uniformly sampling each cell and evaluating the field. A cell is classified as active if its sampling points exhibit both positive and negative values and inactive otherwise. The sampling point density can be adjusted to balance the tradeoff between computational speed and accuracy. This process is performed during preprocessing, which is followed by sending the polynomial coefficients of the active cells to the GPU. Therefore, the time required for preprocessing is only needed once at the modeling and does not affect the subsequent actual rendering process. Fig. 4 summarizes rendering examples using different sampling resolution. The sampling density represents a trade-off between computational complexity and accuracy. In general, fine sampling is preferred in most cases because the time spent on preprocessing is required only during the modeling phase.
In the conventional method [9], piecewise polynomials are defined for all cells of the grid, and their coefficients are densely flattened into an array. For each sampling point
The ray marching process along a single ray segment is assigned to a fragment shader. The array of polynomial coefficients should satisfy the following two requirements:
• A certain amount of memory space is required to store the polynomial coefficients of active cells in the GPU buffer, and each element of the array should be accessed efficiently from the fragment shader.
• The fragment shader requires the current cell to be mapped to the array of polynomial coefficients stored on the GPU buffer.
For the first requirement, we send the array of polynomial coefficients to the GPU by using the shader storage buffer object (SSBO). Although other options are available such as the uniform buffer object (UBO) and vertex buffer object (VBO), the SSBO supports the sending of large arrays. Thus, the array can be sent to the SSBO prior to the rendering process and the elements can be accessed by the fragment shader. For the second requirement, we attach the index of the coefficient array to the attributes of all vertices and send the array index to the fragment shader so that it can access the polynomial coefficients at the current cell. Fig. 6 illustrates an example situation. Suppose that the polynomial coefficients of the
3.3 Ray-Marching in Fragment Shader
The final ray marching is done in the render loop. Specifically, the
Experiments were performed to evaluate the rendering results of the proposed method compared with conventional ray marching. All experiments were performed by using a NVIDIA GeForce RTX 3090. The bisection method was fixed to 10 iterations, and the screen size was fixed to 1440
Figs. 8–10 show the rendering results of the proposed method. At
Table 1 compares the rendering speeds of the proposed method and conventional ray marching in terms of the framerate (FPS). The proposed method demonstrated speedup factors of 1.1–218.2 in the test cases, which indicated that it was fast enough for real-time rendering even at high grid resolutions. The rendering speed of conventional ray marching for the grid resolution of
Although many elements determine the speedup factor such as the distance from the bounding box to the surface and the projected area on the screen, a major factor is the ratio of active cells to the total number of cells. If the ratio is small, high computational efficiency can be expected because most of the sampling process in ray marching can be eliminated. Table 2 summarizes the number of active cells and their ratio to the total number of cells for each surface. A correlation was observed between the speedup factor and ratio. The GPU memory consumption can be derived from the number of active cells. For example, the maximum number of active cells in the experiments was about 1.1 million for the surface Holey Sphere at a grid resolution of
Our proposed method accelerates the direct rendering of implicit surfaces by identifying active cells that intersect with the surface and performing ray marching in these cells rather than the whole domain, which greatly reduces the number of calculations compared to conventional ray marching. We developed a data structure specific to OpenGL shaders that uses both the SSBO and VBO. The fragment shader requires the polynomial coefficients for ray marching so the data structure was designed to allow efficient access of the coefficients by the fragment shader. The polynomial coefficients are stored in the SSBO and the index information that maps each cell to the corresponding coefficients is stored in the VBO. The experimental results showed that the proposed method achieved fast and direct rendering of various implicit surfaces. The results confirmed that the proposed method and data structure were effective, and reliable rendering results were obtained at a low computational cost when an appropriate ray marching interval length was selected. Moreover, we present a rendering procedure optimized for efficient execution on GPU shaders. The proposed method is specifically designed for polynomial-based implicit surfaces and is not applicable to general implicit surfaces unless they are converted to polynomial expressions with cubic cells. Although ray marching is a straightforward technique, it is expected to work effectively for finding intersections in each local cell. Additionally, this proposed method has the potential to be extended to a hierarchical cell structure using hierarchical B-splines in the future.
The proposed method limits ray marching to the vicinity of the implicit surface. Thus, its applicability is subject to certain limitations. For example, it cannot represent time-varying surfaces, which usually require polynomials over a larger range. Additionally, some operations that are characteristic of implicit surfaces, such as morphing and constructive solid geometry, require the full domain of the field, for which the proposed method is inapplicable. Future work will involve rendering implicit surfaces using piecewise polynomials representing not just the limited domain but also the entire domain. A possible solution would be to use an adaptive grid.
Acknowledgement: None.
Funding Statement: This work was supported by JSPS KAKENHI Grant Number 21K11928.
Author Contributions: The authors confirm contribution to the paper as follows: study conception and design: Jiayu Ren, Susumu Nakata; analysis and interpretation of results: Jiayu Ren, Susumu Nakata; draft manuscript preparation: Jiayu Ren; draft manuscript revision: Susumu Nakata. All authors reviewed the results and approved the final version of the manuscript.
Availability of Data and Materials: The data are available on request.
Ethics Approval: Not applicable.
Conflicts of Interest: The authors declare that they have no conflicts of interest to report regarding the present study.
References
1. Carr JC, Beatson RK, Cherrie JB, Mitchell TJ, Fright WR, McCallum BC, et al. Reconstruction and representation of 3D objects with radial basis functions. In: Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques. SIGGRAPH ’01, 2001; New York, NY, USA: Association for Computing Machinery; p. 67–76. [Google Scholar]
2. Turk G, O’Brien JF. Modelling with implicit surfaces that interpolate. ACM Trans Graph. 2002;21(4): 855–73. doi:10.1145/571647.571650. [Google Scholar] [CrossRef]
3. Morse BS, Yoo TS, Rheingans P, Chen DT, Subramanian KR. Interpolating implicit surfaces from scattered surface data using compactly supported radial basis functions. In: Proceedings of the International Conference on Shape Modeling and Applications, 2001; Genova, Italy: IEEE Computer Society; p. 89–98. doi:10.1109/SMA.2001.923379. [Google Scholar] [CrossRef]
4. Zeng Y, Zhu Y. Implicit surface reconstruction based on a new interpolation/approximation radial basis function. Comput Aided Geom Des. 2022;92(4):102062. doi:10.1016/j.cagd.2021.102062. [Google Scholar] [CrossRef]
5. Ohtake Y, Belyaev A, Alexa M, Turk G, Seidel HP. Multi-level partition of unity implicits. ACM Trans Graph. 2003;22(3):463–70. doi:10.1145/882262.882293. [Google Scholar] [CrossRef]
6. Tobor I, Reuter P, Schlick C. Reconstructing multi-scale variational partition of unity implicit surfaces with attributes. Graph Models. 2006;68(1):25–41. doi:10.1016/j.gmod.2005.09.003. [Google Scholar] [CrossRef]
7. Kazhdan M, Bolitho M, Hoppe H. Poisson surface reconstruction. In: Proceedings of the Fourth Eurographics Symposium on Geometry Processing, 2006; Cagliari, Sardinia, Italy: Eurographics Association; vol. 7 no. 4, p. 61–70. [Google Scholar]
8. Manson J, Petrova G, Schaefer S. Streaming surface reconstruction using wavelets. Comput Graph Forum. 2008;27:1411–20. [Google Scholar]
9. Nakata S, Aoyama S, Makino R, Hasegawa K, Tanaka S. Real-time isosurface rendering of smooth fields. J Vis. 2012;15(2):179–87. doi:10.1007/s12650-011-0119-5. [Google Scholar] [CrossRef]
10. Itoh T, Nakata S. Fast generation of smooth implicit surface based on piecewise polynomial. Comput Model Eng & Sci. 2015;107(3):187–99. doi:10.3970/cmes.2015.107.187. [Google Scholar] [CrossRef]
11. Pan M, Tong W, Chen F. Phase-field guided surface reconstruction based on implicit hierarchical B-splines. Comput Aided Geom Des. 2017;52–53(6):154–69. doi:10.1016/j.cagd.2017.03.009. [Google Scholar] [CrossRef]
12. Liu XY, Wang H, Chen CS, Wang Q, Zhou X, Wang Y. Implicit surface reconstruction with radial basis functions via PDEs. Eng Anal Bound Elem. 2020;110(4–5):95–103. doi:10.1016/j.enganabound.2019.09.021. [Google Scholar] [CrossRef]
13. Erler P, Guerrero P, Ohrhallinger S, Mitra NJ, Wimmer M. POINTS2SURF learning implicit surfaces from point clouds. arXiv:2007104532020. 2020. [Google Scholar]
14. Liu SL, Guo HX, Pan H, Wang PS, Tong X, Liu Y. Deep implicit moving least-squares functions for 3D reconstruction. arXiv:2103122662021. 2021. [Google Scholar]
15. Ma B, Han Z, Liu YS, Zwicker M. Neural-pull: learning signed distance functions from point clouds by learning to pull space onto surfaces. arXiv:2011134952021. 2021. [Google Scholar]
16. Ma B, Liu YS, Han Z. Reconstructing surfaces for sparse point clouds with on-surface priors. arXiv:2204106032022. 2022. [Google Scholar]
17. Jia M, Kyan MJ. Learning occupancy function from point clouds for surface reconstruction. arXiv:2010113782020. 2020. [Google Scholar]
18. Peng S, Niemeyer M, Mescheder L, Pollefeys M, Geiger A. Convolutional occupancy networks. arXiv:2003046182020. 2020. [Google Scholar]
19. Martel JN, Lindell DB, Lin CZ, Chan ER, Monteiro M, Wetzstein G. ACORN: adaptive coordinate networks for neural scene representation. arXiv:2105027882021. 2021. [Google Scholar]
20. Takikawa T, Litalien J, Yin K, Kreis K, Loop C, Nowrouzezahrai D, et al. Neural geometric level of detail: real-time rendering with implicit 3D shapes. arXiv:2101109942021. 2021. [Google Scholar]
21. Huang Z, Wen Y, Wang Z, Ren J, Jia K. Surface reconstruction from point clouds: a survey and a benchmark. arXiv:2205024132022. 2022. [Google Scholar]
22. Newman TS, Yi H. A survey of the marching cubes algorithm. Comput Graph. 2006;30(5):854–79. doi:10.1016/j.cag.2006.07.021. [Google Scholar] [CrossRef]
23. Stander BT, Hart JC. Guaranteeing the topology of an implicit surface polygonization for interactive modeling. In: Proceedings of the 24th Annual Conference on Computer Graphics and Interactive Techniques. SIGGRAPH ’97, 1997; USA: ACM Press/Addison-Wesley Publishing Co.; p. 279–86. [Google Scholar]
24. Gelas A, Valette S, Prost R, Nowinski WL. Variational implicit surface meshing. Comput Graph. 2009;33(3):312–20. [Google Scholar]
25. Perlin K, Hoffert EM. Hypertexture. ACM SIGGRAPH Comput Graph. 1989;23(3):253–62. [Google Scholar]
26. Hart JC. Sphere tracing: a geometric method for the antialiased ray tracing of implicit surfaces. Vis Comput. 1996;12(10):527–45. [Google Scholar]
27. Singh JM, Narayanan PJ. Real-time ray tracing of implicit surfaces on the GPU. IEEE Trans Vis & Comput Graph. 2010;16(2):261–72. [Google Scholar]
28. Hadwiger M, Sigg C, Scharsach H, Bühler K, Gross MH. Real-time ray-casting and advanced shading of discrete isosurfaces. Comput Graph Forum. 2005;24(3):303–12. [Google Scholar]
Cite This Article
This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.