Method and device for dynamic flattening of local area of three-dimensional scene based on flattened bounding sphere
Through the dynamic flattening method of local area in three-dimensional scenes based on the flattening and surrounding ball, the problems of poor modeling effect and irreversible flattening in three-dimensional modeling are solved, and high-quality visualization and dynamic flattening of three-dimensional scenes are realized, which simplifies the Operation process and improve computing efficiency.
Patent Information
- Application Number
- CN202110200213.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-23
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-02-23
AI Technical Summary
When handling large-scale scenarios, existing three-dimensional modeling technology has poor modeling effect on small and scattered targets such as trees and poles, resulting in the problem of hanging local models. The traditional software flattening method is irreversible and cannot achieve dynamic removal and recovery.
The dynamic flattening method of local areas in three-dimensional scenes based on flattening the surrounding ball is adopted. By defining the surrounding ball and the pressing plane, the vertex relationship is judged by the GPU vertex shader, the reversible flattening operation of the vertex is realized, and the surrounding ball and the pressing plane is dynamically adjusted, and the surrounding ball and pressing plane are carried out. Dynamic flattening of local areas.
It improves the visual quality of three-dimensional scenes, realizes dynamic flattening and reversible recovery of the user-defined surrounding ball, simplifies the operation process, improves the computing efficiency, and avoids the dependence of professional software.
Smart Images

Figure CN112927351B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of spatial information, and in particular relates to a method and device for dynamically flattening a local area of a three-dimensional scene based on a flattened enclosing sphere. Background Art
[0002] Three-dimensional models are an important data foundation for three-dimensional applications. Their quality is closely related to the visual effect of the entire scene in the application. High-quality models can improve the visual effect of the scene, while the existence of low-quality models hinders the perception and even affects the application effect. High-quality models generally use manual modeling or lidar modeling, but due to the high production cost, they are generally only used for key target modeling in three-dimensional applications of large-scale models. The remaining secondary key models generally use oblique photography methods. Oblique photography is suitable for batch modeling of large scenes. It has low production costs and fast production speeds. It can achieve three-dimensional reconstruction including geometric structures and textures. However, due to the limitations of current technology, the modeling effect of small and scattered targets such as trees and poles is poor, which will cause problems such as local models hanging in the air.
[0003] Professional modeling software can be used to remove the suspended parts to improve the model quality. The removal operation is essentially a secondary edit of the original model, and data (such as texture images) must be re-collected to modify the removed parts. Currently, some modeling software such as MeshMixer and wish3D provide a local flattening function for the model. There is no need to re-collect data. The suspended model (such as a pole) is directly flattened to the ground, which indirectly achieves the requirement of removing low-quality models. However, this method has the following problems: (1) Flattening by the modeling software is essentially a physical destruction of the three-dimensional model, resulting in new inconsistencies between the virtual scene and the actual scene. Since its operation is irreversible, it is unacceptable in some applications. (2) Some three-dimensional applications require the dynamic removal and restoration of local areas of the three-dimensional scene, which cannot be achieved using software to edit the model. Summary of the invention
[0004] Purpose of the invention: The present invention proposes a method and device for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere, which dynamically flattens and reversibly restores the local area according to the bounding sphere defined by the user, thereby improving the visualization quality of the three-dimensional scene.
[0005] Technical solution: The present invention proposes a method for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere, which specifically includes the following steps:
[0006] (1) Define the flattening bounding sphere in the user coordinate system: According to the position and size of the area to be flattened, define a sphere as the flattening bounding sphere, so that the bounding sphere tightly contains the area to be flattened and the radius of the sphere is as small as possible; record the coordinates of the center of the flattening bounding sphere O(x 0 ,y 0 ,z0 ) and radius R;
[0007] (2) Determine the position and equation of the flattening plane: In the user coordinate system, according to the shape of the area to be flattened, determine a plane that fits closely to its bottom as the flattening plane;
[0008] (3) Determine the projection center of the flattening operation;
[0009] (4) The parameters of the flattening plane equation, the coordinates of the center of the flattened bounding sphere, the radius of the bounding sphere, and the coordinates of the projection center of the flattening operation are passed to the GPU programmable pipeline;
[0010] (5) In the vertex shader of the GPU, the spatial relationship between the flattened bounding sphere, the flattened plane, and the vertex is determined, and the vertex is shifted and flattened.
[0011] Furthermore, the implementation process of step (3) is as follows:
[0012] In the user coordinate system, draw a perpendicular line from the center of the flattened bounding sphere to the flattened plane, extend it and intersect the sphere at point B, which is used as the projection center of the flattening operation. and the coordinates of the center of the sphere, determine the equation of a straight line in space, solve the equation of the straight line and the equation of the sphere together, and get the coordinates of B (x B ,y B ,z B ).
[0013] Furthermore, the step (5) comprises the following steps:
[0014] (51) Calculate the vertex V(x 1 ,y 1 ,z 1 ) to the center of the enclosing sphere, the square of the distance S1:
[0015] S1=(x 1 -x 0 ) 2 +(y 1 -y 0 ) 2 +(z 1 -z 0 ) 2 ;
[0016] (52) If S1 <= R 2 , indicating that the vertex V is in the bounding sphere, V(x 1 ,y 1 ,z 1 ) into the pressure plane equation f(x,y,z)=0, and let the result be S2:
[0017] S2=f(x 1 ,y1 ,z 1 );
[0018] (54) If S2>=0, it means that the vertex needs to be flattened. According to the straight line equation VB connecting V and B:
[0019]
[0020] The plane equation of the pressure plane P is f(x, y, z) = 0. The two equations are combined to obtain the coordinates of the intersection point, which is set as the new value of V;
[0021] (54) Participate in the normal rendering process with the reset V.
[0022] Based on the same inventive concept, the present invention also provides a device for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, the method for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere is implemented.
[0023] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects: the present invention can dynamically flatten and reversibly restore local areas according to a user-defined bounding sphere, thereby improving the visualization quality of the three-dimensional scene; the adopted bounding sphere only requires a small number of parameters (center and radius) to be defined, and interactive adjustment of the bounding sphere and the flattening surface are simple; and in the GPU shader, the algorithm for determining vertices that need to be flattened is simple and computationally efficient; compared with the traditional flattening method of model repair software, the present invention does not require professional users, does not require the use of professional software, and does not require actual modification of the model, and has stronger usability. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of the present invention;
[0025] Figure 2 To define the bounding sphere graph;
[0026] Figure 3 This is a visualization of the effect after the trees are flattened. DETAILED DESCRIPTION
[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0028] The present invention provides a method for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere. Figure 1 As shown, the specific steps include:
[0029] Step 1: Define a flattening bounding sphere in the user coordinate system: According to the position and size of the area to be flattened, define a sphere as the flattening bounding sphere, so that the bounding sphere tightly contains the area to be flattened and the radius of the sphere is as small as possible.
[0030] like Figure 2 As shown in the figure, a point is selected as the center of the sphere using the screen point selection method to draw a bounding sphere, and the bounding sphere is moved and scaled so that the size and position of the bounding sphere just contain the flattened area at the bottom of the target to be flattened. As shown in the figure, the trees are completely in the bounding sphere. Then, with the help of the viewport matrix, projection matrix and view matrix under the rendering camera viewpoint, the screen coordinates of the center of the sphere are transformed to the user coordinate system, and the coordinates of the center of the flattened bounding sphere at this time are recorded as O(x 0 ,y 0 ,z 0 ) with radius R.
[0031] Step 2: Determine the position and equation of the flattening plane: In the user coordinate system, according to the shape of the area to be flattened, determine the plane that fits closely with its bottom as the flattening plane.
[0032] In the user coordinate system, according to the shape of the area to be flattened, determine the plane that fits closely to its bottom as the flattening plane. Select three non-collinear points A on the ground at the bottom of the area to be flattened. 1 ,A 2 ,A 3 , determine the plane passing through the three major planes as the pressure plane, and calculate the pressure plane equation:
[0033] According to point A 1 ,A 2 ,A 3 , first determine the two vectors and Then calculate the normal vector of the pressure plane P
[0034]
[0035] Using the point method, the normal vector With A 1 ,A 2 ,A 3 The coordinates of any point can be calculated to get the equation of the pressure plane:
[0036] f(x,y,z)=ax+by+cz+d=0.
[0037] Step 3: Determine the projection center of the flattening operation.
[0038] Draw a perpendicular line from the center of the flattened sphere to the flattened plane, extend it and intersect the sphere at point B, which is the projection center of the flattening operation. and the coordinates of the center of the sphere, we can determine the equation of a straight line in space, and solve the equation of the straight line and the equation of the sphere together to obtain the coordinates of B (x B ,y B ,z B ).
[0039] Step 4: Pass the parameters of the flattening plane equation, the coordinates of the center of the flattened bounding sphere, the radius of the bounding sphere, and the coordinates of the flattening operation projection center into the GPU programmable pipeline.
[0040] Step 5: In the vertex shader of the GPU, determine the spatial relationship between the flattened bounding sphere, the flattened plane, and the vertices, and shift and flatten the vertices that are inside the bounding sphere and on one side of the flattened plane normal.
[0041] (5.1) Calculate the vertex V(x 1 ,y 1 ,z 1 ) to the center of the enclosing sphere, the square of the distance S1:
[0042] S1=(x 1 -x 0 ) 2 +(y 1 -y 0 ) 2 +(z 1 -z 0 ) 2 .
[0043] (5.2) If S1 <= R 2 , indicating that the vertex V is in the bounding sphere, V(x 1 ,y 1 ,z 1 ) into the pressure plane equation f(x,y,z)=0, and let the result be S2:
[0044] S2=f(x 1 ,y 1 ,z 1 ).
[0045] (5.3) If S2>=0, it means that the vertex needs to be flattened. According to the equation of the line connecting V and B:
[0046]
[0047] The plane equation of the pressure plane P is f(x, y, z) = 0. The two equations are combined to obtain the coordinates of the intersection point, which is set as the new value of V;
[0048] (5.4) Participate in the normal rendering process with the reset V.
[0049] Based on the above steps, the entire scene rendering is completed as follows Figure 3shown.
[0050] The present invention also provides a device for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, the method for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere is implemented.
Claims
1. A method for dynamic flattening of a local area of a three-dimensional scene based on a flattened bounding sphere, characterized in that: The following steps are involved: (1) Define a flattening bounding sphere in the user coordinate system: According to the position and size of the area to be flattened, define a sphere as the flattening bounding sphere, so that the bounding sphere tightly contains the area to be flattened and the radius of the sphere is as small as possible; record the coordinates 0 (x0, y0, z0) of the center of the flattening bounding sphere and the radius R; (2) Determine the position and equation of the flattening plane: In the user coordinate system, according to the shape of the area to be flattened, determine a plane that fits closely to its bottom as the flattening plane; (3) Determine the projection center of the flattening operation; (4) The parameters of the flattening plane equation, the coordinates of the center of the flattened bounding sphere, the radius of the bounding sphere, and the coordinates of the projection center of the flattening operation are passed to the GPU programmable pipeline; (5) In the vertex shader of the GPU, the spatial relationship between the flattened bounding sphere, the flattened plane, and the vertex is determined, and the vertex is shifted and flattened; The implementation process of step (3) is as follows: In the user coordinate system, draw a perpendicular line from the center of the flattened bounding sphere to the flattened plane, extend it and intersect the sphere at point B, which is used as the projection center of the flattening operation. and the coordinates of the center of the sphere, determine the equation of a straight line in space, solve the equation of the straight line and the equation of the sphere together, and get the coordinates of B (x B ,y B , z B ); The step (5) comprises the following steps: (51) Calculate the square of the distance S1 from the vertex V (x1, y1, z1) to the center of the bounding sphere: S1=(x1-x0) 2 +(y1-y0) 2 +(z1-z0) 2 ; (52) If S1 <= R 2 , indicating that the vertex V is in the bounding sphere, substitute V(x1, y1, z1) into the pressure plane equation f(x, y, z) = 0, and let the result be S2: S2 = f(x1, y1, z1); (53) If S2>=0, it means that the vertex needs to be flattened. According to the straight line equation VB connecting V and B: The plane equation of the pressure plane P is f(x, y, z) = 0. The two equations are combined to obtain the coordinates of the intersection point, which is set as the new value of V; (54) Participate in the normal rendering process with the reset V.
2. A device for dynamically flattening a local area of a three-dimensional scene based on a flattened bounding sphere, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into a processor, the method for dynamic flattening of a local area of a three-dimensional scene based on a flattened bounding sphere according to claim 1 is implemented.
Citation Information
Patent Citations
Topographical flattening method for three-dimensional scenes
CN107845136A
Sketch-Based Design System, Apparatus, and Method for the Construction and Modification of Three-Dimensional Geometry
US20090284550A1
