Method, apparatus, device and storage medium for processing virtual ground surface
By extracting and locking edge optimization of the adjacent boundary vertices of the target surface components, the joint light leakage problem caused by LOD optimization of surface components under UE4 engine is solved, and efficient rendering and virtual reality effects are achieved.
Patent Information
- Application Number
- CN202111371876.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-11-18
AI Technical Summary
When creating a large open world project under the UE4 engine, the LOD optimization of the topographic model at the far and near perspective positions led to problems such as hollowing, light leakage and visual effect penetration errors at the seams of the surface components.
The joint light leakage problem is solved by extracting the target vertices on the adjacent boundary between the target surface components and adjacent surface components and performing edge lock optimization based on these vertices.
Effectively solve the problem of light leakage between surface components of different LOD levels, reduce the calculation amount, avoid increasing rendering pressure, and ensure virtual reality effects.
Smart Images

Figure CN114092657B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, device, and storage medium for processing a virtual terrain surface. Background Art
[0002] When making a large open-world type project under the UE4 engine, due to requirements for rendering performance, it is often necessary to perform LOD (Level of Detail) optimization on terrain models at different viewing distances, and use terrain surface components with fewer vertices to render the terrain surface in the distance.
[0003] Since the vertex densities of the terrain surface components at the two LOD levels of near and far are different, the joints between the two LOD terrain surface components cannot be fully docked, resulting in a hollow seam, which in turn causes various problems, such as scene lighting leakage and visual effect penetration errors.
[0004] Currently, for this problem, there are mainly the following two solutions:
[0005] 1. Use vegetation to cover, that is, plant grass with a higher density near the seam between the two LOD terrain surface components to cover the hollow seam;
[0006] 2. Slightly reduce the coordinate height of the outer low-vertex terrain surface component, and use the principle of parallax to make it less likely to see the hollow seam.
[0007] These two solutions have the following problems: Although the problem of being able to see the hollow seam is solved, neither can solve the problem of lighting errors at the seam; using the method of vegetation cover increases the vegetation density and vegetation coverage in the distance, increasing the rendering pressure; reducing the coordinate height of the terrain surface component in the distance will cause some conflicts with the interaction of various elements in the virtual scene. Summary of the Invention
[0008] This application provides a method, apparatus, device, and storage medium for processing a virtual terrain surface, which is used to solve the problem of light leakage at the seams between terrain surface components with different LOD levels in the virtual terrain surface.
[0009] In a first aspect, an embodiment of this application provides a method for processing a virtual terrain surface, including:
[0010] Obtain a target terrain surface component in the virtual terrain surface;
[0011] When the LOD level to which the target terrain surface component is to be adjusted is different from the LOD level of the adjacent terrain surface component, extract target vertices; where the target vertices are the vertices on the boundary where the target terrain surface component is adjacent to the adjacent terrain surface component;
[0012] Based on the target vertices, perform edge locking optimization on the adjacent boundaries of the target surface component.
[0013] Optionally, the extracting of the target vertices includes:
[0014] Extract the vertices on the four peripheral boundaries of the target surface component;
[0015] Group the vertices on the four peripheral boundaries according to the positions of the vertices on the four peripheral boundaries to obtain an upper boundary group, a lower boundary group, a left boundary group, and a right boundary group;
[0016] Obtain the target boundary group of vertices whose positions are located on the adjacent boundary among the upper boundary group, the lower boundary group, the left boundary group, and the right boundary group;
[0017] Take the vertices within the target boundary group as the target vertices.
[0018] Optionally, after the extracting of the target vertices and before the performing of the edge locking optimization on the adjacent boundaries of the target surface component, the method further includes:
[0019] Filter the target vertices such that any specified vertex among the filtered target vertices satisfies that at least one of the inner product values with two adjacent vertices (the two adjacent vertices belong to the filtered target vertices) is not greater than a preset value;
[0020] Optionally, after the extracting of the target vertices, the method further includes:
[0021] Perform face reduction on the target surface component after removing the target vertices according to the LOD level to which the target surface component corresponds to be adjusted.
[0022] Optionally, the performing of the edge locking optimization on the adjacent boundaries of the target surface component based on the target vertices includes:
[0023] Extract the inner edges closest to the adjacent boundary from the target surface component after face reduction, and take the vertices on the inner edges as inner vertices;
[0024] Screen out the boundary outer vertices from the target vertices, where the boundary outer vertices are the closest to at least one of the inner vertices;
[0025] Construct outer filling triangles based on the target vertices, the boundary outer vertices, and the inner vertices;
[0026] Construct inner filling triangles based on the boundary outer vertices and the inner vertices;
[0027] Use the boundary graph including the outer filled triangle and the inner filled triangle as the optimized boundary graph for the edge locking of the target ground component.
[0028] Optionally, the screening of the boundary outer vertices from the target vertices includes:
[0029] Take each inner vertex in the inner edges as a to-be-processed inner vertex respectively, and execute the following process:
[0030] Take any one of the target vertices as a to-be-processed outer vertex, obtain a first vector from the to-be-processed outer vertex to the to-be-processed inner vertex; and obtain a second vector from the to-be-processed inner vertex to the next adjacent inner vertex of the to-be-processed inner vertex; if the projection distance value from the first vector to the second vector is less than half of the magnitude of the second vector, determine the to-be-processed outer vertex as a boundary outer vertex.
[0031] Optionally, constructing the outer filled triangle based on the target vertices, the boundary outer vertices, and the inner vertices includes:
[0032] In the arrangement order of the target vertices on the adjacent boundary, take each target vertex as a to-be-connected outer vertex in turn and execute the following process:
[0033] Obtain the inner vertex closest to the to-be-connected outer vertex as the to-be-connected inner vertex; the triangle formed by connecting the to-be-connected outer vertex, the to-be-connected inner vertex, and the next target vertex of the to-be-connected outer vertex in the arrangement order is used as the outer filled triangle.
[0034] Optionally, obtaining the inner vertex closest to the to-be-connected outer vertex as the to-be-connected inner vertex includes:
[0035] If the to-be-connected outer vertex is not a boundary outer vertex and there is a boundary outer vertex before the to-be-connected outer vertex in the arrangement order, obtain the last boundary outer vertex before the to-be-connected outer vertex in the arrangement order, and take the inner vertex closest to the last boundary outer vertex as the to-be-connected inner vertex corresponding to the to-be-connected outer vertex;
[0036] If the to-be-connected outer vertex is not a boundary outer vertex and there is no boundary outer vertex before the to-be-connected outer vertex in the arrangement order, obtain the to-be-connected inner vertex corresponding to the first target vertex in the arrangement order as the to-be-connected inner vertex corresponding to the to-be-connected outer vertex;
[0037] If the external vertex to be connected is the boundary external vertex, then use the first internal vertex on the internal edge as the internal vertex to be connected; the first internal vertex is the next internal vertex of the second internal vertex on the internal edge, and the second internal vertex is the internal vertex to be connected corresponding to the previous target vertex of the external vertex to be connected in the arrangement order.
[0038] Optionally, constructing the internal filling triangle based on the boundary external vertex and the internal vertex includes:
[0039] Perform the following process for each of the boundary external vertices:
[0040] Use the internal vertex closest to the boundary external vertex as the first internal vertex to be connected, and use the next internal vertex of the first internal vertex to be connected on the internal edge as the second internal vertex to be connected; the triangle formed by connecting the boundary external vertex, the first internal vertex to be connected, and the second internal vertex to be connected is used as the internal filling triangle.
[0041] In a second aspect, an embodiment of the present application provides a virtual ground surface processing device, including:
[0042] An acquisition module, configured to acquire a target ground surface component in the virtual ground surface;
[0043] An extraction module, configured to extract target vertices when the LOD level to which the target ground surface component is to be adjusted is different from the LOD levels of adjacent ground surface components; where the target vertices are the vertices on the boundary where the target ground surface component is adjacent to the adjacent ground surface components;
[0044] A side locking module, configured to perform side locking optimization on the adjacent boundary of the target ground surface component based on the target vertices.
[0045] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a memory, and a communication bus, where the processor and the memory complete communication with each other through the communication bus;
[0046] The memory is used to store a computer program;
[0047] The processor is configured to execute the program stored in the memory to implement the virtual ground surface processing method described in the first aspect.
[0048] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, storing a computer program, where the computer program, when executed by a processor, implements the virtual ground surface processing method described in the first aspect.
[0049] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: In the method provided by the embodiment of the present application, when the LOD level to which the target surface component in the virtual surface is to be adjusted is different from the LOD levels of adjacent surface components, that is, when there is a possibility of seam light leakage between the target surface component and the adjacent surface components after adjusting the LOD level, the vertices on the boundary where the target surface component is adjacent to the adjacent surface component are extracted as target vertices. Based on these target vertices, edge locking optimization is performed on the adjacent boundary of the target surface component, so that targeted edge locking optimization can be performed based on the vertices on the boundary where there is a possibility of seam light leakage, reducing the calculation amount and effectively solving the problem of seam light leakage between two surface components with different LOD levels. Moreover, this optimization method does not require adding extra elements, avoiding increasing the rendering pressure, nor does it require reducing the coordinate height of some surface components, ensuring the virtual reality effect based on this virtual surface. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.
[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0052] Figure 1 It is a schematic diagram of the operating system architecture of the virtual surface in the embodiment of the present application;
[0053] Figure 2 It is a schematic diagram of the processing method flow of the virtual surface in the embodiment of the present application;
[0054] Figure 3 It is a schematic diagram of the specific process of extracting target vertices in the embodiment of the present application;
[0055] Figure 4 It is a schematic diagram of extracting target vertices from the target surface component in the embodiment of the present application;
[0056] Figure 5A It is a schematic diagram of the filtering process in the embodiment of the present application;
[0057] Figure 5B It is a schematic diagram of the vertex distribution in the adjacent boundary in the embodiment of the present application;
[0058] Figure 6 It is a schematic diagram of the filtered adjacent boundary between the target surface component and the adjacent surface component in the embodiment of the present application;
[0059] Figure 7 Schematic diagram of the process of edge-locking optimization for the adjacent boundary of the target surface component in the embodiment of the present application;
[0060] Figure 8 Schematic diagram of an example for identifying the out-of-boundary vertices in the embodiment of the present application;
[0061] Figure 9A Schematic diagram of the graphic of edge-locking optimization in the embodiment of the present application;
[0062] Figure 9B Schematic diagram of the detailed process of processing the virtual surface in the embodiment of the present application;
[0063] Figure 10 Schematic diagram after edge-locking optimization for each surface component included in the surface proxy in the embodiment of the present application;
[0064] Figure 11 Schematic diagram of the display effect before optimizing the world map in the virtual animation in the embodiment of the present application Figure 1 ;
[0065] Figure 12 Schematic diagram of the display effect after optimizing the world map in the virtual animation in the embodiment of the present application Figure 2 ;
[0066] Figure 13 Schematic diagram of the display effect before optimizing the world map in the virtual animation in the embodiment of the present application Figure 3 ;
[0067] Figure 14 Schematic diagram of the display effect after optimizing the world map in the virtual animation in the embodiment of the present application Figure 4 ;
[0068] Figure 15 Schematic diagram of the structure of the processing device for the virtual surface in the embodiment of the present application;
[0069] Figure 16 Schematic diagram of the structure of the electronic device in the embodiment of the present application. Detailed implementation manners
[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the scope of protection of the present application.
[0071] First, the technical terms involved in the embodiments of the present application are explained as follows:
[0072] LOD (Level of detail) is the most commonly used virtual animation optimization technology. It determines the resource allocation for object rendering according to the position and importance of the model, reduces the number of faces and level of detail of unimportant objects, thereby obtaining high-efficiency rendering operations.
[0073] Level: In virtual animation, the virtual world map corresponds to multiple Levels, and a Landscape Proxy is saved within one Level.
[0074] Landscape Component: Each Landscape Proxy is segmented. According to the actual segmentation situation, this Landscape Component contains one or more Landscape Components, and the LOD levels of the Landscape Components belonging to the same Landscape Proxy are the same.
[0075] Among them, after a Landscape Component is optimized according to different LOD levels, the number of faces and vertices corresponding to different LOD levels are different, that is, the number of faces or vertices of a higher level is more, and the number of faces or vertices of a lower level is less.
[0076] To solve the problem of light leakage at the seams between landscape components of different LOD levels in the virtual landscape, an embodiment of the present application provides a method for processing a virtual landscape. This method can be applied to a Figure 1 running system of the virtual landscape as shown, and this system includes at least a terminal 10 and a server 11.
[0077] Among them, the terminal 10 can specifically be an electronic device such as a mobile phone, a tablet computer, or a computer that can install and run the application program of the virtual world map. This electronic device has a display function and establishes a wired or wireless communication connection with the server 11.
[0078] Among them, during the process of the application program running the virtual landscape, data interaction can be carried out between the terminal 10 and the server 11. The terminal 10 establishes a network connection with the server 11. The server 11 provides services for the application program installed on the terminal. A database is set on the server or independently of the server to provide data storage services for the server. The above network includes but is not limited to: wide area network, metropolitan area network, or local area network. The terminal 10 is not limited to a PC (Personal Computer), mobile phone, tablet computer, etc.
[0079] The method for processing the virtual ground surface based on this system architecture can be applied to a terminal or a server. When the processing capacity of the server is significantly higher than that of the terminal, it is preferably executed on the server.
[0080] The core idea of the optimization is to perform edge locking optimization on multiple Landscape Components with the same LOD level, that is, to retain the outermost high-precision edges of the Landscape Proxy to which the multiple Landscape Components with the same LOD level belong, and the edges between the Landscape Components inside the Landscape Proxy are kept as simplified models with the same precision.
[0081] Specifically, as Figure 2 shown, the process of the method for processing the virtual ground surface mainly includes the following steps:
[0082] Step 201, obtain the target ground surface component in the virtual ground surface.
[0083] Among them, the target ground surface component can be any ground surface component in the virtual world map.
[0084] Step 202, when the LOD level to which the target ground surface component is to be adjusted is different from the LOD level of the adjacent ground surface component, extract the target vertices; among them, the target vertices are the vertices on the boundary where the target ground surface component is adjacent to the adjacent ground surface component.
[0085] Among them, when the LOD level to which the target ground surface component is to be adjusted is lower than the LOD level of the adjacent ground surface component, extract the vertices on the boundary where the target ground surface component is adjacent to the adjacent ground surface component as the target vertices.
[0086] In a specific embodiment, the specific process of extracting the target vertices is as Figure 3 shown, and mainly includes:
[0087] Step 301, extract the vertices on the four peripheral boundaries of the target ground surface component;
[0088] Step 302, group the vertices on the four peripheral boundaries according to the positions of the vertices on the four peripheral boundaries to obtain an upper boundary group, a lower boundary group, a left boundary group, and a right boundary group;
[0089] Step 303, obtain the target boundary group of the vertices whose positions are on the adjacent boundary among the upper boundary group, the lower boundary group, the left boundary group, and the right boundary group;
[0090] Step 304, use the vertices in the target boundary group as the target vertices.
[0091] For example, as Figure 4 shown is a schematic diagram of extracting target vertices from a target ground surface component. In this schematic diagram, the upper group is the upper boundary group, the lower group is the lower boundary group (the vertices on the thicker line near the bottom in the figure), the left group is the left boundary group, and the right group is the right boundary group (the vertices on the thicker line near the right in the figure). Among the four boundary groups, the vertices in the left group and the upper group are the target vertices corresponding to the target ground surface component, and they are the vertices that need to be edge-locked and optimized for the target ground surface component. The right group and the lower group do not need to be edge-locked and optimized.
[0092] Step 203: Based on the target vertices, perform edge-locking optimization on the adjacent boundaries of the target ground surface component.
[0093] In the embodiment of the present application, when the LOD level to which the target ground surface component in the virtual ground surface is to be adjusted is different from the LOD level of the adjacent ground surface component, that is, when there is a possibility of seam light leakage between the target ground surface component and the adjacent ground surface component, extract the vertices on the adjacent boundary between the target ground surface component and the adjacent ground surface component as target vertices, and based on the target vertices, perform edge-locking optimization on the adjacent boundary of the target ground surface component, so that targeted edge-locking optimization can be performed based on the vertices on the boundary where there is a possibility of seam light leakage, reducing the calculation amount, and effectively solving the problem of seam light leakage between two ground surface components with different LOD levels. Moreover, this optimization method does not need to add redundant elements, avoiding increasing the rendering pressure, nor does it need to reduce the coordinate height of some ground surface components, ensuring the virtual reality effect based on the virtual world map.
[0094] In a specific embodiment, after extracting the target vertices and before performing edge-locking optimization on the adjacent boundary of the target ground surface component, the method further includes a process of filtering the extracted target vertices, so that the filtered target vertices satisfy: for any specified vertex in the filtered target vertices, at least one of the inner product values with each of the two adjacent vertices is not greater than a preset value; the two adjacent vertices belong to the filtered target vertices.
[0095] Filtering method 1
[0096] For example, as Figure 5A shown, the filtering process mainly includes:
[0097] Step 501: In one round of filtering process, in the arrangement order of the target vertices on the adjacent boundary, sequentially take each target vertex as a vertex to be recognized, and perform a judgment process on the vertex to be recognized; the judgment process includes: when the vertex to be recognized has two adjacent target vertices, obtain the inner product of the vertex to be recognized with each of the two adjacent target vertices respectively, and when both of the obtained two inner product values are greater than the preset value, take the vertex to be recognized as a vertex to be filtered out;
[0098] Step 502: Determine whether at least one target vertex to be filtered is obtained during the current filtering process. If so, after filtering the target vertex to be filtered, return to Step 501 to execute the next round of process. If not, the filtering process ends.
[0099] For example, as Figure 5B shown, assume that according to the arrangement order on the adjacent boundary, the target vertices include vertex 1, vertex 2, vertex 3, vertex 4, and vertex 5; for vertex 2, calculate the inner product of vertex 1 and vertex 2 to obtain an inner product value 1; calculate the inner product of vertex 2 and vertex 3 to obtain an inner product value 2; if both the inner product value 1 and the inner product value 2 are greater than the preset value, then filter vertex 2. Similarly, for vertex 3, calculate the inner product value 3 of vertex 3 and vertex 2, and calculate the inner product value 4 of vertex 3 and vertex 4; if both the inner product value 3 and the inner product value 4 are greater than the preset value, then filter vertex 3. After traversing each target vertex, traverse and execute this process again for the remaining target vertices after filtering until there are no target vertices to be filtered.
[0100] Filtering method two
[0101] According to the arrangement order of the target vertices on the adjacent boundary, sequentially use each of the target vertices except the first and last vertices in the arrangement order as the vertex to be recognized, and execute the following process:
[0102] Obtain the first vertex and the second vertex from the arrangement order, and determine whether the inner product of the first vertex and the vertex to be recognized, and the inner product of the second vertex and the vertex to be recognized are both greater than the preset value. If so, mark the vertex to be recognized as a vertex to be filtered. Among them, the first vertex is the previous vertex that has not been marked as a vertex to be filtered in the arrangement order of the vertex to be recognized, and the second vertex is the next vertex in the arrangement order of the vertex to be recognized. Filter the vertex to be filtered.
[0103] For example, if the vertex order is vertex 1, 2, 3, 4, 5, for vertex 2, it should be to calculate the inner product of vertex 1 and vertex 2, and the inner product of vertex 2 and vertex 3. If both of these inner product values are large, that is, greater than the preset value, then remove vertex 2; when it comes to vertex 3, calculate the inner product of vertex 1 and vertex 3, and the inner product of vertex 3 and vertex 4. If at least one of these two inner product values is not greater than the preset value, then retain vertex 3; when it comes to vertex 4, calculate the inner product of vertex 3 and vertex 4, and the inner product of vertex 4 and vertex 5. If at least one of these two inner product values is not greater than the preset value, then retain vertex 4.
[0104] In this embodiment, the larger the inner product value is, the flatter the ground surface is. The vertices with large inner product values are removed from the target vertices, which can filter out the edges with linear curvature. Since the edges with linear curvature have no obvious concavities and convexities, locking the edges will not cause obvious topological discontinuities and will not affect the effect of edge locking optimization. By filtering out from the target vertices, the number of target vertices can be reduced, thereby reducing the computational complexity of edge locking optimization based on the target vertices and improving the edge locking efficiency. As Figure 6 shown in the schematic diagram of the adjacent boundary after filtering, the positions where the edge locking optimization effect is not presented in the positions framed by the square in the schematic diagram are the vertices at the positions of the edges with linear curvature filtered by this method. It can be seen that for the vertices where the edge locking optimization is performed and retained, the ground surface has obvious undulations, and the filtered positions are relatively flat.
[0105] In a specific embodiment, after extracting the target vertices, according to the LOD level to which the target ground surface component is to be adjusted, the target ground surface component after extracting the target vertices is subjected to decimation to reduce the LOD level of the target ground surface component to meet the requirements of rendering performance. That is, the number of vertices / triangular faces included in the model of the target ground surface component is reduced, and the model of the target ground surface component is simplified.
[0106] In a specific embodiment, edge locking optimization is performed on the adjacent boundary of the target ground surface component, as Figure 7 shown, which specifically includes the following steps:
[0107] Step 701, extract the inner edge closest to the adjacent boundary from the target ground surface component after decimation, and use the vertices on the inner edge as inner vertices;
[0108] Step 702, screen out the boundary outer vertices from the target vertices, where the boundary outer vertices are the closest to at least one of the inner vertices;
[0109] Step 703, construct outer filling triangles based on the target vertices, the boundary outer vertices, and the inner vertices;
[0110] Step 704, construct inner filling triangles based on the boundary outer vertices and the inner vertices;
[0111] Step 705, use the boundary graph including the outer filling triangles and the inner filling triangles as the boundary graph after edge locking optimization of the target ground surface component.
[0112] In an exemplary embodiment, screening out the boundary outer vertices from the target vertices includes: respectively using each inner vertex in the inner edge as the inner vertex to be processed, and performing the following process:
[0113] Take any one of the said target vertices as the outer vertex to be processed, obtain the first vector from the outer vertex to be processed to the inner vertex to be processed; and obtain the second vector from the inner vertex to be processed to the next adjacent inner vertex of the inner vertex to be processed; if the projection distance value from the first vector to the second vector is less than half of the magnitude of the second vector, determine the outer vertex to be processed as the boundary outer vertex. It should be noted that this method of extracting the boundary outer vertex is only an example and does not mean that this method must be used to extract the boundary outer vertex closest to the inner vertex.
[0114] For ease of understanding, take Figure 8 As an example for identifying the boundary outer vertex, the outer border represents the boundary of the surface component, the inner border represents the inner edge closest to the boundary, vertex 4 on the outer boundary is the outer vertex to be processed, vertex b in the inner boundary is the inner vertex to be processed, the vector from vertex 4 to vertex b is the first vector, and the vector from vertex b to vertex c is the second vector.
[0115] In an exemplary embodiment, the process of constructing the outer filled triangle (i.e., triangular mesh) includes: in the order of arrangement of the said target vertices on the adjacent boundary, sequentially take each said target vertex as the outer vertex to be connected and perform the following process: obtain the inner vertex closest to the outer vertex to be connected as the inner vertex to be connected; connect the triangle formed by the outer vertex to be connected, the inner vertex to be connected, and the next target vertex of the outer vertex to be connected in the arrangement order as the outer filled triangle.
[0116] Among them, obtaining the inner vertex closest to the outer vertex to be connected as the inner vertex to be connected includes:
[0117] If the outer vertex to be connected is not the boundary outer vertex and there is a boundary outer vertex before the outer vertex to be connected in the arrangement order, then obtain the last boundary outer vertex before the outer vertex to be connected in the arrangement order, and take the inner vertex closest to the last boundary outer vertex as the inner vertex to be connected corresponding to the outer vertex to be connected;
[0118] If the outer vertex to be connected is not the boundary outer vertex and there is no boundary outer vertex before the outer vertex to be connected in the arrangement order, then obtain the inner vertex to be connected corresponding to the first target vertex in the arrangement order as the inner vertex to be connected corresponding to the outer vertex to be connected;
[0119] If the external vertex to be connected is the boundary external vertex, then use the first internal vertex on the internal edge as the internal vertex to be connected; the first internal vertex is the next internal vertex of the second internal vertex on the internal edge, and the second internal vertex is the internal vertex to be connected corresponding to the previous target vertex of the external vertex to be connected in the arrangement order.
[0120] In an exemplary embodiment, the process of constructing the internal filling triangle includes: performing the following process on each of the boundary external vertices:
[0121] Use the internal vertex closest to the boundary external vertex as the first internal vertex to be connected, and use the next internal vertex of the first internal vertex to be connected on the internal edge as the second internal vertex to be connected; the triangle formed by connecting the boundary external vertex, the first internal vertex to be connected, and the second internal vertex to be connected is used as the internal filling triangle.
[0122] Through the above process, the target vertices of the target surface component can be locked with edges in an orderly manner, so that the purpose of edge locking optimization can be achieved with fewer connections.
[0123] As Figure 9A shown is a graphical schematic diagram of edge locking optimization according to the above steps. In the boundary graph constructed according to this process, it can be divided into external filling triangles and internal filling triangles. The outer edges in the figure refer to the edges formed by connecting the target vertices, that is, the boundaries where the target surface component is adjacent to the adjacent surface components. The inner edges are the edges formed by connecting the inner vertices closest to the outer edges. The midpoint in the figure is the boundary external vertex. The vertices of the target surface component other than the inner and outer edges are filled with triangles, and the effect is as Figure 9A shown.
[0124] The following uses a specific embodiment to detail the processing process of the virtual surface. As Figure 9B shown, specifically as follows:
[0125] Step 901: Group the vertices on the four boundaries of each surface component in the virtual surface to obtain each boundary group;
[0126] Step 902: Determine whether each boundary group is the outer boundary of the surface proxy. If so, execute Step 903; if not, execute Step 905;
[0127] Step 903: Filter out the vertices with linear curvature in the boundary group whose judgment result is yes;
[0128] Step 904: Add the vertices in the filtered boundary group back to the simplified model of the surface component to which the boundary group belongs. The simplified model is the model after face reduction; go to execute Step 907;
[0129] Step 905: Simplify the boundary groups with a negative judgment result in the same way as the surface components are simplified;
[0130] Step 906: Add the simplified boundary groups back to the simplified model of the surface components;
[0131] Step 907: Perform triangle filling on the simplified model of the surface components based on the vertices in the filtered boundary groups;
[0132] Step 908: Combine the surface components after triangle filling into a surface proxy.
[0133] As Figure 10 shown in the figure, it is a schematic diagram of the edge locking optimization for each surface component included in a surface proxy. It can be seen that for the boundary groups of the surface components that do not belong to the boundary of the surface proxy, edge locking optimization is not required, and the same simplification operation as the surface components is maintained. For the boundary groups of the surface components that belong to the boundary of the surface proxy, edge locking optimization is required.
[0134] Based on the optimization method for the virtual world map provided in the above embodiments, optimize the world map in the virtual animation. Figure 11 Shown is the schematic diagram of the display effect of the animation before optimization. Figure 1 , there is a light leakage phenomenon at the connection position between the grassland and the steep slope within the area framed by the square. Figure 12 Shown is for Figure 11 the corresponding animation after optimization, the schematic diagram of the display effect. Figure 2 , the light leakage phenomenon at the connection position between the grassland and the steep slope within the area framed by the square is eliminated. Similarly, Figure 13 Shown is the schematic diagram of the display effect of the animation before optimization. Figure 3 , there are light leakage phenomena to varying degrees in the areas framed by the squares. Figure 14 Shown is for Figure 13 the corresponding animation after optimization, the schematic diagram of the display effect. Figure 4 , the light leakage phenomena within the areas framed by the squares are eliminated.
[0135] Based on the above analysis, the method for optimizing the virtual surface provided in the embodiments of the present application can effectively eliminate the light leakage phenomenon at the seam position of the surface components, and does not require edge locking optimization for the boundaries of each surface component. Only the vertices on the adjacent boundaries of two surface components with different LOD levels are subjected to edge locking optimization, greatly improving the optimization efficiency while ensuring the optimization effect.
[0136] Based on the same concept, an apparatus for processing a virtual surface is provided in the embodiments of the present application. For the specific implementation of the apparatus, reference can be made to the description in the method embodiment part, and the repeated parts will not be elaborated. As Figure 15 shown, the apparatus mainly includes:
[0137] An acquisition module 1501, configured to acquire a target surface component in a virtual surface;
[0138] An extraction module 1502, configured to extract target vertices when a LOD level to which the target surface component is to be adjusted is different from a LOD level of an adjacent surface component; wherein, the target vertices are vertices on a boundary where the target surface component is adjacent to the adjacent surface component;
[0139] An edge locking module 1503, configured to perform edge locking optimization on the adjacent boundary of the target surface component based on the target vertices.
[0140] Based on the same concept, an electronic device is further provided in an embodiment of the present application, as Figure 16 shown. The electronic device mainly includes: a processor 1601, a memory 1602, and a communication bus 1603. Among them, the processor 1601 and the memory 1602 complete mutual communication through the communication bus 1603. Among them, a program executable by the processor 1601 is stored in the memory 1602, and the processor 1601 executes the program stored in the memory 1602 to implement the following steps:
[0141] Acquire a target surface component in a virtual surface;
[0142] When a LOD level to which the target surface component is to be adjusted is different from a LOD level of an adjacent surface component, extract target vertices; wherein, the target vertices are vertices on a boundary where the target surface component is adjacent to the adjacent surface component;
[0143] Based on the target vertices, perform edge locking optimization on the adjacent boundary of the target surface component.
[0144] The communication bus 1603 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 1603 may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 16 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.
[0145] The memory 1602 may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far away from the aforementioned processor 1601.
[0146] The aforementioned processor 1601 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc., or may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0147] In yet another embodiment of the present application, a computer-readable storage medium is also provided. A computer program is stored in the computer-readable storage medium. When the computer program runs on a computer, it causes the computer to execute the method for processing the virtual ground surface described in the above embodiment.
[0148] In the above embodiment, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions are transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or a wireless manner (such as infrared, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive), etc.
[0149] It should be noted that, in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0150] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for processing a virtual ground surface, characterized in that, it includes: Obtain a target ground surface component in the virtual ground surface; When the LOD level to which the target ground surface component is to be adjusted is different from the LOD levels of adjacent ground surface components, extract target vertices; wherein, the target vertices are the vertices on the boundary where the target ground surface component is adjacent to the adjacent ground surface components; Based on the target vertices, perform edge locking optimization on the adjacent boundary of the target ground surface component; Wherein, after extracting the target vertices, the method further includes: According to the LOD level to which the target ground surface component is to be adjusted, perform face reduction processing on the target ground surface component after removing the target vertices; Wherein, the performing edge locking optimization on the adjacent boundary of the target ground surface component based on the target vertices includes: Extract the inner edge closest to the adjacent boundary from the target ground surface component after face reduction processing, and use the vertices on the inner edge as inner vertices; Screen out boundary outer vertices from the target vertices, wherein the boundary outer vertices are the closest to at least one of the inner vertices; Based on the target vertices, the boundary outer vertices, and the inner vertices, construct outer filling triangles; Based on the boundary outer vertices and the inner vertices, construct inner filling triangles; Use the boundary graph including the outer filling triangles and the inner filling triangles as the boundary graph after edge locking optimization of the target ground surface component; Wherein, the constructing outer filling triangles based on the target vertices, the boundary outer vertices, and the inner vertices includes: In the arrangement order of the target vertices on the adjacent boundary, sequentially use each target vertex as a to-be-connected outer vertex to perform the following process: Obtain the inner vertex closest to the to-be-connected outer vertex as the to-be-connected inner vertex; the triangle formed by connecting the to-be-connected outer vertex, the to-be-connected inner vertex, and the next target vertex of the to-be-connected outer vertex in the arrangement order is used as the outer filling triangle; Wherein, the constructing inner filling triangles based on the boundary outer vertices and the inner vertices includes: Perform the following process on each boundary outer vertex respectively: Use the inner vertex closest to the boundary outer vertex as the first to-be-connected inner vertex, and use the next inner vertex of the first to-be-connected inner vertex on the inner edge as the second to-be-connected inner vertex; the triangle formed by connecting the boundary outer vertex, the first to-be-connected inner vertex, and the second to-be-connected inner vertex is used as the inner filling triangle.
2. The method for processing a virtual ground surface according to claim 1, characterized in that, the extracting of the target vertices includes: Extract the vertices on the four peripheral boundaries of the target ground surface component; Group the vertices on the four peripheral boundaries according to the positions of the vertices on the four peripheral boundaries to obtain an upper boundary group, a lower boundary group, a left boundary group, and a right boundary group; Obtain the target boundary group of the vertices whose positions are on the adjacent boundary among the upper boundary group, the lower boundary group, the left boundary group, and the right boundary group; Use the vertices within the target boundary group as the target vertices.
3. The method for processing a virtual ground surface according to claim 1, wherein, after extracting the target vertices and before edge-locking optimization of the adjacent boundaries of the target ground surface components, the method further includes: Filter the target vertices such that any designated vertex among the filtered target vertices satisfies: at least one of the inner product values of the designated vertex with two adjacent vertices is not greater than a preset value; the two adjacent vertices belong to the filtered target vertices.
4. The method for processing a virtual ground surface according to claim 1, wherein, the screening of the boundary-outside vertices from the target vertices includes: Respectively take each inner vertex in the inner edges as a to-be-processed inner vertex, and perform the following process: Take any one of the target vertices as a to-be-processed outer vertex, obtain a first vector from the to-be-processed outer vertex to the to-be-processed inner vertex; and obtain a second vector from the to-be-processed inner vertex to the next adjacent inner vertex of the to-be-processed inner vertex; if the projection distance value from the first vector to the second vector is less than half of the magnitude of the second vector, determine the to-be-processed outer vertex as a boundary-outside vertex.
5. The method for processing a virtual ground surface according to claim 4, wherein, the obtaining of the inner vertex closest to the to-be-connected outer vertex as the to-be-connected inner vertex includes: If the to-be-connected outer vertex is not a boundary-outside vertex and there is a boundary-outside vertex before the to-be-connected outer vertex in the arrangement order, obtain the last boundary-outside vertex before the to-be-connected outer vertex in the arrangement order, and take the inner vertex closest to the last boundary-outside vertex as the to-be-connected inner vertex corresponding to the to-be-connected outer vertex; If the to-be-connected outer vertex is not a boundary-outside vertex and there is no boundary-outside vertex before the to-be-connected outer vertex in the arrangement order, obtain the to-be-connected inner vertex corresponding to the first target vertex in the arrangement order as the to-be-connected inner vertex corresponding to the to-be-connected outer vertex; If the to-be-connected outer vertex is a boundary-outside vertex, take the first inner vertex on the inner edge as the to-be-connected inner vertex; the first inner vertex is the next inner vertex of the second inner vertex on the inner edge, and the second inner vertex is the to-be-connected inner vertex corresponding to the previous target vertex of the to-be-connected outer vertex in the arrangement order.
6. A device for processing a virtual ground surface, wherein, it includes: An acquisition module for acquiring a target ground surface component in the virtual ground surface; An extraction module for extracting target vertices when the LOD level to which the target ground surface component is to be adjusted is different from the LOD levels of adjacent ground surface components; wherein, the target vertices are the vertices on the adjacent boundaries of the target ground surface component and the adjacent ground surface components. A decimation processing module, configured to perform decimation processing on the target surface component after removing the target vertices according to the LOD level to which the target surface component is to be adjusted; An edge locking module, configured to perform edge locking optimization on the adjacent boundaries of the target surface component based on the target vertices; wherein, the performing edge locking optimization on the adjacent boundaries of the target surface component based on the target vertices includes: extracting the inner edge closest to the adjacent boundary from the target surface component after decimation processing, and using the vertices on the inner edge as inner vertices; screening out boundary outer vertices from the target vertices, where the boundary outer vertices are the closest to at least one of the inner vertices; constructing outer filling triangles based on the target vertices, the boundary outer vertices, and the inner vertices; constructing inner filling triangles based on the boundary outer vertices and the inner vertices; using the boundary graph including the outer filling triangles and the inner filling triangles as the boundary graph after edge locking optimization of the target surface component; wherein, the constructing outer filling triangles based on the target vertices, the boundary outer vertices, and the inner vertices includes: sequentially using each of the target vertices as a to-be-connected outer vertex in the arrangement order of the target vertices on the adjacent boundary to perform the following process: obtaining the inner vertex closest to the to-be-connected outer vertex as the to-be-connected inner vertex; using the triangle formed by connecting the to-be-connected outer vertex, the to-be-connected inner vertex, and the next target vertex of the to-be-connected outer vertex in the arrangement order as the outer filling triangle; wherein, the constructing inner filling triangles based on the boundary outer vertices and the inner vertices includes: performing the following process on each of the boundary outer vertices: using the inner vertex closest to the boundary outer vertex as the first to-be-connected inner vertex, and using the next inner vertex of the first to-be-connected inner vertex on the inner edge as the second to-be-connected inner vertex; using the triangle formed by connecting the boundary outer vertex, the first to-be-connected inner vertex, and the second to-be-connected inner vertex as the inner filling triangle.
7. An electronic device, characterized in that, it includes: a processor, a memory, and a communication bus, wherein the processor and the memory communicate with each other through the communication bus; the memory is configured to store a computer program; the processor is configured to execute the program stored in the memory to implement the virtual surface processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, it implements the virtual surface processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Accelerated terrain rendering method based on graphics processor
CN102750725A
Three-dimensional model simplification method and device and storage medium
CN113379924A
Apparatus and method for representing multi-level LOD three-dimensional image
US20060132488A1