Research And Implementation of Isosurface Extraction Algorithm Based on Flexicubes
Authors: Wang Yuyang 
Published: June 2024

Surface meshes are fundamental in the representation, transmission, and generation of three-dimensional geometric figures across various domains, such as computer graphics and robotics. The utilization of surface meshes brings about numerous advantages, including efficient hardware-accelerated rendering, support for solving equations in physical simulation, and facilitation of geometric processing. These attributes contribute to the creation of concise and accurate representations of arbitrary surfaces. It's essential to note that not all meshes possess these favorable characteristics; they are typically associated with high-quality grids. The efficiency of hardware-accelerated rendering and the ability to solve equations in physical simulation and geometric processing are often features implemented on such high-quality grids. Conversely, when a grid contains an excessive number of elements, issues like self-intersecting and sliding elements may arise, or the underlying geometry might not be accurately captured. In such cases, the mesh becomes unsuitable for downstream tasks, underscoring the importance of generating high-quality meshes tailored to specific shapes. Nonetheless, this task is often tedious and demands significant manual effort.The recent proliferation of algorithmic content generation and generative 3D modeling tools has given rise to an increased demand for automatic mesh generation. Traditionally, the creation of high-quality grids has been the domain of skilled technical artists and modelers. However, with the advent of automatic algorithm pipelines, the task is increasingly being addressed more efficiently and autonomously.Automatic mesh generation is now at the forefront of advancements, providing solutions to challenges that were previously reliant on manual intervention. These algorithms leverage computational techniques to analyze and understand the desired shape parameters, allowing for the generation of high-quality meshes without the need for extensive manual involvement. This shift is transforming the landscape of 3D modeling, making it more accessible and efficient for a broader range of users.The implications of automatic mesh generation extend beyond simplifying the creation process. They contribute to democratizing access to sophisticated 3D modeling capabilities, enabling individuals with varying levels of technical expertise to engage in content creation. Moreover, the efficiency of automatic mesh generation tools is invaluable in scenarios where rapid prototyping, iterative design processes, or large-scale content generation is required. Surface meshes serve as crucial elements in various computational fields, and their quality significantly influences their applicability in downstream tasks. The advent of automatic mesh generation, driven by algorithmic content creation tools, has revolutionized the traditional manual approaches, making 3D modeling more accessible and efficient. As technology continues to advance, the role of automatic mesh generation in shaping the future of computer graphics and related fields becomes increasingly prominent. Automatic algorithm pipeline is usually based on differentiable grid generation, that is, parameterization of three-dimensional surface grid space, and optimization of various targets through gradient-based technology. For example, reverse rendering, structural optimization and 3D modeling all make use of this basic building block. In a perfect world, such applications would perform simple gradient descent on some grid representations to optimize their desired goals. However, there are many obstacles in this workflow, from the basic problem of how to optimize grids with different topologies to the lack of stability and robustness of existing formulas, which lead to the output of irreparable low-quality grids. In this work, we put forward a new formula, which makes it closer to this goal and significantly improves the simplicity and quality of differentiable grid generation in various downstream tasks.Unless very careful initialization, local subdivision and regularization are used, it is easy to have degeneracy and local minima when directly optimizing the vertex position of the grid. The optimization of scalar fields or signed distance functions (SDFs) to extract triangular meshes plays a crucial role in various fields such as photogrammetry, generative modeling, and inverse physics. The choice of representation method for the scalar function and the mesh extraction algorithm significantly impacts the overall optimization pipeline's performance.One prevalent approach involves defining and optimizing a scalar field or SDF in space, followed by the extraction of a triangular mesh resembling the level set of the function. The challenge lies in the fact that the space of possible meshes is constrained. The algorithm chosen for mesh extraction directly influences the properties of the generated shapes.Currently, gradient-based mesh optimization often represents the three-dimensional surface mesh as the equivalent surface of a scalar field. This technique has gained popularity in applications like photogrammetry due to its effectiveness in generating realistic shapes. Classical isosurface extraction algorithms, such as Marching Cubes or Dual Contouring, are commonly employed in existing implementations. However, these algorithms are typically designed for extracting meshes from fixed known fields. In the context of optimization, they struggle to maintain mesh flexibility and may encounter issues of numerical instability.In response to these challenges, a novel isosurface representation method called FlexiCubes has been introduced. FlexiCubes is specifically designed to optimize unknown meshes concerning geometric, visual, and even physical properties. The core concept involves introducing carefully selected parameters into the representation method, allowing for local flexible adjustments to the extracted mesh geometry and connectivity. During optimization of downstream tasks, these parameters are updated concurrently with the underlying scalar field through an automatic discrimination process.FlexiCubes addresses the limitations of traditional isosurface extraction algorithms by providing a more adaptive and versatile framework. By incorporating additional parameters, it enables the representation of complex shapes with high-quality features, addressing issues of mesh freedom and numerical stability encountered in previous methods. This innovation opens up new possibilities for mesh optimization in various applications, contributing to advancements in the fields of computer graphics, simulation, and beyond. We propose this scheme based on the method of improving the topological properties of Dual Marching Cubes, and extend it to selectively generate tetrahedrons and hierarchical adaptive grids. In the implementation of the algorithm, we demonstrated how to use the FlexiCubes algorithm to extract grids from fixed signed distance fields (SDFs) without optimization. The algorithm extracts grids from the initial FlexiCubes grid, including the initial grid topology and cut grid feature points. Then, the algorithm is used for grid optimization, and the final generated image can intuitively see how the contour surface of FlexiCube evolves during the optimization process. It can be seen that it smoothly converges to the reference grid and successfully restores all sharp features.Experiments verify the success of FlexiCubes in synthetic benchmark test and practical application, and show that our proposed method has significantly improved the mesh quality and geometric fidelity.