A solution for real-time rendering of 3D graphics
By chunking the three-dimensional scanning space and generating a grid using the marchingCube algorithm and shader+phong lighting model, the problem of high requirements for CPU and GPU hardware in the existing technology is solved, and a fast and high-precision real-time grid is achieved. Render.
Patent Information
- Application Number
- CN202111583657.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the prior art, the grid algorithm implemented by the CPU has high requirements for the CPU, affecting the real-time scanning speed. The GPU grid algorithm increases hardware requirements and is limited by the video memory size, which cannot meet the accuracy needs of the real-time grid.
Using a block real-time rendering scheme, the three-dimensional scanning space is roughly divided into several subspaces, each subspace overlaps in a certain proportion, and the grid is generated using the marchingCube algorithm and shader+phong lighting model, and the grid is optimized through vertex fusion and widget separation. generate.
It realizes fast mesh generation and rendering, meets the speed requirements of real-time scanning, and avoids the hardware requirements and video memory limitations of CPU and GPU mesh algorithms, ensuring high-precision mesh output.
Smart Images

Figure CN114359511B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional graphics, and in particular to a solution for real-time rendering of three-dimensional graphics. Background Art
[0002] In the field of 3D scanning equipment, the working process of scanning equipment is as follows: reconstruct 3D point cloud by acquiring 2D image information, and splice the 3D point cloud according to its characteristics to form a complete point cloud in a unified coordinate system, and finally generate 3D mesh from the 3D point cloud to complete the digitization of real objects. In 3D real-time scanning applications, WYSIWYG real-time rendering is an important link.
[0003] When common 3D graphics real-time rendering is used, there are two modes of user interaction in real-time scanning: point cloud rendering and mesh rendering. Point cloud rendering is faster than mesh rendering and can meet the requirements of real-time rendering. However, in many scenarios, 3D mesh is the basis of 3D printing. It can effectively reflect the characteristics of the real object through rendering. It has geometric topological characteristics, can effectively express connectivity and perform texture mapping, and truly reflect the surface of the object. 3D mesh is the real-time rendering and final output in the field of 3D scanning equipment. However, the existing mesh algorithm implemented by the CPU has high requirements on the CPU, which affects the real-time scanning speed. The existing GPU mesh algorithm not only increases the hardware requirements, but is also limited by the size of the video memory, which leads to the problem that the accuracy requirements of the real-time mesh cannot be met, and the working requirements of real-time rendering of 3D graphics cannot be met. Therefore, a solution for real-time rendering of 3D graphics is proposed. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the deficiencies of the prior art, the present invention provides a solution for real-time rendering of three-dimensional graphics, which solves the technical problems raised by the above-mentioned background technology.
[0006] (II) Technical solution
[0007] To achieve the above-mentioned purpose, the present invention provides the following technical solution: a solution for real-time rendering of three-dimensional graphics, comprising the following steps:
[0008] S101, when the 3D scanning software is started, the real-time grid is initialized according to the size of the scanned object, and the scanned space is roughly divided into several subspaces, and each adjacent subspace overlaps at a certain ratio, and the ratio value is 0.1;
[0009] S102, determine whether to pause. If scanning is continued, accept each frame of point cloud of 3D reconstruction, process each frame of point cloud, and assign each point cloud to a specified subspace according to the spatial position. If the subspace is not subdivided, subdivide it. The subdivided subspace contains a plurality of small red squares of small voxels.
[0010] S103, for each 3D point of the current frame point cloud, according to its 3D coordinates, calculate the block subspace where it is located, select a subspace for grid generation according to the strategy, and render the generated grid on the UI interface. Since the grids of adjacent subspaces overlap and affect the visual effect, the shader+phong lighting model is adopted;
[0011] S104, after the point cloud of the current frame is processed, the real-time grid of one of the block subspaces is updated. During the real-time grid generation process, the marchingCube algorithm is used to determine whether the current triangle face is credible based on the gradient of each small cube. Untrustworthy grids are marked with a warning color to instruct the user to scan multiple times;
[0012] S105, regularly delete small components, update all meshes, obtain the overall mesh by vertex fusion, and then separate small components to delete small components with vertices less than a threshold;
[0013] S106, if scanning continues, return to step S102, otherwise pause and update all real-time grids;
[0014] S107, generate a fine grid.
[0015] Preferably, the user makes the judgment based on the completeness of the real-time grid, that is, the judgment that the displayed grid has completely displayed the features of the scanned object or that the real-time grid has not changed substantially after repeated scanning.
[0016] Preferably, after the pause, the user generally observes the real-time grid from multiple angles through operations such as rotation, translation, and zooming in to determine whether there are abnormal parts with layered and warning grids, etc., and if so, the scan will be restarted.
[0017] Preferably, for areas with relatively high noise, if repeated scanning has no effect, the real-time grid will be partially cropped, cleaned, and then re-scanned.
[0018] Preferably, the size of the scanned object is preset in the three-dimensional scanning software, the entire space is slightly larger than the size of the scanned object, the entire space is a cube, and then each side of the entire cube is divided into n equal parts to obtain subspaces.
[0019] Preferably, the updating of the real-time grid is to calculate the implicit function value using Volume, and then generate the triangular facets corresponding to the subspace according to the MarchCube algorithm, that is, meshing.
[0020] Preferably, when scanning is paused, all meshes are forced to be updated, small component deletion, hole detection, etc. are performed. Small components are islands formed by connecting a number of smaller triangles among all triangular meshes generated by multiple subspaces. Most of the islands are generated by noise.
[0021] Preferably, the generation of fine mesh is started after the scanning is completed, and the rendering of fine mesh is completed. The fine mesh adopts the Poisson reconstruction algorithm to complete the generation of point cloud to mesh. The characteristics are high precision and slow generation speed. The texture and material are realized by a set of texture generation algorithms. After the fine mesh is generated, it still supports continued scanning. If continued scanning is performed, the existing fine mesh is abandoned and the real-time mesh is displayed.
[0022] (III) Beneficial effects
[0023] Compared with the prior art, the present invention provides a solution for real-time rendering of three-dimensional graphics, which has the following beneficial effects:
[0024] The scheme for real-time rendering of three-dimensional graphics divides the 3D grid of the three-dimensional scanning device into two parts, namely, the real-time grid and the fine grid. The real-time grid is mainly used for data display during scanning, and true color rendering is used to provide layered detection, navigation, missing parts filling and noise deletion for real-time scanning. The real-time grid sacrifices part of its accuracy and exchanges relatively coarse resolution for fast grid generation. The color of the grid vertices is interpolated with the color of the point cloud to achieve the purpose of fast grid generation and rendering. The fine grid is the output of the three-dimensional scanning device. The accuracy of the grid is higher than that of the real-time grid, and the characteristics are more obvious, including 3D grid, texture and material. The fine grid aims to generate a high-precision grid, sacrifices the grid generation time, and includes the generation of attributes such as texture and material, thereby avoiding the problem that the existing grid algorithm implemented by the CPU has high requirements on the CPU and affects the real-time scanning speed, and the existing GPU grid algorithm not only increases the hardware requirements but is also limited by the size of the video memory, thereby resulting in the problem that the accuracy requirements of the real-time grid cannot be met. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A simplified flowchart of the rendering scheme of the present invention;
[0026] Figure 2 It is a two-dimensional schematic diagram of the subspace initialization of the present invention;
[0027] Figure 3 This is a schematic diagram of the subspace subdivision of the present invention. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] The present invention provides a technical solution, a solution for real-time rendering of three-dimensional graphics, comprising the following steps:
[0030] See also Figure 1
[0031] S101. When the 3D scanning software is started, it will initialize the real-time grid according to the size of the scanned object, and roughly divide the scanning space into several subspaces. The size of the scanned object is preset in the 3D scanning software. The entire space is slightly larger than the size of the scanned object. The entire space is a cube. Please refer to Figure 2 , and then divide each side of the entire cube into n equal parts to obtain subspaces, and each adjacent subspace overlaps in a certain ratio, and the ratio value is 0.1;
[0032] S102, judging whether to pause, the user judges based on the completeness of the real-time grid, that is, whether the displayed grid has fully displayed the features of the scanned object or whether the real-time grid has basically not changed after repeated scanning. After pausing, the user generally observes the real-time grid from multiple angles through operations such as rotation, translation, and zooming in to judge whether there are abnormal parts with layered and warning grids, etc. If there are, the scan will be restarted. If scanning is continued, each frame of the 3D reconstructed point cloud is accepted, each frame of the point cloud is processed, and each point cloud is assigned to a specified subspace according to the spatial position. At this time, if the subspace is not subdivided, please refer to Figure 3 , then the subdivision is performed. The subdivided subspace contains multiple small red squares of small voxels. For areas with more noise, if repeated scanning has no effect, the real-time grid will be partially cropped, cleaned and re-scanned;
[0033] S103, for each 3D point of the current frame point cloud, according to its 3D coordinates, calculate the block subspace where it is located, select a subspace for grid generation according to the strategy, and render the generated grid on the UI interface. Since the grids of adjacent subspaces overlap and affect the visual effect, the shader+phong lighting model is adopted;
[0034] S104, after the point cloud of the current frame is processed, the real-time grid of one of the block subspaces is updated. During the real-time grid generation process, the marchingCube algorithm is used to determine whether the current triangle face is credible based on the gradient of each small cube. Untrustworthy grids are marked with a warning color to instruct the user to scan multiple times;
[0035] S105, regularly delete small components, update all meshes, obtain the overall mesh by vertex fusion, and then separate small components, delete small components with vertices less than the threshold, and when scanning is paused, force update all meshes, perform small component deletion, hole detection, etc. Small components are formed by connecting some small number of triangles in all triangular meshes generated by multiple subspaces to form isolated islands, and most of the isolated islands are caused by noise;
[0036] S106, if the scanning continues, return to step S102, otherwise pause and update all real-time grids. The real-time grid is updated by using Volume to calculate the implicit function value, and then generating the triangular facets corresponding to the subspace according to the MarchCube algorithm, that is, meshing;
[0037] S107, generate fine mesh. Start fine mesh generation after scanning and complete rendering of fine mesh. Fine mesh uses Poisson reconstruction algorithm to complete point cloud to mesh generation. It has the characteristics of high precision and slow generation speed. Texture and material are realized by a set of texture generation algorithms. After fine mesh generation, it still supports continued scanning. If continued scanning is performed, the existing fine mesh will be abandoned and the real-time mesh will be displayed.
[0038] The working principle of this device is as follows: first, the user starts the 3D scanning software. The size of the scanned object is preset in the 3D scanning software. The entire space is slightly larger than the size of the scanned object. The entire space is a cube. Then, each side of the entire cube is divided into n equal parts to obtain subspaces. Each adjacent subspace overlaps at a certain ratio, and the ratio value is 0.1. The user decides whether to pause based on the completeness of the real-time grid, that is, whether the displayed grid has fully displayed the features of the scanned object or whether the real-time grid has basically not changed after repeated scanning. If paused, the user can observe the real-time grid from multiple angles through operations such as rotation, translation and zooming in to determine whether there are abnormal parts, layering and warning grids, etc. If so, it will be restarted. Start the 3D software to scan. If you keep scanning, each frame of the 3D reconstructed point cloud will be accepted and processed. Each point cloud will be assigned to the specified subspace according to the spatial position. If the subspace is not subdivided, it will be subdivided. The subdivided subspace contains multiple red squares of small voxels. For places with more noise, if repeated scanning has no effect, the real-time grid will be partially cropped, cleaned and rescanned. For each 3D point of the current frame point cloud, according to its 3D coordinates, the block subspace where it is located is calculated. According to the strategy, a subspace is selected for grid generation and the generated grid is rendered on the UI interface. Since the grids of adjacent subspaces have overlapping shadows, The shader+phong lighting model is used to affect the visual effect. After the point cloud of the current frame is processed, the real-time mesh of one of the sub-block subspaces is updated. During the real-time mesh generation process, the marchingCube algorithm is used to determine whether the current triangle face is credible based on the gradient of each small cube. Untrustworthy meshes are marked with warning colors to instruct users to scan multiple times. Small components are formed by connecting a small number of triangle faces in all triangular meshes generated by multiple subspaces to form isolated islands. Most of the isolated islands are caused by noise. The overall mesh is obtained by vertex fusion, and then separated by small components. Small components with vertices less than the threshold are deleted. When scanning is paused, forced update For all meshes, execute small component deletion, hole detection, etc. If scanning continues, return to step S102, otherwise pause and update all real-time meshes. To update the real-time mesh, Volume is used to calculate the implicit function value, and then the triangular facets corresponding to the subspace are generated according to the MarchCube algorithm, that is, meshing. After the scan is completed, fine mesh generation is started and the rendering of the fine mesh is completed. The fine mesh uses the Poisson reconstruction algorithm to complete the generation of point cloud to mesh. It is characterized by high precision and slow generation speed. Textures and materials are realized by a set of texture generation algorithms. After the fine mesh is generated, continued scanning is still supported. If continued scanning is performed, the existing fine mesh is abandoned and the real-time mesh is displayed.
[0039] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0040] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A solution for real-time rendering of three-dimensional graphics, characterized in that: The following steps are involved: S101, when the 3D scanning software is started, the real-time grid is initialized according to the size of the scanned object, and the scanned space is roughly divided into several subspaces, and each adjacent subspace overlaps at a certain ratio, and the ratio value is 0.1; S102, determine whether to pause. If scanning is continued, accept each frame of point cloud of 3D reconstruction, process each frame of point cloud, and assign each point cloud to a specified subspace according to the spatial position. If the subspace is not subdivided, subdivide it. The subdivided subspace contains a plurality of small red squares of small voxels. S103, for each 3D point of the current frame point cloud, according to its 3D coordinates, calculate the block subspace where it is located, select a subspace for grid generation according to the strategy, and render the generated grid on the UI interface. Since the grids of adjacent subspaces overlap and affect the visual effect, the shader+phong lighting model is adopted; S104, after the point cloud of the current frame is processed, the real-time grid of one of the block subspaces is updated. During the real-time grid generation process, the marchingCube algorithm is used to determine whether the current triangle face is credible based on the gradient of each small cube. Untrustworthy grids are marked with a warning color to instruct the user to scan multiple times; S105, regularly delete small components, update all meshes, obtain the overall mesh by vertex fusion, and then separate small components to delete small components with vertices less than a threshold; S106, if scanning continues, return to step S102, otherwise pause and update all real-time grids; S107, generating a fine grid; After the scanning is completed, the generation of fine mesh is started and the rendering of fine mesh is completed. The fine mesh adopts the Poisson reconstruction algorithm to complete the generation of point cloud to mesh. The characteristics are high precision and slow generation speed. The texture and material are realized by a set of texture generation algorithms. After the fine mesh is generated, it still supports continued scanning. If continued scanning is performed, the existing fine mesh will be abandoned and the real-time mesh will be displayed.
2. A solution for real-time rendering of three-dimensional graphics according to claim 1, characterized in that: The user makes the judgment based on the completeness of the real-time grid, that is, the judgment that the displayed grid has completely displayed the features of the scanned object or that the real-time grid has not changed substantially after repeated scanning.
3. A solution for real-time rendering of three-dimensional graphics according to claim 2, characterized in that: After the pause, the user can observe the real-time grid from multiple angles through rotation, translation, and zoom operations to determine whether there are abnormal parts with layered and warning grids, and if so, the scan will be restarted.
4. A solution for real-time rendering of three-dimensional graphics according to claim 3, characterized in that: For areas with a lot of noise, if repeated scanning has no effect, the real-time grid will be partially cropped, cleaned and rescanned.
5. The solution for real-time rendering of three-dimensional graphics according to claim 1, characterized in that: The size of the scanned object is preset in the three-dimensional scanning software. The entire space is slightly larger than the size of the scanned object. The entire space is a cube, and then each side of the entire cube is divided into n subspaces.
6. The solution for real-time rendering of three-dimensional graphics according to claim 1, characterized in that: The updating of the real-time grid is to calculate the implicit function value using Volume, and then generate the triangular facets corresponding to the subspace according to the MarchCube algorithm, that is, meshing.
7. The solution for real-time rendering of three-dimensional graphics according to claim 1, characterized in that: When the scanning is paused, all meshes are forced to be updated, small components are deleted, and holes are detected. Small components are islands formed by connecting some small number of triangles in all triangular meshes generated by multiple subspaces.
Citation Information
Patent Citations
Terrain deformation method and device
CN111773699A
Skeletal systems for animating virtual avatars
CN112437950A