Navigation grid generation method and device, equipment and storage medium
By identifying and binding pathfinding information from multiple reference areas during the navigation grid generation process, the problem of insufficient navigation grid generation quality is solved, and the accuracy of pathfinding is improved.
Patent Information
- Application Number
- CN202411018256.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2026-01-27
AI Technical Summary
In existing technologies, the quality of navigation mesh generation is insufficient, affecting the accuracy of pathfinding.
The generation method includes acquiring multiple reference areas on the map, identifying overlapping areas, binding the pathfinding information of multiple reference areas to these overlapping areas, and generating a navigation grid.
It improves the quality of navigation mesh generation and enhances the accuracy of pathfinding.
Smart Images

Figure CN121409232A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for generating a navigation mesh. Background Technology
[0002] With the development of computer technology, more and more scenarios require the generation of navigation meshes, which are polygonal meshes used for pathfinding in complex spaces. For example, in game scenarios, navigation meshes for virtual maps need to be generated to guide virtual characters in the game.
[0003] The quality of navigation mesh generation affects the accuracy of pathfinding; therefore, improving the quality of navigation mesh generation is an urgent problem to be solved. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for generating a navigation mesh, which can be used to improve the quality of the generated navigation mesh, thereby improving the accuracy of the pathfinding subject when navigating based on the generated navigation mesh. The technical solution is as follows: On one hand, embodiments of this application provide a method for generating a navigation mesh, the method comprising: Obtain multiple reference regions set for the map, wherein the multiple reference regions overlap; Based on the plurality of reference regions, a navigation grid for the map is generated. The navigation grid includes a first grid, which is located in an overlapping area formed by at least two of the plurality of reference regions. The first grid is bound to routing information corresponding to the at least two reference regions respectively.
[0005] On the other hand, a navigation mesh generation apparatus is provided, the apparatus comprising: The acquisition module is used to acquire multiple reference areas set for the map, wherein the multiple reference areas overlap; A generation module is used to generate a navigation grid for the map based on the plurality of reference areas. The navigation grid includes a first grid, which is located in an overlapping area formed by at least two of the plurality of reference areas. The first grid is bound to pathfinding information corresponding to the at least two reference areas respectively.
[0006] In one possible implementation, the generation module is configured to acquire matching information of at least one target voxel corresponding to the map, wherein the matching information of any target voxel is used to indicate the matching status of the target voxel with the plurality of reference areas, and the at least one target voxel is obtained by voxelizing the map; based on the matching information of the at least one target voxel, a navigation polygon is generated, wherein the navigation polygon is used to represent the area outline of a traversable area on the map; and based on the navigation polygon, a navigation grid of the map is generated.
[0007] In one possible implementation, the generation module is configured to filter out a passable first voxel from the at least one target voxel based on a first passability condition and matching information of the at least one target voxel; and generate the navigation polygon based on the first voxel.
[0008] In one possible implementation, the generation module is configured to generate a passable region based on the first voxel; determine the region boundaries between different region types within the passable region; and generate the navigation polygon based on the region boundaries.
[0009] In one possible implementation, the acquisition module is further configured to voxelize the map to obtain at least one initial voxel corresponding to the map; based on a second passability condition, select a passable second voxel from the at least one initial voxel, and use the second voxel as the at least one target voxel.
[0010] In one possible implementation, the matching information of any target voxel is read from a matching information record field configured for the target voxel, and the matching information record field is filled based on the matching situation of the target voxel with the plurality of reference regions.
[0011] In one possible implementation, the matching information of any target voxel includes first information, which indicates the region type of the reference region in which the any target voxel is matched in the plurality of reference regions.
[0012] In one possible implementation, the matching information of any target voxel includes second information indicating the number of reference regions that the any target voxel matches in the plurality of reference regions.
[0013] In one possible implementation, the generation module is configured to divide the navigation polygon into at least two adjacent convex polygons; and generate the navigation mesh based on the at least two adjacent convex polygons.
[0014] In one possible implementation, the first grid is bound to index information of at least two reference regions, and the index information of any reference region is used to index the routing information corresponding to any reference region. The data volume of the index information of any reference region is less than the data volume of the routing information corresponding to any reference region.
[0015] In one possible implementation, the first grid is located in an overlapping region formed by at least two of the plurality of reference regions, including: the center point of the first grid is located in the overlapping region.
[0016] In one possible implementation, at least one of the plurality of reference regions has a custom shape, which is different from the fixed shape corresponding to the map.
[0017] In one possible implementation, the generation module is further configured to determine the pathfinding method corresponding to the first grid based on the pathfinding information corresponding to the at least two reference regions, provided that the first grid satisfies the pathfinding conditions.
[0018] The technical solution provided in this application has at least the following beneficial effects: In this embodiment, multiple overlapping reference areas are allowed to be set on the map. In the final generated navigation grid, the first grid is bound to the pathfinding information corresponding to at least two reference areas. The information bound to the first grid is more comprehensive and can express the information of the area more comprehensively and accurately. The generation quality of the navigation grid is high, which helps to improve the accuracy of the pathfinding subject when navigating based on the generated navigation grid. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the structure of a computer system provided in an embodiment of this application; Figure 2 This is a flowchart of a method for generating a navigation mesh provided in an embodiment of this application; Figure 3 This is a schematic diagram of a Convex Volume region editing tool provided in an embodiment of this application; Figure 4 This is a schematic diagram of a reference area provided in an embodiment of this application; Figure 5This is a schematic diagram of an overlapping region provided in an embodiment of this application; Figure 6 This is a schematic diagram of basic information about a reference area provided in an embodiment of this application; Figure 7 This is a schematic diagram of a default field provided in an embodiment of this application; Figure 8 This is a schematic diagram showing an overlapping area provided in an embodiment of this application; Figure 9 This is a schematic diagram showing another overlapping area provided in an embodiment of this application; Figure 10 This is a schematic diagram illustrating an overlapping area in related technologies; Figure 11 This is a schematic diagram showing another overlapping area provided in an embodiment of this application; Figure 12 This is an overall flowchart of a navigation mesh generation method provided in an embodiment of this application; Figure 13 This is a schematic diagram of the structure of a navigation mesh generation device provided in an embodiment of this application; Figure 14 This is a schematic diagram of the structure of a server provided in an embodiment of this application; Figure 15 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0022] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0023] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on conventional or non-inventive effort. For steps that do not logically have a necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application. In actual processing or when the control device executes the method, it may be executed sequentially or in parallel according to the method shown in the embodiments or drawings.
[0024] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0025] Figure 1 A schematic diagram of a computer system provided in an embodiment of this application is shown. The computer system includes a terminal device 101 and a server 102.
[0026] In one possible implementation, the terminal device 101 is any electronic product capable of human-computer interaction with an interactive object through one or more means such as a keyboard, touchpad, touch screen, remote control, voice interaction, or handwriting device. Examples include PCs (Personal Computers), mobile phones, smartphones, PDAs (Personal Digital Assistants), wearable devices, handheld portable gaming devices, PPCs (Pocket PCs), tablets, laptops, desktop computers, smart car systems, smart TVs, smart speakers, smartwatches, and in-vehicle terminals, but it is not limited to these.
[0027] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. This application embodiment does not limit this. Server 102 communicates directly or indirectly with terminal device 101 via wired or wireless communication methods, which is not limited here. Server 102 has data receiving, data processing, and data sending functions. Of course, server 102 may also have other functions, which are not limited in this application embodiment.
[0028] Server 102 provides background services for the client installed on terminal device 101. In one possible implementation, server 102 undertakes the main computing work, and terminal device 101 undertakes the secondary computing work. Alternatively, server 102 undertakes the secondary computing work, and terminal device 101 undertakes the main computing work. Or, terminal device 101 and server 102 collaborate on computing using a distributed computing architecture.
[0029] Terminal device 101 can refer to one of a plurality of terminal devices. This embodiment uses terminal device 101 as an example. Those skilled in the art will know that the number of terminal devices 101 can be more or less. For example, there may be only one terminal device 101, or there may be dozens or hundreds of terminal devices 101, or more. This application embodiment does not limit the number or type of terminal devices 101.
[0030] The navigation mesh generation method provided in this application embodiment can be executed by terminal device 101, server 102, or interactively by terminal device 101 and server 102; this application embodiment does not limit this. In some embodiments, terminal device 101 can send multiple set reference areas to server 102. Server 102 processes the multiple reference areas sent by terminal device 101 using the navigation mesh generation method provided in this application embodiment to obtain the final navigation mesh, and then sends the navigation mesh to terminal device 101.
[0031] For example, such as Figure 1 As shown, server 102 can generate a navigation mesh based on the following process: server 102 obtains multiple reference areas set for the map, and the multiple reference areas overlap; voxelizes the map to obtain at least one initial voxel corresponding to the map; based on a second traversability condition, selects a traversable second voxel from the at least one initial voxel, and uses the second voxel as at least one target voxel; obtains matching information for at least one target voxel corresponding to the map; based on the first traversability condition and the matching information of at least one target voxel, selects a traversable first voxel from the at least one target voxel; generates a navigation polygon based on the first voxel; and generates a navigation mesh for the map based on the navigation polygon.
[0032] Those skilled in the art should understand that the terminal device 101 and server 102 described above are merely illustrative examples. Other existing or future terminal devices or servers that are applicable to this application should also be included within the scope of protection of this application, and are hereby incorporated by reference.
[0033] Based on the above Figure 1The computer system shown in this application provides a method for generating a navigation mesh. This method can be executed by a terminal device 101, a server 102, or through interaction between the terminal device 101 and the server 102. This application does not limit the specific implementation of this method. This application describes the method as being executed by a computer device, which can be either a terminal device or a server. Figure 2 As shown, the navigation mesh generation method provided in this application embodiment may include the following steps 201 to 202.
[0034] In step 201, multiple reference areas are obtained for the map settings, and these multiple reference areas overlap.
[0035] A map is a representation of graphics or images appearing in space on a plane or sphere in a two-dimensional or multi-dimensional form and using various methods. The maps in this application include, but are not limited to, virtual maps corresponding to virtual spaces in games, and the terrain content represented by the maps includes, but is not limited to, virtual plains and virtual oceans. This application does not limit the terrain content represented by the maps.
[0036] The reference area is a pre-defined region for the map. Different reference areas can be of the same region type or different region types. For example, when the map is a virtual map in a game, the region type of the reference area can be a lake on the virtual map, a mountain on the virtual map, or a battle area on the virtual map. This application does not limit the region type of the reference area; it can be set according to the needs of the region type when setting up the map.
[0037] The following section explains the setup of multiple reference areas on the map.
[0038] As an optional implementation, at least one of the multiple reference areas has a custom shape, which is different from the fixed shape corresponding to the map.
[0039] Fixed shapes are shapes whose vertices cannot be edited or modified. They can be understood as pre-defined, complete shapes, and can be directly used by selecting any fixed shape. Custom shapes are shapes whose vertices can be edited and modified. They can be understood as shapes generated based on a custom desired shape. This application does not limit the number of reference regions with custom shapes in multiple reference regions. All shapes in multiple reference regions can be custom shapes, or a combination of custom and fixed shapes. The reference regions for custom shapes in multiple reference regions can be set according to actual needs.
[0040] In some embodiments, a reference region is set on the map using a NavMesh Modifier Volume. However, the shape of the reference region generated on the map is a simple, fixed shape, such as a cone, cube, cylinder, sphere, or stepped shape. This application supports customizing the shape of the reference region; that is, the shape of the reference region can be customized to better fit the shape of the terrain on the map. For example, it supports setting reference regions with shapes that fit terrain such as lakes and grasslands. For example, the region data of the reference region can be exported via command line.
[0041] The method for setting the custom shape of the reference area includes, but is not limited to, manually setting it according to actual needs; or, based on a preliminary shape automatically generated by a computer, manually revising the preliminary shape to obtain the final shape. This application does not limit the method for setting the custom shape of the reference area.
[0042] The multiple reference areas provided in this application include at least one reference area with a custom shape, which ensures the flexibility of setting reference areas on the map. The shape of special area types can be customized and edited to improve the placement accuracy of reference areas on the map, thereby improving the accuracy of generating navigation grids on the map.
[0043] Optionally, the way to make the shape of any reference region a custom shape includes, but is not limited to, providing a region editing tool at the engine tool level that allows setting the main body of the reference region by manually placing the initial polygon on the map and then customizing the shape of the initial polygon by editing each vertex of the initial polygon, thus ultimately forming the reference region.
[0044] As an optional implementation, the region editing tool provides a segmentation tool for dividing a concave polygon into several convex polygons.
[0045] When any reference region requires a custom shape, editing the polygon corresponding to the initial custom shape will generate a custom shape of a concave polygon. A Convex Volume is a commonly used convex polygon in game development, used in game engines to define 3D regions. Convex Volumes facilitate fast and efficient subdivision and calculation, allowing AI (Artificial Intelligence) to navigate complex environments. Since the server requires convex polygon data, when exporting Convex Volume data, a segmentation tool is used to divide the concave polygon into several convex polygons. Therefore, the Convex Volume will export several convex polygon data sets.
[0046] See Figure 3 This application provides a Convex Volume region editing tool that creates a CustomConvexVolumePrefab (custom convex volume prefab) on the right side of the display interface and customizes the required Convex Volume in the custom convex volume interface on the left side of the display interface.
[0047] It should be noted that in this application, the number of reference areas pre-defined in the map is multiple, and these multiple reference areas overlap. For example, since the multiple reference areas overlap, there is at least one overlapping area among them. Any overlapping area is the area where at least two of the multiple reference areas overlap.
[0048] The overlapping region of at least two reference regions can refer to either a partially overlapping region or a completely overlapping region. When the overlapping region of at least two reference regions is a partially overlapping region, each of the at least two reference regions has an independent area, and they also share a common overlapping area; this overlapping region is a part of any one of the at least two reference regions. When the overlapping region of at least two reference regions is a completely overlapping region, this overlapping region is any one of the at least two reference regions, meaning that the outlines of the at least two reference regions are completely identical.
[0049] For at least one overlapping region corresponding to multiple reference regions, different overlapping regions correspond to different combinations of reference regions. In other words, different overlapping regions are obtained by overlapping different reference regions. For example, overlapping region A is formed by overlapping a first reference region and a second reference region; overlapping region B is formed by overlapping a first reference region, a second reference region, and a third reference region; and overlapping region C is formed by overlapping a first reference region and a fourth reference region.
[0050] In other words, any overlapping combination of reference regions is defined as a new overlapping region. For example, reference... Figure 4 The first reference region, the second reference region, and the third reference region. When the three reference regions (the first reference region, the second reference region, and the third reference region) overlap, the reference... Figure 5 The region where the first reference region and the second reference region overlap but the third reference region does not overlap is defined as the first overlapping region; the region where the second reference region and the third reference region overlap but the first reference region does not overlap is defined as the second overlapping region; and the region where the first reference region, the second reference region, and the third reference region overlap is defined as the third overlapping region.
[0051] Once the Convex Volumes for all reference regions in multiple reference regions are set, the process of generating a navigation grid based on the map and the set multiple reference regions is described below.
[0052] For example, multiple reference areas may overlap, including but not limited to: the pre-set combat area A of a virtual character may overlap with the grass area B.
[0053] In step 202, a navigation grid for the map is generated based on multiple reference areas. The navigation grid includes a first grid, which is located in the overlapping area formed by at least two of the multiple reference areas. The first grid is bound to the pathfinding information corresponding to at least two reference areas respectively.
[0054] Navigation meshes assist pathfinding entities in moving and navigating within a map. For example, navigation meshes can also be generated using Navmesh. Navmesh is used to develop navigation meshes (3D meshes) in games, helping virtual characters move and navigate in complex virtual environments. Navmesh divides the virtual environment in a game into multiple small triangles and establishes paths between these triangles, allowing virtual characters to move easily.
[0055] As an optional implementation, the method further includes: importing basic information about a map and multiple reference areas, and constructing baking parameters for the navigation grid.
[0056] For example, the process of importing a map is actually to import the 3D modeling data obj (geometric definition file format) file of the map, import the vertex information in the obj file into memory, and store the map information in the form of triangles.
[0057] Optionally, the basic information of multiple reference regions may be imported, including but not limited to, in the following format: vertex type of the reference region, number of vertices in the reference region, region type of the reference region, vertical coordinates of the lowest point of the reference region, vertical coordinates of the highest point of the reference region, region identifier corresponding to the reference region, and x, y, z coordinates of a single vertex of the reference region relative to the map. When the map is a 3D map, x, y, and z are the three coordinate axes in 3D space. x, y, and z can be customized according to actual needs; for example, x, y, and z can be the x, y, and z coordinates corresponding to the right-hand coordinate system. Importing each reference region into memory in the above format facilitates accurate reading of the basic information of each reference region during subsequent map-reference region integration.
[0058] For example, see Figure 6 ,like Figure 6 The corresponding coordinate system is a right-handed coordinate system, and the vertex type is the vertex (V) of the reference region; this reference region has 4 vertices; the region type of the reference region is 3. It should be noted that a correspondence between region type and type identifier is established beforehand. For example, when the region type of the reference region is a lake, the type identifier of the lake is set to 3, i.e. Figure 6 The reference area is classified as a lake (region type 3). The lowest point of the reference area on the map has a y-coordinate of 1560.0000; the highest point of the reference area on the map has a y-coordinate of 1640.0000; the region identifier of the reference area is 1184624538; the first vertex of the reference area has x, y, and z coordinates relative to the map as x1, y1, and z1.
[0059] During the navigation mesh generation process, several baking parameters need to be pre-set. The parameter types and values of the baking parameters can be set according to the scene involved on the map or based on human experience. This application does not restrict the parameter types or values of each baking parameter; they can be customized according to actual needs. For example, baking parameters include at least one of the following: Agent Radius, Cell Size, Cell Height, Maximum Walkable Climb Angle, or Maximum Walkable Height. The use of baking parameters will be introduced in the following description of the navigation mesh generation process.
[0060] As an optional implementation, the method further includes: voxelizing the map without a reference area to obtain at least one initial voxel corresponding to the map, and constructing longitudinal height field data based on the at least one initial voxel.
[0061] After importing a complete map into Navmesh, the map without reference areas is voxelized based on the cell side lengths and cell heights specified in the pre-set baking parameters. This transforms the map into a 3D stereo map composed of at least one initial voxel. An initial voxel is a block of size in 3D space. It's important to note that each initial voxel defines either a solid region (representing space with obstacles) or an open region (representing space without any obstacles). For solid regions, vertically continuous initial voxels are merged to obtain the span of a single initial voxel, thus generating a vertical height field. It's crucial to understand that information processing during height field data construction is based on tiles (cells). Information between each tile is relatively independent. By identifying the region corresponding to a tile, a vertical span height field is established.
[0062] Connected spans are grouped into regions. Neighbors are added to each region based on the region IDs of the spans within that region. Simultaneously, the linked list of spans allows searching for other layers at the same xz coordinate. All interconnected regions are identified as sharing the same layer identifier. When regions are interconnected based on adjacency, different layers cannot belong to the same region, and different neighboring layers cannot enter the same region. This transforms the 3D scene into different levels of 2D scenes. Flattened height field data is saved, and then compressed to form compressed height field data.
[0063] After the map is voxelized, each initial voxel represents a location on the map. Multiple reference regions can be combined with the map by configuring the matching information of the reference region for each initial voxel.
[0064] As an optional implementation, generating a navigation grid for a map based on multiple reference regions includes: obtaining matching information for at least one target voxel corresponding to the map, wherein the matching information for any target voxel is used to indicate the matching status of any target voxel with multiple reference regions, and at least one target voxel is obtained by voxelizing the map; generating a navigation polygon based on the matching information for at least one target voxel, wherein the navigation polygon is used to represent the region outline of walkable areas on the map; and generating a navigation grid for the map based on the navigation polygon.
[0065] When generating the navigation mesh, navigation polygons are first generated based on multiple reference regions, and then the navigation mesh is generated under the constraints of the navigation polygons. This avoids the phenomenon that a single navigation mesh spans multiple navigation polygons and improves the generation quality of the navigation mesh.
[0066] The methods for determining the target voxel include, but are not limited to, the following two.
[0067] Method 1: Directly use the initial voxel as the target voxel. For the initial voxel, please refer to the relevant introduction on the map voxelization process above, which will not be repeated here.
[0068] Method 2: Voxelize the map to obtain at least one initial voxel corresponding to the map; based on the second passability condition, select a passable second voxel from the at least one initial voxel and use the second voxel as at least one target voxel.
[0069] Based on the passability criteria, passable voxels were selected as target voxels, which reduced the number of target voxels for which matching information needed to be obtained, reduced the computational load for obtaining matching information, improved the efficiency of obtaining matching information, and thus improved the efficiency of generating navigation mesh.
[0070] The second passability condition is a condition used to select passable voxels from the initial voxels. A passable voxel refers to a voxel that allows the pathfinding entity to pass through. The second passability condition can be set in several ways, including but not limited to pre-setting it based on human experience; or setting it based on historical selection methods; or determining the second passability condition corresponding to the current initial voxel based on the correspondence between the number of initial voxels and the conditions. For example, the second passability condition can be a condition set based on the baking parameters described above for selecting passable voxels.
[0071] The number of second voxels can be one or more. This application does not limit the number of second voxels, as long as there is at least one.
[0072] For example, taking the second passability condition as a condition for filtering passable voxels based on the baking parameters set above, the determination of the second voxel includes, but is not limited to: filtering the second voxel from at least one initial voxel according to the maximum angle of the walkable ramp and the maximum climbable height in the baking parameters; or, filtering at least one second voxel and at least one impassable voxel from at least one initial voxel according to the maximum angle of the walkable ramp and the maximum climbable height in the baking parameters, filtering out reference passable voxels that can be climbed through other passable areas from at least one impassable voxel, and also using the filtered reference passable voxels as second voxels. For example, the impassable voxel corresponding to the vertical surface of the stair step can be climbed by climbing the stairs, so the impassable voxel is marked as the second voxel.
[0073] Matching information refers to information about the matching status of any target voxel with multiple reference regions. The methods for obtaining matching information include, but are not limited to, the following two.
[0074] Method 1: Real-time acquisition of any target voxel and multiple reference regions to obtain matching information.
[0075] Method 2: The matching information of any target voxel is read from the matching information record field configured for any target voxel. The matching information record field is filled based on the matching situation of any target voxel with multiple reference regions.
[0076] Each target voxel is configured with a matching information record field, so the matching information of any target voxel can be directly read from the matching information record field, which improves the efficiency of obtaining the matching information of any target voxel and thus improves the efficiency of generating the navigation mesh.
[0077] As an optional implementation, a default field for recording matching information is pre-configured for at least one target voxel. For any target voxel, the default field is filled based on the matching situation of the target voxel with multiple reference regions to obtain the matching information recording field corresponding to the target voxel.
[0078] Matching scenarios include, but are not limited to: Scenario 1: No target voxel matches any of the multiple reference regions. Scenario 2: Any target voxel matches one of the multiple reference regions. Scenario 3: Any target voxel matches at least two of the multiple reference regions.
[0079] The method for filling the default field to obtain the matching information record field varies depending on the different matching scenarios described above. For example, when the matching scenario is scenario one, there is no need to fill the default field; or, zeros are filled into the default field to obtain the matching information record field. When the matching scenario is scenario two, the relevant information of one matched reference region is filled into the default field to obtain the matching information record field. When the matching scenario is scenario three, the relevant information of at least two matched reference regions is filled into the default field respectively to obtain the matching information record field.
[0080] The content included in the matching information is not limited in this application. As an optional implementation, the matching information of any target voxel includes first information, which indicates the region type of the reference region in which the target voxel is matched in multiple reference regions.
[0081] The region type refers to the type of reference region that any target voxel matches among multiple reference regions. The first piece of information in the matching data reveals which region types of reference regions any given target voxel matches.
[0082] The matching information includes first information for indicating the region type. Based on the matching information, the region type of the reference region matched by any target voxel can be accurately determined, thereby improving the accuracy of the matching information and thus improving the accuracy of the navigation mesh generated based on the matching information of at least one target voxel.
[0083] When the matching information is obtained through the above method two, as an optional implementation method, the matching information recording field includes a region type recording field, and the default field includes a default type field. The region type recording field is obtained by filling the default type field with the region type of the reference region matched by any target voxel in multiple reference regions.
[0084] The default type field can be set in ways including, but not limited to, using the number of flag bits in the default type field to indicate the maximum number of supported region types, with each flag bit representing one region type. This application does not restrict the way the default type field is set, as long as it supports recording region types for multiple reference regions. It should be noted that the number of flag bits corresponding to the default type field can be the same as the number of flag bits corresponding to the default field, or the number of flag bits corresponding to the default type field can be less than the number of flag bits corresponding to the default field.
[0085] When the number of flags corresponding to the default type field is less than the number of flags corresponding to the default field, the default type field is used to record a portion of the matching information. The configured default type field records the region type of the reference region matched by the target voxel, thus enabling the target voxel to carry the region type information of its matched reference region. The default type field includes, but is not limited to, a region type identifier. Based on a pre-set correspondence between region types and identifiers, when recording a region type through the default type field, the corresponding region type identifier is also recorded.
[0086] The process of filling in the default type field will be further explained in light of the three different matching scenarios mentioned above.
[0087] When the matching situation is Case 1 above, since the target voxel does not match the reference region, the default type field is filled with nothing. It should be noted that filling the default type field with nothing can be done in ways including, but not limited to, filling each region type corresponding to a flag bit with 0 when the default type field includes flags representing several region types. When the matching situation is Case 2 above, the region type corresponding to the reference region matched by the target voxel is filled into the target flag bit in the default type field. It should be noted that this target flag bit is the type flag bit in the default type field that indicates the region type corresponding to the matched reference region.
[0088] When the matching situation is as described in situation three above, if the target voxel matches at least two reference regions of completely different region types, the region types of the at least two reference regions are recorded in the flags corresponding to the default type field. If the target voxel matches at least two reference regions of the same region type, the region types of the at least two reference regions are recorded in the flags corresponding to the default type field. Then, the information recording the same region type is processed by the reference rules so that the information filled in the flags corresponding to the same region type in the default type field can clearly show that the target voxel has matched at least two reference regions of that region type.
[0089] As an optional implementation, the reference rules include, but are not limited to, performing a bitwise AND operation on information of the same region type. For example, when any target voxel matches two first region types, in the default type field, the flag bit corresponding to the first region type is first filled with 'a', indicating that the target voxel matches a reference region of one first region type. Then, the flag bit corresponding to the first region type is filled with 'b' again, indicating that the target voxel matches a reference region of a second first region type. Finally, a bitwise AND operation is performed between the first filled 'a' and the second filled 'b'.
[0090] It should be noted that the reference rules in this application are not limited to bitwise AND operations. The reference rules also include adding the matching counts of the flag bits corresponding to the same region type. For example, when any target voxel matches two first region types, the flag bit corresponding to the first region type in the default type field is first filled with 1, indicating that the target voxel matches a reference region of one first region type. Then, the flag bit corresponding to the first region type is filled with 1 again, indicating that the target voxel matches a reference region of a second first region type. Finally, the counts of the first and second fills are added together to get 2. That is, by filling the flag bit corresponding to the same region type in the default type field with 2, it can be determined that the number of reference regions belonging to the same region type matched by the target voxel is 2.
[0091] For example, see Figure 7 When the default field is set to 32 bits, the default type field is represented by 28 flag bits in part A. Each bit in A represents a region type. When recording the region type through part A, the region type identifier is recorded in the corresponding region type flag bit.
[0092] As an optional implementation, the matching information of any target voxel includes second information, which indicates the number of reference regions that the target voxel matches in multiple reference regions.
[0093] The number of reference regions matched across multiple reference regions is the total number of reference regions matched by any given target voxel across multiple reference regions. The number of reference regions matched by any given target voxel can be determined through the second information in the matching information.
[0094] The matching information includes second information indicating the number of reference regions that match among multiple reference regions. Based on the matching information, the number of reference regions that match any target voxel can be accurately determined, thereby improving the accuracy of the matching information and thus improving the accuracy of the navigation mesh generated based on the matching information of at least one target voxel.
[0095] The default fields also include a default count field, and the overlap count record field is obtained by filling the default count field with the number of reference regions matched by any target voxel in multiple reference regions.
[0096] A default count field is formed by recording the number of reference regions matched by any target voxel in multiple reference regions. This allows the reader to obtain information about the number of overlapping regions in the reference regions matched by any target voxel when the default count field is read. The default count field can be set in ways including, but not limited to, pre-setting a reference count flag in the default field to record the number of reference regions matched by any target voxel in multiple reference regions.
[0097] For example, see the above. Figure 7 When the default field is set to 32 bits, the number of reference regions matched by any target voxel in multiple reference regions is counted by the four flag bits in Part B.
[0098] It should be noted that the matching information may include only the first information mentioned above; or, the matching information may include only the second information mentioned above; or, the matching information may include both the first and second information mentioned above. This application does not limit the specific content of the matching information.
[0099] Accordingly, the default field may include only the default type field, or only the default count field; or the default field may include both the default type field and the default count field.
[0100] After determining the matching information of any target voxel configuration, a navigation polygon is generated based on the matching information of at least one target voxel.
[0101] A navigation polygon is a polygon formed by dividing a map with multiple reference areas into passable and impassable areas, and is used to represent the outline of the passable area.
[0102] As an optional implementation, generating a navigation polygon based on matching information of at least one target voxel includes: selecting a first passable voxel from at least one target voxel based on a first passability condition and matching information of at least one target voxel; and generating a navigation polygon based on the first voxel.
[0103] Before generating the navigation polygon, the first passable voxel is selected from at least one target voxel by comprehensively considering the first passable condition and the matching information of at least one target voxel. The information referenced in selecting the first passable voxel is more comprehensive, which helps to improve the reliability of the selected first passable voxel, improve the reliability of the navigation polygon, and thus make the final generated navigation mesh more accurate.
[0104] The first passability condition is a condition used to screen passable voxels among the target voxels. The first passability condition can be exactly the same as the second passability condition described above, or it can be completely different, or it can be partially the same; this embodiment of the application does not limit this. For example, the first passability condition is a condition based on the baking parameters set above.
[0105] The filtering methods based on the first passability condition and matching information of at least one target voxel include, but are not limited to, the following methods.
[0106] Optionally, at least one target voxel is first filtered based on a first traversability condition. Then, the region type of the matching reference region is determined based on the matching information of the at least one target voxel. Filtering is then performed based on the traversable region type and the inaccessible region type to finally obtain the first voxel. It should be noted that the traversable and inaccessible region types are not limited in this application. For example, when the first traversability condition is based on the maximum angle of the walkable slope and the maximum climbable height in the baking parameters, and the inaccessible region type is a lake, voxels with angles less than or equal to the maximum angle of the walkable slope and heights less than or equal to the maximum climbable height are filtered from the at least one target voxel to obtain traversable reference voxels. Then, inaccessible voxels with the region type of lake are filtered from the at least one reference voxel. After removing inaccessible voxels from the at least one reference voxel, the remaining one is the final first voxel.
[0107] Optionally, the region type of the matching reference area is first determined based on the matching information of at least one target voxel. Then, filtering is performed based on the traversable and inaccessible region types, followed by further filtering based on a first traversability condition. It should be noted that the traversable and inaccessible region types are not limited in this application. For example, the first traversability condition is based on the maximum angle of the walkable slope and the maximum climbable height in the baking parameters. When the inaccessible region type is a lake, at least one traversable reference voxel excluding the lake type is first filtered from the at least one target voxel. Then, among the at least one traversable reference voxel, at least one voxel with an angle less than or equal to the maximum angle of the walkable slope and a height less than or equal to the maximum climbable height is determined, and this at least one voxel is identified as the final first voxel. This application does not limit the specific method of filtering based on the first traversability condition and the matching information of at least one target voxel.
[0108] It should be noted that, after determining the first voxel and at least one impassable voxel as described above, as an optional implementation, based on the radius of the pathfinding entity, the region whose boundary of the traversable area corresponding to at least one first voxel is smaller than the radius of the pathfinding entity is converted into an impassable region. That is, the first voxel corresponding to the region smaller than the radius of the pathfinding entity is converted and marked as an impassable voxel, thereby achieving a more accurate division of the target voxel.
[0109] After the first voxel screening is completed, as an optional implementation, a navigation polygon is generated based on at least one first voxel, including: generating a passable region based on the first voxel; determining the region boundary lines between different region types within the passable region; and generating a navigation polygon based on the region boundary lines.
[0110] The navigation polygons are generated based on the boundary lines of the passable areas, which can more accurately distinguish the passable areas of different area types, thus making the final generated navigation grid more accurate.
[0111] Two adjacent first voxels can be connected to form a passable region. Since each first voxel is configured with matching information, different region types can be identified through at least one first voxel. Therefore, it is necessary to divide the passable regions into different types of passable regions using boundary lines. The methods for determining region boundary lines include, but are not limited to, watershed methods, monotonic methods, or hierarchical methods.
[0112] For example, when forming the region boundary line to obtain the passable area using the watershed algorithm, a distance domain is first created. The distance from each span composed of target voxels to the region boundary is calculated. The farther the distance, the closer it is to the center of the region. Then, the boxblur function is used to perform a blurring process, that is, modifying the actual area of the span to the average of the areas of the spans in the surrounding nine-square grid, so that the distance values of the spans are relatively smooth. Then, the passable area is divided according to the distance domain. Since the distance domain has recorded the distance from each span to the region boundary, the farther the distance, the closer it is to the center of the region. So, the spans are sorted by distance (here, a radix sort is used, putting spans with the same distance into the same container). Then, they are processed in batches from the largest to the smallest distance (which can be seen as an expansion and filling process starting from the center of each region). For the spans in the current batch, it is first checked whether they can be added to an existing region (adjacent to a marked span). For spans that cannot be added to an existing region, a flood filling is performed, the region boundary line is formed, the region is segmented, and the navigation polygon is generated.
[0113] As another optional implementation, the navigation polygon can be generated based on the matching information of at least one target voxel by: selecting a passable third voxel from at least one target voxel based on the matching information of at least one target voxel; and generating a navigation polygon based on the third voxel.
[0114] The methods for filtering a third voxel based on the matching information of at least one target voxel include, but are not limited to: determining the region type of the reference region for matching at least one target voxel based on the matching information of at least one target voxel, filtering based on the accessible region type and the inaccessible region type, and finally filtering the first voxel from at least one target voxel. It should be noted that this application does not limit the accessible region type and the inaccessible region type.
[0115] For example, when the inaccessible region type is a lake, inaccessible voxels matching the lake type are selected from at least one target voxel, and the remaining voxel after discarding the inaccessible voxels is the third voxel.
[0116] For example, the principle of generating navigation polygons based on third voxels is the same as that of generating navigation polygons based on first voxels, and will not be repeated here.
[0117] As an optional implementation, generating a navigation grid for a map based on navigation polygons includes: dividing the navigation polygons into at least two adjacent convex polygons; and generating a navigation grid based on the at least two adjacent convex polygons.
[0118] After obtaining the navigation polygon, for irregular navigation polygon outlines, pathfinding cannot be directly performed on it. Instead, the navigation polygon needs to be divided into at least two convex polygons, because any two points inside a convex polygon are always reachable by a straight line, while this is not the case for concave polygons. The region represented by the navigation polygon outline needs to be divided into multiple sets of adjacent convex polygons (i.e., the final navigation mesh).
[0119] First, the outline of the navigation polygon is triangulated. Triangulation methods include, but are not limited to, ear clipping algorithms. A polygon ear is a convex triangle that does not contain other vertices. The diagonal of the polygon is defined as the line connecting three consecutive vertices v1, v2, and v3. The process of triangulating the outline of the navigation polygon is as follows: determine all polygon ears of the current navigation polygon, select the polygon ear with the shortest diagonal, and delete the corresponding ear tip vertex. The N-sided polygon (navigation polygon) then becomes an N-1-sided polygon.
[0120] It should be noted that during the process of segmenting the navigation polygon into at least two adjacent convex polygons, since the navigation polygon is generated based on at least one voxel (the first voxel or the third voxel), and at least one voxel (the first voxel or the third voxel) is selected from at least one target voxel, each polygon in the navigation polygon carries the corresponding voxel matching information.
[0121] The navigation grid is generated based on convex polygons. Since convex polygons are conducive to more precise control of the pathfinding method, the navigation grid generated based on convex polygons can perform pathfinding more accurately, thereby improving the user experience of the navigation grid.
[0122] For example, after triangulation, a set of convex polygons is obtained. However, the triangular meshes in the convex polygon set are too fragmented, resulting in too many search nodes and slow pathfinding speed. It is necessary to merge the triangular meshes into detailed triangular meshes (poly) (the navigation mesh of the convex polygons) to avoid excessive vertical height differences in the regions corresponding to the poly and reduce clipping problems in the map. Triangular mesh merging methods include, but are not limited to: enumerating all pairs of polygons formed by two adjacent convex polygons, determining whether they can be merged, and merging the pair with the longest common edge, repeating this process until no further merging is possible to obtain a new convex polygon; or, sampling the height of the triangular meshes, and re-cutting the triangular meshes with excessive height differences into even smaller triangular meshes, i.e., the final navigation mesh.
[0123] It should be noted that since each polygon in the navigation polygon carries the matching information of the corresponding voxel, after dividing the navigation polygon into at least two adjacent convex polygons and merging the triangular meshes after triangulation to form the final triangular mesh, each final triangular mesh carries the matching information of the corresponding voxel.
[0124] As an optional implementation, the first grid is bound to index information of at least two reference regions. The index information of any reference region is used to index the routing information of any reference region. The data volume of the index information of any reference region is less than the data volume of the routing information corresponding to any reference region.
[0125] By binding a small amount of index information to the first grid, the pathfinding information of the reference area can be bound, saving storage space.
[0126] The index information includes, but is not limited to, the area identifier corresponding to the reference area. The index information can be set manually based on experience; or, determined based on the correspondence between the reference area and the index; or, determined based on historical map data. This application does not restrict the content or method of setting the index information; it allows for customization based on actual needs.
[0127] Since the triangulated triangular mesh (i.e., poly) carries the matching information of the corresponding voxel, in order to ensure the accuracy of the index information bound to the poly, the method further includes: for the first mesh, determining the first region type corresponding to the first mesh, wherein the first region type is the matching type in the first matching information of the voxel corresponding to the first mesh; among multiple reference regions, determining a target reference region belonging to the first region type; when the region contour of the target reference region coincides with the contour of the first mesh (i.e., the first mesh is located in the target reference region), binding the index information of the target reference region to the first mesh. When the poly is located in an overlapping region, and there are multiple first region types, since the matching information between any target voxel and multiple reference regions was previously recorded using the default field, any target voxel located in the overlapping region records the first region type corresponding to at least two matched reference regions and the number of matched reference regions in the multiple reference regions. Therefore, in the overlapping region, the edge of the detailed triangular mesh poly generated based on any target voxel almost coincides with the boundary of at least two overlapping reference regions, and the pathfinding information of at least two overlapping reference regions is bound to the first mesh.
[0128] As an optional implementation, the first grid is located in the overlapping area formed by at least two of the multiple reference areas, including: the center point of the first grid is located in the overlapping area.
[0129] Using the fact that the center point of the first grid is located in the overlapping region as a condition for determining whether the first grid is located in the overlapping region makes the process of determining whether the first grid is located in the overlapping region more accurate and reduces errors.
[0130] The methods for determining whether the first grid is located in the overlapping region include, but are not limited to, determining whether the center point of the first grid is located in the overlapping region; or, determining whether the reference area of the first grid is located in the overlapping region; or, determining whether the reference boundary line of the first grid is located in the overlapping region. This application does not limit the method for determining whether the first grid is located in the overlapping region. The determination method can be customized according to actual needs. During the determination process, the determination can be carried out according to the customized determination method.
[0131] The amount of data in the index information of any reference area is less than the amount of data in the pathfinding information of any reference area. This can be understood as an example, setting the index information of any reference area to an index number starting from 0, with each index number corresponding to any reference area. By binding the index information to this index number, storage space is saved and the size of the baked data during the generation of the navigation mesh is reduced.
[0132] After the navigation grid is generated, as an optional implementation method, the method further includes: determining the pathfinding method corresponding to the first grid based on the pathfinding information corresponding to at least two reference areas, under the condition that the first grid satisfies the pathfinding requirement.
[0133] During the pathfinding process based on the generated navigation grid, when the first grid meets the pathfinding conditions, the pathfinding method is determined based on the pathfinding information of at least two reference areas bound to the first grid. The information on which the pathfinding method is determined is more comprehensive, which helps to improve the accuracy of the determined pathfinding method and thus improve the accuracy of pathfinding.
[0134] Navigation information is information set for a reference area to indicate the navigation method. The methods for setting navigation information include, but are not limited to, setting it based on human experience; determining the corresponding navigation method for a reference area based on the correspondence between reference areas and navigation methods; or determining the navigation method within the reference area based on the navigation subject's historical navigation data. The content of the navigation information includes, but is not limited to, the movement speed of the navigation subject, the start, stop, acceleration, and deceleration of the navigation subject, the turning speed of the navigation subject, and the climbing type of the navigation subject.
[0135] The methods for determining whether the first grid satisfies the pathfinding conditions include, but are not limited to: the path sought by the pathfinding subject includes the first grid; or, the pathfinding subject is located in the first grid during the pathfinding process. This application does not limit the methods for determining whether the first grid satisfies the pathfinding conditions.
[0136] As an optional implementation, when multiple reference areas are set on the map, routing information corresponding to any one of the multiple reference areas can be set.
[0137] When setting a reference area, simultaneously set the pathfinding information included under the corresponding area type to determine whether the AI can traverse that area type, thereby enriching the AI's pathfinding performance. See also Figure 8A raft area 802 is superimposed on a water area 801. The virtual object 803 is located in the overlapping area of the water area 801 and the raft area. The pathfinding method of the virtual object 803 is determined based on the pathfinding information pre-configured for the raft area 802 and the pathfinding information pre-configured for the water area 801. For example, if the pathfinding method pre-configured for the raft area 802 indicates switching to long-range archery attack, and the pathfinding method pre-configured for the water area 801 indicates pathfinding according to the pathfinding information of the superimposed passable area, then the current pathfinding method of the virtual object 803 is long-range archery attack.
[0138] See Figure 9 When a virtual object determines a station location in plain area 901, the pathfinding method for the station location in the plain area is direct attack. When plain area 901 overlaps with grass area 902, and the station location is located in the overlapping area of plain area 901 and grass area 902, the pathfinding method for the grass area is stealth ambush. Therefore, the interactive object controlling the virtual object can determine the station location according to the pathfinding method required by the actual needs.
[0139] See below. Figure 10 In related technologies, when two reference areas overlap, when the first reference area 1001 is first set on the map, the overlapping area 1003 is a part of the first reference area 1001; when the second reference area 1002 is set on the map, the overlapping area 1003 automatically becomes a part of the second reference area 1002, and at this time the first reference area 1001 is converted into a shaded area 1004, that is, at this time the overlapping area 1003 does not belong to the first reference area 1001.
[0140] For example, the pre-set combat area A of the virtual character overlaps with the grass area B. The pathfinding method corresponding to combat area A is pathfinding at a first movement speed, and the pathfinding method corresponding to grass area B is pathfinding at a second movement speed; the second movement speed is less than the first movement speed.
[0141] When combat area A is the second reference area 1002 and the grass area is the first reference area 1001, the overlapping area 1003 in the relevant technology is automatically converted to the second reference area 1002 (i.e., combat area A). When the virtual character is in the overlapping area 1003, it can only interact at the first movement speed. However, since the virtual character is actually not only in combat area A but also in grass area B, and the movement speed in grass area B should be less than the first movement speed, it is difficult to provide accurate pathfinding guidance for the virtual character according to the solution in the relevant technology.
[0142] According to the method provided in the embodiments of this application, when the virtual character is located in the overlapping area of the combat area A and the grass area B, a suitable movement speed (i.e., a smaller second movement speed) will be determined by comprehensively considering the first movement speed and the second movement speed to control the virtual character to find a path, thereby providing more accurate pathfinding guidance for the virtual character.
[0143] See Figure 11 According to the navigation mesh generation method provided in this application, the overlapping area of the first reference area 1101 and the second reference area 1102 is the overlapping area 1103. When the boundary of the first reference area 1101 is determined by the watershed algorithm, the overlapping area 1103 is a part of the first reference area 1101; when the boundary of the second reference area 1102 is determined by the watershed algorithm, the overlapping area 1103 is a part of the second reference area 1102.
[0144] In this embodiment, multiple overlapping reference areas are allowed to be set on the map. In the final generated navigation grid, the first grid located in the overlapping area is bound to the pathfinding information corresponding to at least two reference areas. The information bound to the first grid is more comprehensive and can express the information of the area more comprehensively and accurately. The generation quality of the navigation grid is high, which helps to improve the accuracy of the pathfinding subject when navigating based on the generated navigation grid.
[0145] The following section introduces the overall process of a method for generating a navigation mesh.
[0146] Step 1: Obtain multiple reference areas for the map settings. These reference areas may overlap.
[0147] It should be noted that at least one of the reference areas has a custom shape, which is different from the fixed shape corresponding to the map.
[0148] Step 2: Voxelize the map to obtain at least one initial voxel corresponding to the map.
[0149] Step 3: Based on the second passability condition, select a passable second voxel from at least one initial voxel, and use the second voxel as at least one target voxel.
[0150] Step 4: Based on the first passability condition and the matching information of at least one target voxel, select the first passable voxel from at least one target voxel.
[0151] It should be noted that the matching information of any target voxel is used to indicate the matching status of any target voxel with multiple reference regions, and at least one target voxel is obtained through voxelization map.
[0152] Matching information for any target voxel is read from the matching information record field configured for any target voxel. The matching information record field is filled based on the matching situation of any target voxel with multiple reference regions.
[0153] The matching information for any target voxel includes first information, which indicates the region type of the reference region in which the target voxel is matched among multiple reference regions.
[0154] The matching information for any target voxel includes second information, which indicates the number of reference regions that any target voxel matches in multiple reference regions.
[0155] Step 5: Generate a passable region based on the first voxel.
[0156] Step 6: Determine the boundary lines between different area types within the passable area.
[0157] Step 7: Generate navigation polygons based on region boundaries.
[0158] It should be noted that navigation polygons are used to represent the outline of traversable areas on a map.
[0159] Step 8: Divide the navigation polygon into at least two adjacent convex polygons.
[0160] Step 9: Generate a navigation mesh based on at least two adjacent convex polygons.
[0161] The navigation grid includes a first grid, the center point of which is located in the overlapping region, and the first grid is bound to pathfinding information corresponding to at least two reference regions.
[0162] The first grid is bound to index information of at least two reference regions. The index information of any reference region is used to index the routing information corresponding to any reference region. The amount of data in the index information of any reference region is less than the amount of data in the routing information corresponding to any reference region.
[0163] It should be noted that after the navigation grid is generated, if the first grid meets the pathfinding conditions, the pathfinding method corresponding to the first grid is determined based on the pathfinding information corresponding to at least two reference areas.
[0164] See Figure 12 This is an overall flowchart of a method for generating navigation meshes.
[0165] Step 1: Import the map and basic information of multiple reference areas, and construct the baking parameters for the navigation grid.
[0166] Step 2: Voxelize the map to obtain at least one initial voxel corresponding to the map, and construct longitudinal height field data based on at least one initial voxel.
[0167] Step 3: Based on the first passability condition and the matching information of at least one target voxel, select the first passable voxel from at least one target voxel; generate a navigation polygon based on the first voxel.
[0168] Step 4: Divide the navigation polygon into at least two adjacent convex polygons; generate the navigation mesh based on at least two adjacent convex polygons.
[0169] Step 5: The first grid is bound to the index information of at least two reference regions; the index information of any reference region is used to index the pathfinding information corresponding to any reference region.
[0170] In this embodiment, multiple overlapping reference areas are allowed to be set on the map. In the final generated navigation grid, the first grid is bound to the pathfinding information corresponding to at least two reference areas. The information bound to the first grid is more comprehensive and can express the information of the area more comprehensively and accurately. The generation quality of the navigation grid is high, which helps to improve the accuracy of the pathfinding subject when navigating based on the generated navigation grid.
[0171] See Figure 13 This application provides a navigation mesh generation apparatus, which includes: The acquisition module 1301 is used to acquire multiple reference areas set for the map, and the multiple reference areas overlap. The generation module 1302 is used to generate a navigation grid for a map based on multiple reference areas. The navigation grid includes a first grid, which is located in an overlapping area formed by at least two of the multiple reference areas. The first grid is bound to the pathfinding information corresponding to at least two reference areas respectively.
[0172] In one possible implementation, the generation module 1302 is used to obtain matching information of at least one target voxel corresponding to the map, wherein the matching information of any target voxel is used to indicate the matching status of any target voxel with multiple reference areas, and at least one target voxel is obtained by voxelizing the map; based on the matching information of at least one target voxel, a navigation polygon is generated, wherein the navigation polygon is used to represent the area outline of the traversable area on the map; and based on the navigation polygon, a navigation grid of the map is generated.
[0173] In one possible implementation, the generation module 1302 is used to filter out a passable first voxel from at least one target voxel based on a first passability condition and matching information of at least one target voxel; and generate a navigation polygon based on the first voxel.
[0174] In one possible implementation, the generation module 1302 is used to generate a passable region based on a first voxel; determine the region boundaries between different region types within the passable region; and generate a navigation polygon based on the region boundaries.
[0175] In one possible implementation, the acquisition module 1301 is further used to voxelize the map and obtain at least one initial voxel corresponding to the map; based on the second passability condition, a passable second voxel is selected from the at least one initial voxel and the second voxel is used as at least one target voxel.
[0176] In one possible implementation, the matching information of any target voxel is read from the matching information record field configured for any target voxel, and the matching information record field is filled based on the matching situation of any target voxel with multiple reference regions.
[0177] In one possible implementation, the matching information for any target voxel includes first information indicating the region type of the reference region in which the target voxel is matched among multiple reference regions.
[0178] In one possible implementation, the matching information of any target voxel includes second information indicating the number of reference regions that the target voxel matches in multiple reference regions.
[0179] In one possible implementation, the generation module 1302 is used to divide the navigation polygon into at least two adjacent convex polygons; and to generate a navigation mesh based on the at least two adjacent convex polygons.
[0180] In one possible implementation, the first grid is bound to index information of at least two reference regions. The index information of any reference region is used to index the routing information corresponding to any reference region. The amount of data in the index information of any reference region is less than the amount of data in the routing information corresponding to any reference region.
[0181] In one possible implementation, the first grid is located in an overlapping region formed by at least two of the multiple reference regions, including: the center point of the first grid is located in the overlapping region.
[0182] In one possible implementation, at least one of the multiple reference regions has a custom shape, which is different from the fixed shape corresponding to the map.
[0183] In one possible implementation, the generation module 1302 is further configured to determine the pathfinding method corresponding to the first grid based on the pathfinding information corresponding to at least two reference regions, provided that the first grid satisfies the pathfinding conditions.
[0184] It should be understood that the above-described apparatus is only illustrated by the division of the functional modules described above when implementing its functions. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0185] In an exemplary embodiment, a computer device is also provided, comprising a processor and a memory storing at least one computer program. The at least one computer program is loaded and executed by one or more processors to enable the computer device to implement any of the above-described methods for generating navigation meshes. The computer device can be a server or a terminal device. The structures of the server and the terminal device will be described below.
[0186] Figure 14 This is a schematic diagram of a server structure provided in an embodiment of this application. The server can vary significantly due to differences in configuration or performance. It may include one or more Central Processing Units (CPUs) 1401 and one or more memories 1402. The one or more memories 1402 store at least one computer program, which is loaded and executed by the one or more processors 1401 to enable the server to implement the navigation mesh generation method provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0187] Figure 15 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. The terminal device can be: a PC, mobile phone, smartphone, PDA, wearable device, PPC, tablet computer, smart car system, smart TV, smart speaker, smart voice interaction device, smart home appliance, in-vehicle terminal device, VR device, AR device. The terminal device may also be referred to as a user device, portable terminal device, laptop terminal device, desktop terminal device, or other names.
[0188] Typically, a terminal device includes a processor 1501 and a memory 1502.
[0189] Processor 1501 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1501 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1501 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1501 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 1501 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0190] The memory 1502 may include one or more computer-readable storage media, which may be non-transitory. The memory 1502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1502 is used to store at least one instruction, which is executed by the processor 1501 to cause the terminal device to implement the navigation mesh generation method provided in the method embodiments of this application.
[0191] In some embodiments, the terminal device may also optionally include: a peripheral device interface 1503 and at least one peripheral device. The processor 1501, memory 1502, and peripheral device interface 1503 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1503 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of: a radio frequency circuit 1504, a display screen 1505, a camera assembly 1506, an audio circuit 1507, and a power supply 1508.
[0192] Peripheral device interface 1503 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1501 and memory 1502. In some embodiments, processor 1501, memory 1502 and peripheral device interface 1503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1501, memory 1502 and peripheral device interface 1503 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0193] The radio frequency (RF) circuit 1504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1504 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1504 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1504 can communicate with other terminal devices through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1504 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0194] Display screen 1505 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1505 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1501 for processing. In this case, display screen 1505 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, display screen 1505 can be a single screen, disposed on the front panel of the terminal device; in other embodiments, display screen 1505 can be at least two screens, disposed on different surfaces of the terminal device or in a folded design; in other embodiments, display screen 1505 can be a flexible display screen, disposed on a curved or folded surface of the terminal device. Furthermore, display screen 1505 can be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 1505 can be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0195] The camera assembly 1506 is used to acquire images or videos. Optionally, the camera assembly 1506 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal device, and the rear-facing camera is located on the back of the terminal device. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting and VR shooting functions by fusion of the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 1506 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.
[0196] The audio circuit 1507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1501 for processing, or input to the radio frequency circuit 1504 to achieve voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned in a different part of the terminal device. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1501 or the radio frequency circuit 1504 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1507 may also include a headphone jack.
[0197] Power supply 1508 is used to power various components in the terminal device. Power supply 1508 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1508 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0198] In some embodiments, the terminal device further includes one or more sensors 1509. The one or more sensors 1509 include, but are not limited to: an acceleration sensor 1510, a gyroscope sensor 1511, a pressure sensor 1512, an optical sensor 1513, and a proximity sensor 1514.
[0199] Accelerometer 1510 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by the terminal device. For example, accelerometer 1510 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 1501 can control display screen 1505 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 1510. Accelerometer 1510 can also be used for games or for acquiring user motion data.
[0200] The gyroscope sensor 1511 can detect the orientation and rotation angle of the terminal device. The gyroscope sensor 1511 can work in conjunction with the accelerometer sensor 1510 to collect the user's 3D movements on the terminal device. Based on the data collected by the gyroscope sensor 1511, the processor 1501 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0201] The pressure sensor 1512 can be disposed on the side bezel of the terminal device and / or the lower layer of the display screen 1505. When the pressure sensor 1512 is disposed on the side bezel of the terminal device, it can detect the user's grip signal on the terminal device, and the processor 1501 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 1512. When the pressure sensor 1512 is disposed on the lower layer of the display screen 1505, the processor 1501 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 1505. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0202] Optical sensor 1513 is used to collect ambient light intensity. In one embodiment, processor 1501 can control the display brightness of display screen 1505 based on the ambient light intensity collected by optical sensor 1513. Specifically, when the ambient light intensity is high, the display brightness of display screen 1505 is increased; when the ambient light intensity is low, the display brightness of display screen 1505 is decreased. In another embodiment, processor 1501 can also dynamically adjust the shooting parameters of camera assembly 1506 based on the ambient light intensity collected by optical sensor 1513.
[0203] The proximity sensor 1514, also known as a distance sensor, is typically installed on the front panel of a terminal device. The proximity sensor 1514 is used to detect the distance between the user and the front of the terminal device. In one embodiment, when the proximity sensor 1514 detects that the distance between the user and the front of the terminal device is gradually decreasing, the processor 1501 controls the display screen 1505 to switch from a screen-on state to a screen-off state; when the proximity sensor 1514 detects that the distance between the user and the front of the terminal device is gradually increasing, the processor 1501 controls the display screen 1505 to switch from a screen-off state to a screen-on state.
[0204] Those skilled in the art will understand that Figure 15 The structure shown does not constitute a limitation on the terminal device and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0205] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores at least one computer program that is loaded and executed by a processor of a computer device to enable the computer to implement any of the above-described methods for generating a navigation mesh.
[0206] In one possible implementation, the aforementioned computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0207] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions loaded and executed by a processor to enable a computer to implement any of the above-described methods for generating a navigation mesh.
[0208] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the multiple reference areas involved in this application were obtained with full authorization.
[0209] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0210] The above description is merely an exemplary embodiment of this application and does not limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating a navigation mesh, characterized in that, The method includes: Obtain multiple reference regions set for the map, wherein the multiple reference regions overlap; Based on the plurality of reference regions, a navigation grid for the map is generated. The navigation grid includes a first grid, which is located in an overlapping area formed by at least two of the plurality of reference regions. The first grid is bound to routing information corresponding to the at least two reference regions respectively.
2. The method according to claim 1, characterized in that, The step of generating the navigation grid of the map based on the multiple reference areas includes: Obtain matching information for at least one target voxel corresponding to the map. The matching information for any target voxel is used to indicate the matching status of the target voxel with the plurality of reference regions. The at least one target voxel is obtained by voxelizing the map. Based on the matching information of the at least one target voxel, a navigation polygon is generated, which is used to represent the region outline of the traversable area on the map. The navigation grid of the map is generated based on the navigation polygon.
3. The method according to claim 2, characterized in that, The step of generating a navigation polygon based on the matching information of the at least one target voxel includes: Based on the first passability condition and the matching information of the at least one target voxel, a passable first voxel is selected from the at least one target voxel; The navigation polygon is generated based on the first voxel.
4. The method according to claim 3, characterized in that, The step of generating the navigation polygon based on the first voxel includes: Based on the first voxel, a passable region is generated; Determine the boundary lines between different area types within the passable area; The navigation polygon is generated based on the region boundary line.
5. The method according to any one of claims 2-4, characterized in that, The method further includes: Voxelize the map to obtain at least one initial voxel corresponding to the map; Based on the second passability condition, a passable second voxel is selected from the at least one initial voxel, and the second voxel is used as the at least one target voxel.
6. The method according to any one of claims 2-4, characterized in that, The matching information of any target voxel is read from the matching information record field configured for the target voxel, and the matching information record field is filled based on the matching situation of the target voxel with the multiple reference regions.
7. The method according to any one of claims 2-4, characterized in that, The matching information of any target voxel includes first information, which indicates the region type of the reference region in which the target voxel is matched in the plurality of reference regions.
8. The method according to any one of claims 2-4, characterized in that, The matching information of any target voxel includes second information, which indicates the number of reference regions that the target voxel matches in the plurality of reference regions.
9. The method according to any one of claims 2-4, characterized in that, The step of generating the navigation grid of the map based on the navigation polygon includes: The navigation polygon is divided into at least two adjacent convex polygons; The navigation mesh is generated based on the at least two adjacent convex polygons.
10. The method according to any one of claims 1-4, characterized in that, The first grid is bound to the index information of at least two reference regions. The index information of any reference region is used to index the pathfinding information corresponding to any reference region. The data volume of the index information of any reference region is less than the data volume of the pathfinding information corresponding to any reference region.
11. The method according to any one of claims 1-4, characterized in that, The first grid is located in the overlapping area formed by at least two of the plurality of reference areas, including: the center point of the first grid is located in the overlapping area.
12. The method according to any one of claims 1-4, characterized in that, At least one of the multiple reference regions has a custom shape, which is different from the fixed shape corresponding to the map.
13. The method according to any one of claims 1-4, characterized in that, The method further includes: If the first grid satisfies the pathfinding conditions, the pathfinding method corresponding to the first grid is determined based on the pathfinding information corresponding to the at least two reference areas.
14. A device for generating a navigation mesh, characterized in that, The device includes: The acquisition module is used to acquire multiple reference areas set for the map, wherein the multiple reference areas overlap; A generation module is used to generate a navigation grid for the map based on the plurality of reference areas. The navigation grid includes a first grid, which is located in an overlapping area formed by at least two of the plurality of reference areas. The first grid is bound to pathfinding information corresponding to the at least two reference areas respectively.
15. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to enable the computer device to implement the method for generating a navigation mesh as described in any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to enable the computer to implement the method for generating a navigation mesh as described in any one of claims 1 to 13.
17. A computer program product, characterized in that, The computer program product includes computer instructions that are loaded and executed by a processor to enable the computer to implement the method for generating a navigation mesh as described in any one of claims 1 to 13.