Virtual scene path generation method and device, computer device, and storage medium

By calculating slope and distance values ​​in the virtual scene height map, path nodes are automatically determined, solving the problem of low road planning efficiency in hilly areas in existing technologies and achieving more efficient path generation.

CN115738277BActive Publication Date: 2026-04-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, road planning in hilly areas of game scenes is inefficient, requiring manual determination of the direction of each virtual road, resulting in low production efficiency.

Method used

By obtaining the starting and ending points in the virtual scene height map, calculating the movement cost using slope and distance values, and automatically determining path nodes until the nodes coincide with the ending points, the target path is generated.

Benefits of technology

It improves the efficiency of path generation in virtual scenes, reduces human intervention, and enhances the automation and accuracy of road planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115738277B_ABST
    Figure CN115738277B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a path generation method and device for a virtual scene, computer equipment and a computer readable storage medium. According to the present application, a starting point and an ending point are selected in a virtual scene height map, the starting point is taken as a path node, the slope value between the path node and each adjacent point is determined according to the height information of the path node and each adjacent point in the virtual scene height map, the movement consumption value generated by the path node through each adjacent point to reach the ending point is determined according to the slope value and the distance value between each adjacent point and the path node and the ending point, the next path node of the path node is determined from at least one adjacent point based on the movement consumption value, the next path node is taken as a new path node, the next path node of the new path node is determined again until the next path node coincides with the ending point, and a target path is obtained. In this way, the path generation efficiency in the virtual scene can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a method, apparatus, computer device, and computer-readable storage medium for generating paths in a virtual scene. Background Technology

[0002] To make the game more realistic, the game's scenes need to closely resemble the real world, such as common road features. During the creation of the game's terrain, various roads within the scene need to be planned. Specifically, road planning must be tailored to the game's terrain, as different terrains require different road designs.

[0003] In related technologies, during the road planning process for hilly areas in game scenes, developers typically draw a route line segment on a plane and then project this line onto the hills to complete the route planning. However, this method of generating roads by manually drawing line segments requires manually determining the direction of each virtual road, resulting in low production efficiency. Summary of the Invention

[0004] This application provides a method, apparatus, computer device, and computer-readable storage medium for generating paths in virtual scenes, which can improve the efficiency of path generation in virtual scenes.

[0005] This application provides a method for generating paths in a virtual scene, including:

[0006] Obtain the virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map;

[0007] Using the starting point as the current path node of the target path, determine at least one adjacent point of the current path node in the virtual scene height map;

[0008] Based on the height information of the current path node and each adjacent point in the virtual scene height map, determine the slope value between the current path node and each adjacent point;

[0009] Based on the slope value, and the distance between each adjacent point and the current path node and the end point, the movement cost value generated by the current path node reaching the end point through each adjacent point is determined.

[0010] Based on the movement consumption value, determine the next path node of the current path node in the target path from the at least one neighboring point;

[0011] The subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point, thus obtaining the target path.

[0012] Accordingly, embodiments of this application also provide a path generation device for a virtual scene, including:

[0013] The first acquisition unit is used to acquire a virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map;

[0014] The first determining unit is used to take the starting point as the current path node of the target path and determine at least one adjacent point of the current path node in the virtual scene height map;

[0015] The second determining unit is used to determine the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map.

[0016] The third determining unit is used to determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point based on the slope value and the distance value between each adjacent point and the current path node and the end point.

[0017] The fourth determining unit is used to determine the next path node of the current path node in the target path from the at least one neighboring point based on the movement consumption value;

[0018] The fifth determining unit is used to take the subsequent path node as the new current path node, redetermine the subsequent path node of the new current path node, until the subsequent path node coincides with the end point, and obtain the target path.

[0019] Accordingly, this application also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes a path generation method for a virtual scene provided in any of the embodiments of this application.

[0020] Accordingly, embodiments of this application also provide a computer-readable storage medium storing multiple instructions adapted for loading by a processor to execute the path generation method for the virtual scene described above.

[0021] This embodiment of the application selects a start point and an end point in a virtual scene height map, using the start point as a path node. Based on the height information of the path node and each adjacent point in the virtual scene height map, it determines the slope value between the path node and each adjacent point. Based on the slope value and the distance values ​​between each adjacent point and the path node and the end point, it determines the movement cost value generated by the path node reaching the end point through each adjacent point. Based on the movement cost value, it determines the next path node from at least one adjacent point, uses this next path node as a new path node, and re-determines the next path node for the new path node, until the next path node coincides with the end point, thus obtaining the target path. This improves the efficiency of path generation in a virtual scene. Attached Figure Description

[0022] 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.

[0023] Figure 1 This is a schematic diagram of a virtual scene path generation system provided in an embodiment of this application.

[0024] Figure 2 This is a flowchart illustrating a path generation method for a virtual scene provided in an embodiment of this application.

[0025] Figure 3 This is a schematic diagram of the height map of a virtual scene provided in an embodiment of this application.

[0026] Figure 4 This is a schematic diagram of a path graphical user interface for generating virtual scenes, provided as an embodiment of this application.

[0027] Figure 5 This is a schematic diagram of another path graphical user interface for generating virtual scenes provided in an embodiment of this application.

[0028] Figure 6 This is a schematic diagram illustrating an application scenario for path generation in a virtual scene, as provided in an embodiment of this application.

[0029] Figure 7 This is a schematic diagram illustrating an application scenario for path generation in a virtual scene, as provided in an embodiment of this application.

[0030] Figure 8 This is a schematic diagram illustrating an application scenario for path generation in another virtual scene provided in this application embodiment.

[0031] Figure 9This is a schematic diagram illustrating an application scenario for path generation in another virtual scene provided in this application embodiment.

[0032] Figure 10 This is a structural block diagram of a virtual scene path generation device provided in an embodiment of this application.

[0033] Figure 11 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0034] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0035] This application provides a method, apparatus, computer-readable storage medium, and computer device for generating paths in a virtual scene. Specifically, the path generation method for a virtual scene in this application can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, touchscreen, personal computer (PC), personal digital assistant (PDA), or other terminal device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides 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.

[0036] For example, when the path generation method for the virtual scene runs on a terminal, the terminal device stores a game application and uses it to render the virtual scene in the game screen. The terminal device is used to interact with the user through a graphical user interface (GUI), such as by downloading, installing, and running the game application. The terminal device can provide the GUI to the user in various ways, such as rendering it on the terminal device's display screen or presenting the GUI through holographic projection. For example, the terminal device can include a touch screen and a processor. The touch screen is used to present the GUI and receive operation commands generated by the user interacting with the GUI, which includes game screens. The processor is used to run the game, generate the GUI, respond to operation commands, and control the display of the GUI on the touch screen.

[0037] For example, when the path generation method for the virtual scene runs on a server, it can be considered cloud gaming. Cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game application and the game screen presentation are separate. The storage and operation of item usage methods are completed on the cloud gaming server. Game screen presentation is completed on the cloud gaming client, which is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, PDA, or personal digital assistant. However, the terminal device for processing game data is the cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses game screen data, returns it to the cloud gaming client via the network, and finally, the cloud gaming client decodes and outputs the game screen.

[0038] Please see Figure 1 , Figure 1 This is a schematic diagram of a virtual scene path generation system provided in an embodiment of this application. The system may include at least one terminal, at least one server, at least one database, and a network. The user's terminal can connect to different game servers via the network. The terminal is any device with computing hardware capable of supporting and executing software products corresponding to the game. Additionally, the terminal has one or more multi-touch screens for sensing and obtaining input from touch or swipe operations performed by the user at multiple points on one or more touch displays. Furthermore, when the system includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and different servers. The network can be a wireless network or a wired network, such as a wireless local area network (WLAN), local area network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Additionally, different terminals can also connect to other terminals or servers using their own Bluetooth networks or hotspot networks. For example, multiple users can connect online through different terminals via appropriate networks and synchronize with each other to support multiplayer games. In addition, the system can include multiple databases coupled to different servers, and can continuously store information related to the game environment in the databases as different users play multiplayer games online.

[0039] This application provides a path generation method for a virtual scene, which can be executed by a terminal or a server. This application uses the method of using a prop executed by a terminal as an example. The terminal includes a touch screen and a processor. The touch screen is used to present a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. When the user operates the GUI through the touch screen, the GUI can control local content on the terminal in response to the received operation commands, or it can control content on a peer server in response to the received operation commands. For example, the operation commands generated by the user interacting with the GUI may include commands to launch a game application. The processor is configured to launch the game application after receiving the user's command to launch the game application. Furthermore, the processor is configured to render and draw the GUI associated with the game on the touch screen. The touch screen is a multi-touch sensitive screen capable of sensing touch or swipe operations performed simultaneously by multiple points on the screen. When the user performs touch operations on the GUI using their finger, the GUI, upon detecting the touch operation, controls different virtual objects in the game's GUI to perform actions corresponding to the touch operation. For example, the game can be any of the following: casual game, action game, role-playing game, strategy game, sports game, puzzle game, etc. The game can include a virtual scene drawn on a graphical user interface. Furthermore, the virtual scene can include one or more virtual objects, such as virtual characters, controlled by the user (or player). Additionally, the virtual scene can include one or more obstacles, such as railings, ditches, walls, etc., to restrict the movement of virtual objects, for example, restricting the movement of one or more objects to a specific area within the virtual scene. Optionally, the virtual scene can also include one or more elements, such as skills, scores, character health status, energy, etc., to provide assistance to the player, offer virtual services, increase scores related to player performance, etc. Furthermore, the graphical user interface can present one or more indicators to provide guidance information to the player. For example, the game can include virtual objects controlled by the player and one or more other virtual objects (such as enemy characters). In one embodiment, one or more other virtual objects are controlled by other players in the game. For example, one or more other virtual objects can be controlled by a computer, such as a robot using artificial intelligence (AI) algorithms, to achieve a human-computer interaction mode. For example, the virtual objects possess various skills or abilities that the player uses to achieve objectives. For example, virtual objects possess one or more weapons, items, tools, etc., that can be used to eliminate other objects in the game. Such skills or abilities can be activated by the player using one of several preset touch operations on the terminal's touchscreen display. The processor can be configured to respond to the operation commands generated by the user's touch operations to display the corresponding game screen.

[0040] It should be noted that, Figure 1 The schematic diagram of the virtual scene path generation system shown is merely an example. The image processing system and scene described in this application embodiment are for the purpose of more clearly illustrating the technical solutions of this application embodiment and do not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of the virtual scene path generation system and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0041] To address the aforementioned problems, this application provides a first method, apparatus, computer device, and computer-readable storage medium for generating paths in virtual scenes, which can improve the efficiency of path generation in virtual scenes. These will be described in detail below. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.

[0042] This application provides a method for generating paths in a virtual scene. This method can be executed by a terminal or a server. This application uses the example of a virtual scene path generation method being executed by a server to illustrate the method.

[0043] Please see Figure 2 , Figure 2 This is a flowchart illustrating a path generation method for a virtual scene provided in an embodiment of this application. The specific flow of this path generation method for a virtual scene can be as follows:

[0044] 101. Obtain the virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map.

[0045] In this embodiment, the virtual scene can be a game scene, and the virtual scene can be composed of scene terrain and scene elements set on the scene terrain. The scene terrain can include various types, such as plains, plateaus, hills, basins, and mountains.

[0046] Among them, the virtual scene height map is a common way to save height information and can be used in the terrain creation process of various natural landscape scenes.

[0047] Specifically, the terrain of a virtual scene can be a series of grids with different heights, and the heightmap is a 2D array. The index value of each element in the array can be used to locate different grids (x, y), and the value stored in each element is the height (z) of the grid. The heightmap can be used as input data in the process of generating the terrain of the virtual scene.

[0048] In this embodiment, the height map can be represented in various ways, such as a grayscale image, where the grayscale value of each point in the height map represents the height information of that point. The grayscale value can range from 0 to 255, with a grayscale value of 0 representing black and a grayscale value of 255 representing white. White represents the highest point, and black represents the lowest point.

[0049] For example, please see Figure 3 , Figure 3 This is a schematic diagram of the height map of a virtual scene provided in an embodiment of this application. Figure 3 The diagram shows a height map that constitutes the terrain of the virtual scene. In this height map, the height value of each point is represented by grayscale information. Specifically, in the terrain of the virtual scene, the higher the altitude of a point, the brighter it is in the diagram, and vice versa.

[0050] The target path refers to the road that needs to be generated in the virtual scene based on the starting and ending points specified by the virtual scene designer. It can be used for virtual characters or virtual vehicles to travel in the virtual scene.

[0051] In some embodiments, to facilitate path generation operations for virtual scene designers, a graphical user interface is provided through the terminal device, allowing virtual scene designers to perform path generation operations via the graphical user interface. The step "Obtaining the virtual scene height map" may include the following operations:

[0052] In response to the upload operation of the virtual scene height map for the height map display area, the virtual scene height map is obtained and displayed in the height map display area.

[0053] In this embodiment, to facilitate rapid path generation by virtual scene designers, a path generation plugin is designed, and the graphical user interface (GUI) serves as the operating interface for this plugin. Specifically, the GUI may include at least a heightmap display area and path generation controls. The heightmap display area displays the heightmap of the virtual scene for which paths need to be generated, and the path generation controls can be used to trigger commands to automatically generate paths; specifically, the backend can execute the path generation commands.

[0054] For example, please see Figure 4 , Figure 4 This is a schematic diagram of a path graphical user interface for generating a virtual scene, provided as an embodiment of this application. Figure 4 The graphical user interface shown includes at least a heightmap display area and a path generation control. The heightmap display area can be used to load and display the heightmap of the virtual scene, and the path generation control can trigger the generation of paths in the virtual scene.

[0055] The upload operation for the virtual scene height map in the height map display area can include various methods. For example, when a user clicks on the height map display area, a list of local height maps is displayed in the graphical user interface. The user can select any height map from the list to determine the virtual scene height map to be uploaded. Then, the virtual scene height map can be displayed in the height map display area.

[0056] Alternatively, users can click on the heightmap display area to trigger the display of the heightmap from the network in the graphical user interface, which can retrieve the heightmap from the network and display it in the heightmap display area.

[0057] For example, please see Figure 5 , Figure 5 This is a schematic diagram of another path graphical user interface for generating a virtual scene provided in an embodiment of this application. After the upload operation of the virtual scene height map to the height map display area is completed, the obtained virtual scene height map can be displayed in the height map display area.

[0058] In some embodiments, to facilitate virtual scene designers in creating paths in virtual scenes, the graphical user interface may further include a path point selection control, which can be used to specify a start point and an end point.

[0059] For example, please continue reading Figure 5 ,exist Figure 5 In the graphical user interface shown, the path point selection control includes a start point input box and an end point input box. The start point input box can be used to input the coordinates of the starting point of the target path to be generated, such as (x1, y1), and the end point input box can be used to input the coordinates of the ending point, such as (x2, y2).

[0060] 102. Using the starting point as the current path node of the target path, determine at least one adjacent point of the current path node in the virtual scene height map.

[0061] The current path node refers to the path node that generates the target path. In this embodiment, starting from the starting point, multiple path nodes are determined sequentially through the path generation method designed in this scheme until the path node coincides with the ending point. The determined multiple path nodes are then connected to generate the target path.

[0062] In some embodiments, to reduce the computational cost of generating the target path, the method may further include the following steps before the step of "determining at least one neighboring point of the current path node in the virtual scene height map":

[0063] The pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain the processed virtual scene height map.

[0064] The sampling parameters refer to the sampling ratio of the original pixels in the virtual scene height map to generate new pixels. For example, the sampling parameters can be 1:16, 1:32, etc., and the resampling process is to readjust the size of the virtual scene height map based on the sampling parameters.

[0065] For example, when the sampling parameter is 1:16, the resampling process can be to merge the original 16 pixels in the virtual scene height map into one new pixel, and obtain the processed virtual scene height map based on all the merged new pixels; or when the sampling parameter is 1:32, the resampling process can be to merge the original 32 pixels in the virtual scene height map into one new pixel, and obtain the processed virtual scene height map based on all the merged new pixels. In the embodiments of this application, different sizes of processed virtual scene height maps can be generated according to different sampling parameters to meet the different sampling requirements of virtual scene designers for virtual scene height maps.

[0066] In some embodiments, the step "determine at least one neighboring point of the current path node in the virtual scene height map" may include the following operations:

[0067] Determine at least one neighboring point of the current path node from the processed virtual scene height map.

[0068] The current path node can correspond to a pixel in the virtual scene height map, and the adjacent point refers to the pixel in the virtual scene height map that is adjacent to the pixel corresponding to the current path node.

[0069] In some embodiments, applying mean fusion to pixels based on sampling parameters can easily lead to a decrease in pixel data accuracy. To ensure pixel data accuracy during resampling, the step "resampling pixels in the virtual scene height map based on preset sampling parameters to obtain a processed virtual scene height map" may include the following operations:

[0070] The set of multiple pixels to be fused in the virtual scene height map is determined based on preset sampling parameters;

[0071] Based on the preset pixel value weight, the pixel values ​​of pixels in each pixel set that fall within the first pixel value range or the second pixel value range are weighted to obtain the weighted pixels in the pixel set.

[0072] The weighted pixels in each pixel set are merged to obtain new pixels corresponding to each pixel set;

[0073] Based on all the new pixels, a processed virtual scene height map is obtained.

[0074] Each set of pixels includes multiple pixels that need to be merged.

[0075] For example, if the number of original pixels in the virtual scene height map can be 1000 and the sampling parameter can be 1:16, then the original pixels can be divided into 63 pixel sets. The number of pixels in the 63rd pixel set can be 8, and the number of pixels in the other pixel sets can be 16.

[0076] Among them, pixel value weight is used to weight the pixel value of a pixel, that is, the gray value that represents the height.

[0077] In this embodiment of the application, in order to avoid reducing the data accuracy of pixels during the sampling process, a weighting of the maximum value range and the minimum value range is set during the pixel fusion process. The maximum range of 10% is weighted by 0.8, and the minimum range of 10% is weighted by 0.8. This retains more of the brightest and darkest areas in the image and discards some values ​​in the middle areas.

[0078] The first pixel value range can be the maximum value range, i.e., a larger pixel value range, such as the pixel value range of 200 to 255; the second pixel value range can be the minimum value range, i.e., a smaller pixel value range, such as the pixel value range of 0 to 50. The pixel value weight of the first pixel value range can be the same as the pixel value weight of the second pixel value range, for example, the pixel value weight can be 0.8.

[0079] For example, before merging the pixels in each pixel set, the pixel values ​​of the bright pixels and the dark pixels in the first pixel value range of each pixel combination are multiplied by a weight of 0.8, so that the value of the new pixel after merging the pixels in the pixel set will be more biased towards the values ​​of these two parts.

[0080] Specifically, after weighting the pixel values ​​of the bright and dark pixels in the pixel set, multiple pixels in each pixel set are then merged to obtain new pixels corresponding to each pixel set. In other words, new pixels are generated by merging the pixels in each pixel set. Finally, all the new pixels are combined to obtain the processed virtual scene height map.

[0081] For example, please see Figure 6 , Figure 6 This is a schematic diagram illustrating an application scenario for path generation in a virtual scene, as provided in an embodiment of this application. Figure 6The left side shows the original virtual scene height map, with a pixel size of 16x12. A sampling parameter of 1:12 can be selected. Then, the original pixels in the original virtual scene height map are resampled, and every 12 original pixels are merged using the above method to generate a new merged pixel. Figure 6 The height map of the processed virtual scene generated on the right.

[0082] In some embodiments, within a sampling range, i.e., a set of pixels, there may be pixels that fall within both a first pixel value interval and a second pixel value interval simultaneously. This can lead to numerical overflow of the pixels in the pixel set after fusion, meaning that after adding extra weight to the pixel values, the final calculated pixel value may exceed the maximum pixel value. Therefore, the step "weighting the pixel values ​​of pixels in each pixel set that fall within the first pixel value interval or the second pixel value interval based on preset pixel value weights" may include the following steps:

[0083] The pixel values ​​of pixels in the pixel set that fall within the first pixel value range are weighted based on a preset first pixel value weight, and the pixel values ​​of pixels in the pixel set that fall within the second pixel value range are weighted based on a preset second pixel value weight.

[0084] The weight of the third pixel value is determined based on the weight of the first pixel value and the weight of the second pixel value, and the pixel values ​​of pixels in the pixel set that are not in the first pixel value range or the second pixel value range are weighted based on the weight of the third pixel value.

[0085] Specifically, the calculation formula for fusing pixels in the same pixel set based on pixel value weights in this scheme can be as follows:

[0086]

[0087] Wherein, Vmax refers to the pixel value in the first pixel value range (maximum pixel value range), Vmin refers to the pixel value in the second pixel value range (minimum pixel value range), and Vnor refers to the pixel value in other pixel value ranges (pixels not in the first or second pixel value ranges).

[0088] Where Wmax is the weight value of the maximum pixel value interval, Wmin is the weight value of the minimum pixel value interval, and Wsum is the total weight value of the three intervals (if they exist). Vp (value of pixel) refers to the pixel value of the new pixel obtained by fusion.

[0089] In some embodiments, the graphical user interface may further include a sampling parameter selection control. This sampling parameter selection control can be used to select sampling parameters for resampling the virtual scene heightmap.

[0090] For example, please continue reading Figure 5 The graphical user interface may include sampling parameter selection controls, which may include: a first selection sub-control for selecting sampling parameter 1 / 2, a second selection sub-control for selecting sampling parameter 1 / 4, a third selection sub-control for selecting sampling parameter 1 / 16, a fourth selection sub-control for selecting sampling parameter 1 / 32, and so on. This solution is not limited to the above sampling parameters; users can also set other sampling parameters.

[0091] 103. Based on the height information of the current path node and each adjacent point in the virtual scene height map, determine the slope value between the current path node and each adjacent point.

[0092] In this embodiment of the application, before calculating the path based on the starting and ending points determined in the virtual scene height map, the virtual scene height map can be converted into an array matrix to represent the height data.

[0093] For example, please see Figure 7 , Figure 7 This is a schematic diagram illustrating an application scenario for path generation in another virtual scene provided in this application embodiment. Figure 7 An array matrix of partial height data of a virtual scene height map is shown, where each small cell can represent a pixel, and the data in each small cell can represent the height data of that pixel, i.e., the height value.

[0094] In some embodiments, in order to generate an accurate path based on the terrain information of the virtual scene, the step "determine the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map" may include the following operations:

[0095] Obtain the first height value of the current path node and the second height value of each adjacent point from the virtual scene height map;

[0096] Calculate the distance between the current path node and each of its adjacent nodes;

[0097] Based on the first elevation value, the second elevation value, and the distance value, calculate the slope value between the current path node and its adjacent points.

[0098] For example, please see Figure 8 , Figure 8 This is a schematic diagram illustrating an application scenario for path generation in another virtual scene provided in an embodiment of this application. Figure 8In the current path node, it can be a point with a height value of 74. The adjacent points of this pixel can include: the first adjacent point, the second adjacent point, the third adjacent point, the fourth adjacent point, the fifth adjacent point, the sixth adjacent point, the seventh adjacent point, and the eighth adjacent point.

[0099] The first height value of the current path node is 74, the second height value of the first adjacent point is 91, the second height value of the second adjacent point is 84, the second height value of the third adjacent point is 79, the second height value of the fourth adjacent point is 55, the second height value of the fifth adjacent point is 56, the second height value of the sixth adjacent point is 40, the second height value of the seventh adjacent point is 43, and the second height value of the eighth adjacent point is 80.

[0100] Here, the distance value refers to the distance the current path node moves to each adjacent point. In this embodiment, assuming each pixel is a square with a side length of 1, the distance the current path node 74 moves to the adjacent point 55 can be 1, that is, the distance value between the current path node 74 and the adjacent point 55 can be 1; the distance the current path node 74 moves to the adjacent point 79 can be √2, that is, the distance value between the current path node 74 and the adjacent point 55 can be √2. Based on this, the distance value between the current path node and each adjacent point can be calculated.

[0101] In some embodiments, the step "calculate the slope value between the current path node and its adjacent points based on the first height value, the second height value, and the distance value" may include the following operations:

[0102] Based on the first and second height values, calculate the height difference between the current path node and its adjacent points;

[0103] The slope value is obtained by calculating the ratio of the height difference to the distance value.

[0104] In this embodiment of the application, the formula for calculating the design slope value can be:

[0105] S = (H2 - H1) / L;

[0106] Where H2 represents the second elevation value of the adjacent point, H1 represents the first elevation value of the current path node, L represents the distance between the adjacent point and the current path node, and S represents the slope value.

[0107] For example, the slope value between the current path node 74 and the adjacent point 91 is S = (91-74) / √2 = 17 / √2, which is approximately 12. According to the above formula for calculating the slope value, the slope value between the current path node and each adjacent point can be calculated.

[0108] 104. Based on the slope value and the distance between each adjacent point and the current path node and the end point, determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0109] In this embodiment of the application, when generating a path in a virtual scene, the influence of the terrain of the virtual scene is taken into consideration. In order to make the generated path more consistent with the terrain of the scene, the terrain factor is combined into the path-finding algorithm for path calculation. The step "determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point based on the slope value and the distance value between each adjacent point and the current path node and the end point" can include the following operations:

[0110] Calculate the first distance between each adjacent point and the current path node, and calculate the second distance between each adjacent point and the end point;

[0111] The initial movement cost value corresponding to each adjacent point is determined based on the first distance value and the second distance value;

[0112] Based on the slope value and the initial movement cost value, calculate the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0113] Among these factors, movement cost, or cost, serves as the basis for deciding whether to move to a particular point. The point with the minimum cost can be used as the optimal path selection point.

[0114] In this embodiment of the application, the formula for calculating the mobile consumption value can be:

[0115] Cost = L + S + F;

[0116] Where L represents the distance between the adjacent point and the current path node, F represents the distance between the end point and the current path node, and S is the slope value.

[0117] For example, the cost of moving from the current path node 74 to the adjacent point 91 is Cost = 17 + 12 + √13, which is approximately 33. Based on the above formula for calculating the cost of moving from the current path node to each adjacent point, the cost can be calculated.

[0118] In some embodiments, considering the impact of different slope values ​​on the trafficability of the generated path, in order to generate a more reasonable target path, the following steps may be included before the step "determining the movement cost value generated by the current path node passing through each adjacent point to reach the end point based on the slope value and the distance value between each adjacent point and the current path node and the end point":

[0119] Determine the target slope value range corresponding to the slope value from a set of preset slope value ranges;

[0120] Obtain the slope weight corresponding to the target slope value range;

[0121] The slope values ​​are weighted based on the slope weight to obtain the weighted slope values.

[0122] In this embodiment of the application, in order to make more reasonable use of the slope value, according to the longitudinal section design of the "Urban Road Design Code" and the "Impact of Urban Road Slope and Vehicle Speed ​​on Motor Vehicle Emissions", the slope values ​​corresponding to four typical slope types were selected, as shown in the table below:

[0123]

[0124]

[0125] Specifically, based on the slope type and slope value in the table above, multiple slope value ranges can be set as follows: first slope value range (<2), second slope value range (≥2, or ≤5), third slope value range (>5, or ≤10), fourth slope value range (>10, or ≤20), and fifth slope value range (>20).

[0126] Furthermore, different slope weights are assigned to each preset slope value range. For example, a slope value <2 can have a weight of 0, meaning a slope less than 2 is considered the same as a flat road; a slope value of 2–5 can have a weight of 1.5; a slope value of 5–10 can have a weight of 3; a slope value of 10–20 can have a weight of 6; and a slope value >20 is considered an obstacle and can be bypassed. In some embodiments, when the slope value is negative, the movement cost is also reduced accordingly.

[0127] For example, the slope value S between the current path node 74 and the adjacent point 91 calculated above can be 12. When the slope value is 12, the corresponding fourth slope value range is determined. The slope weight value corresponding to the fourth slope value range can be 6. Then, the slope value S can be weighted based on the slope weight value 6, and the weighted slope value can be: 12x6=72.

[0128] In some embodiments, the step "determine the movement cost value generated by the current path node reaching the end point through each adjacent point based on the slope value and the distance value between each adjacent point and the current path node and the end point" may include the following operations:

[0129] Based on the weighted slope value and the distance between each adjacent point and the current path node and the end point, the movement cost generated by the current path node passing through each adjacent point to reach the end point is determined.

[0130] For example, by weighting the slope value S, the final movement cost of moving the current path node 74 to the adjacent point 91 is: Cost = 17 + 72 + √13, which is approximately 93.

[0131] The movement cost value generated when the current path node moves to each adjacent point can be calculated using the above slope value calculation formula and movement cost value calculation formula.

[0132] In this embodiment of the application, after introducing the slope value weight, when generating the target path, if the surrounding area is all high slope, it will proceed along the route in the valley; if there is a gentle slope, it can choose to cross the gentle slope.

[0133] In some embodiments, to facilitate virtual scene designers in setting different slope weights, the graphical user interface may also include a slope range weight setting control.

[0134] For example, please continue reading Figure 5 ,exist Figure 5 The graphical user interface shown may also include a slope range weight setting control, which includes: a first weight setting sub-control, a second weight setting sub-control, a third weight setting sub-control, and a fourth weight setting sub-control. Specifically, the first weight setting sub-control can be used to set the slope weight corresponding to a first slope value range, and can be 0; the second weight setting sub-control can be used to set the slope weight corresponding to a second slope value range, and can be 1.5; the third weight setting sub-control can be used to set the slope weight corresponding to a third slope value range, and can be 3; and the fourth weight setting sub-control can be used to set the slope weight corresponding to a fourth slope value range, and can be 6.

[0135] 105. Based on the movement consumption value, determine the next path node of the current path node in the target path from at least one neighboring point.

[0136] In this embodiment of the application, the smaller the movement cost value, the greater the probability of selecting an adjacent point as a path point of the target path.

[0137] In some embodiments, the step "determine the next path node of the current path node in the target path from at least one neighboring point based on the mobility consumption value" may include the following operations:

[0138] Determine the neighboring point with the minimum movement cost from at least one neighboring point, and use it as the next path node of the current path node in the target path.

[0139] For example, adjacent points to the current path point can include: the first adjacent point, the second adjacent point, the third adjacent point, the fourth adjacent point, the fifth adjacent point, the sixth adjacent point, the seventh adjacent point, and the eighth adjacent point. The movement cost incurred by the current path point moving to the first adjacent point can be 70, the movement cost incurred by the current path point moving to the second adjacent point can be 67, the movement cost incurred by the current path point moving to the third adjacent point can be 20, the movement cost incurred by the current path point moving to the fourth adjacent point can be 34, the movement cost incurred by the current path point moving to the fifth adjacent point can be 56, the movement cost incurred by the current path point moving to the sixth adjacent point can be 66, the movement cost incurred by the current path point moving to the seventh adjacent point can be 48, and the movement cost incurred by the current path point moving to the eighth adjacent point can be 28. The adjacent point with the smallest movement cost among multiple adjacent points can be the third adjacent point. Furthermore, the third adjacent point can be selected as the next path node of the current path node, that is, selected as a point in the generated target path.

[0140] 106. The subsequent path node is used as the new current path node. The subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point, thus obtaining the target path.

[0141] In some embodiments, the step "using the subsequent path node as the new current path node, re-determining the subsequent path node of the new current path node, until the subsequent path node coincides with the end point to obtain the target path" may include the following operations:

[0142] The process involves using the subsequent path node as the new current path node and returning to perform the step of determining at least one adjacent point of the current path node in the virtual scene height map until the subsequent path node coincides with the end point, thus obtaining the target path.

[0143] Specifically, after determining the successor path node of the current path node based on the current path node, the determined successor path node can be used as the new current path node, and then the following steps are executed: determine at least one neighboring point of the current path node in the virtual scene height map; determine the slope value between the current path node and each neighboring point based on the height information of the current path node and each neighboring point in the virtual scene height map; determine the movement cost value generated by the current path node reaching the end point through each neighboring point based on the slope value and the distance values ​​between each neighboring point and the current path node and the end point; determine the successor path node of the current path node in the target path from at least one neighboring point based on the movement cost value. This process is repeated until the successor path node coincides with the end point, indicating that the pathfinding is complete and the target path from the starting point to the end point is generated.

[0144] In some embodiments, to facilitate virtual scene designers in viewing the generated target path, the following steps may be included after the step "taking the subsequent path node as the new current path node, re-determining the subsequent path node of the new current path node, until the subsequent path node coincides with the end point, thus obtaining the target path":

[0145] Display the virtual scene height map and the target path in the height map display area.

[0146] For example, please see Figure 9 , Figure 9 This is a schematic diagram illustrating an application scenario for path generation in another virtual scene provided in an embodiment of this application. Figure 9 In this process, the virtual scene creator selects a starting point A and an ending point B in the virtual scene height map displayed in the height display area. Then, clicking the path generation control triggers the backend to calculate path points according to the path calculation method designed in this solution. Based on the path points, the target path is determined, and then the target path from the starting point A to the ending point B is displayed in the virtual scene height map displayed in the height map display area.

[0147] In some embodiments, to facilitate path creation for virtual scene designers, the graphical user interface may also include a reset control, which can be used to reset various parameters, such as sampling parameters, slope range weights, start and end points.

[0148] In some embodiments, in order to apply the generated target path to the creation of a virtual scene, the graphical user interface may also include an output path data control, which can be used to output the path node data of the generated target path.

[0149] For example, please continue reading Figure 9 ,for Figure 9 The graphical user interface displays the target path AB. Clicking the output path data control generates the path node data for the target path AB, as shown below:

[0150] {'index': 0, 'location': (851, 250)}

[0151] {'index': 1, 'location': (852, 250)}

[0152] {'index': 2, 'location': (853, 250)}

[0153] {'index': 3, 'location': (854, 250)}

[0154] {'index': 4, 'location': (855, 250)}

[0155] {'index': 5, 'location': (856, 250)}

[0156] {'index': 6, 'location': (857, 250)}

[0157] {'index': 7, 'location': (858, 250)}

[0158] {'index': 8, 'location': (858, 251)}

[0159] {"index': 9, 'location': (858, 252)}

[0160] Here, `index` represents the point order of path nodes in the target path, and `location` represents the coordinates of the path nodes in the virtual scene. Specifically, the path node data of the target path AB can be generated into a JSON file, and this JSON file can be saved in the file directory of the virtual scene heightmap for convenient use by the virtual scene creator.

[0161] This application discloses a path generation method for a virtual scene. The method includes: acquiring a virtual scene height map, and the start point and end point of the target path to be generated in the virtual scene height map; using the start point as the current path node of the target path, determining at least one adjacent point of the current path node in the virtual scene height map; determining the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map; determining the movement cost value generated by the current path node reaching the end point through each adjacent point based on the slope value and the distance value between each adjacent point and the current path node and the end point; determining the subsequent path node of the current path node in the target path from at least one adjacent point based on the movement cost value; using the subsequent path node as the new current path node, re-determining the subsequent path node of the new current path node, until the subsequent path node coincides with the end point, thus obtaining the target path. This can improve the path generation efficiency in the virtual scene.

[0162] To facilitate better implementation of the virtual scene path generation method provided in this application embodiment, this application embodiment also provides a virtual scene path generation apparatus based on the above-described virtual scene path generation method. The meanings of the terms used are the same as in the virtual scene path generation method described above, and specific implementation details can be found in the descriptions in the method embodiments.

[0163] Please seeFigure 10 , Figure 10 This application provides a structural block diagram of a path generation device for a virtual scene, comprising:

[0164] The first acquisition unit 301 is used to acquire a virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map;

[0165] The first determining unit 302 is used to take the starting point as the current path node of the target path and determine at least one adjacent point of the current path node in the virtual scene height map;

[0166] The second determining unit 303 is used to determine the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map.

[0167] The third determining unit 304 is used to determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point based on the slope value and the distance value between each adjacent point and the current path node and the end point.

[0168] The fourth determining unit 305 is used to determine the next path node of the current path node in the target path from the at least one neighboring point based on the movement consumption value;

[0169] The fifth determining unit 306 is used to take the subsequent path node as the new current path node, redetermine the subsequent path node of the new current path node, until the subsequent path node coincides with the end point, and obtain the target path.

[0170] In some embodiments, the second determining unit 303 may include:

[0171] The first acquisition subunit is used to acquire the first height value of the current path node and the second height value of each adjacent point from the virtual scene height map;

[0172] The first calculation subunit is used to calculate the distance value between the current path node and each adjacent point;

[0173] The second calculation subunit is used to calculate the slope value between the current path node and the adjacent point based on the first height value, the second height value, and the distance value.

[0174] In some embodiments, the second computing subunit may specifically be used for:

[0175] Based on the first height value and the second height value, calculate the height difference between the current path node and the adjacent point;

[0176] The slope value is obtained by calculating the ratio of the height difference to the distance value.

[0177] In some embodiments, the device may further include:

[0178] The sixth determining unit is used to determine the target slope value range corresponding to the slope value from a preset range of multiple slope value ranges;

[0179] The second acquisition unit is used to acquire the slope weight corresponding to the target slope value range;

[0180] The first processing unit is used to perform weighted processing on the slope value based on the slope weight to obtain the weighted slope value.

[0181] In some embodiments, the third determining unit 304 may include:

[0182] The first determining subunit is used to determine the movement cost value generated by the current path node reaching the end point by passing through each adjacent point, based on the weighted slope value and the distance value between each adjacent point and the current path node and the end point.

[0183] In some embodiments, the third determining unit 304 may include:

[0184] The third calculation subunit is used to calculate a first distance value between each adjacent point and the current path node, and to calculate a second distance value between each adjacent point and the end point;

[0185] The second determining subunit is used to determine the initial movement cost value corresponding to each adjacent point based on the first distance value and the second distance value;

[0186] The fourth calculation subunit is used to calculate the movement cost generated by the current path node reaching the end point by passing through each adjacent point based on the slope value and the initial movement cost value.

[0187] In some embodiments, the fourth determining unit 305 may include:

[0188] The third determining subunit is used to determine the neighboring point with the minimum movement cost from the at least one neighboring point, as the subsequent path node of the current path node in the target path.

[0189] In some embodiments, the device may further include the following steps:

[0190] The second processing unit is used to resample the pixels in the virtual scene height map based on preset sampling parameters to obtain the processed virtual scene height map.

[0191] In some embodiments, the fourth determining unit 305 may include:

[0192] The fourth determining subunit is used to determine at least one neighboring point of the current path node from the processed virtual scene height map.

[0193] In some embodiments, the second processing unit may include:

[0194] The fifth determining subunit is used to determine the set of multiple pixel points to be fused in the virtual scene height map according to the preset sampling parameters;

[0195] The processing subunit is used to perform weighted processing on the pixel values ​​of pixels in each pixel set that fall within the first pixel value interval or the second pixel value interval, based on a preset pixel value weight, to obtain the weighted pixels in the pixel set.

[0196] The fusion subunit is used to fuse the weighted pixels in each pixel set to obtain new pixels corresponding to each pixel set;

[0197] The sixth determining subunit is used to obtain the processed virtual scene height map based on all the new pixels.

[0198] In some embodiments, the processing subunit may specifically be used for:

[0199] The pixel values ​​of pixels in the pixel set that fall within the first pixel value range are weighted based on a preset first pixel value weight, and the pixel values ​​of pixels in the pixel set that fall within the second pixel value range are weighted based on a preset second pixel value weight.

[0200] A third pixel value weight is determined based on the first pixel value weight and the second pixel value weight, and the pixel values ​​of pixels in the pixel set whose pixel values ​​are not in the first pixel value range and the second pixel value range are weighted based on the third pixel value weight.

[0201] In some embodiments, the fifth determining unit 306 may include:

[0202] The execution subunit is used to take the subsequent path node as the new current path node and return to the step of determining at least one adjacent point of the current path node in the virtual scene height map until the subsequent path node coincides with the end point, thus obtaining the target path.

[0203] In some embodiments, the first acquisition unit 301 may include:

[0204] The display subunit is configured to, in response to an upload operation of the virtual scene height map for the height map display area, obtain the virtual scene height map and display the virtual scene height map in the height map display area.

[0205] In some embodiments, the device may further include:

[0206] The display unit is used to display the virtual scene height map and the target path in the height map display area.

[0207] This application discloses a virtual scene path generation device. A first acquisition unit 301 acquires a virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map. A first determination unit 302 uses the start point as the current path node of the target path and determines at least one adjacent point of the current path node in the virtual scene height map. A second determination unit 303 determines the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map. A third determination unit 304 determines the movement cost value generated by the current path node reaching the end point through each adjacent point based on the slope value and the distance value between each adjacent point and the current path node and the end point. A fourth determination unit 305 determines the subsequent path node of the current path node in the target path from the at least one adjacent point based on the movement cost value. A fifth determination unit 306 uses the subsequent path node as a new current path node and re-determines the subsequent path node of the new current path node until the subsequent path node coincides with the end point, thus obtaining the target path. This can improve the efficiency of path generation in virtual scenes.

[0208] Accordingly, embodiments of this application also provide a computer device, which can be a terminal. For example... Figure 11 As shown, Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0209] The processor 501 is the control center of the computer device 500. It connects various parts of the computer device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it performs various functions of the computer device 500 and processes data, thereby monitoring the computer device 500 as a whole.

[0210] In this embodiment, the processor 501 in the computer device 500 loads the instructions corresponding to the processes of one or more applications into the memory 502 according to the following steps, and the processor 501 runs the applications stored in the memory 502 to achieve various functions:

[0211] Obtain the virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map;

[0212] Using the starting point as the current path node of the target path, determine at least one adjacent point of the current path node in the virtual scene height map;

[0213] Based on the height information of the current path node and each adjacent point in the virtual scene height map, determine the slope value between the current path node and each adjacent point;

[0214] Based on the slope value and the distance between each adjacent point and the current path node and the end point, determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0215] Based on the movement cost value, determine the next path node of the current path node in the target path from at least one neighboring point;

[0216] The subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point, thus obtaining the target path.

[0217] In some embodiments, determining the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map includes:

[0218] Obtain the first height value of the current path node and the second height value of each adjacent point from the virtual scene height map;

[0219] Calculate the distance between the current path node and each of its adjacent nodes;

[0220] Based on the first elevation value, the second elevation value, and the distance value, calculate the slope value between the current path node and its adjacent points.

[0221] In some embodiments, the slope value between the current path node and its neighboring points is calculated based on a first height value, a second height value, and a distance value, including:

[0222] Based on the first and second height values, calculate the height difference between the current path node and its adjacent points;

[0223] The slope value is obtained by calculating the ratio of the height difference to the distance value.

[0224] In some embodiments, before determining the movement cost of the current path node reaching the end point by passing through each adjacent point based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, the method further includes:

[0225] Determine the target slope value range corresponding to the slope value from a set of preset slope value ranges;

[0226] Obtain the slope weight corresponding to the target slope value range;

[0227] The slope values ​​are weighted based on the slope weight to obtain the weighted slope values;

[0228] Based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point, including:

[0229] Based on the weighted slope value and the distance between each adjacent point and the current path node and the end point, the movement cost generated by the current path node passing through each adjacent point to reach the end point is determined.

[0230] In some embodiments, based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, the movement cost value generated by the current path node passing through each adjacent point to reach the end point is determined, including:

[0231] Calculate the first distance between each adjacent point and the current path node, and calculate the second distance between each adjacent point and the end point;

[0232] The initial movement cost value corresponding to each adjacent point is determined based on the first distance value and the second distance value;

[0233] Based on the slope value and the initial movement cost value, calculate the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0234] In some embodiments, determining the subsequent path node of the current path node in the target path from at least one neighboring point based on the mobility consumption value includes:

[0235] Determine the neighboring point with the minimum movement cost from at least one neighboring point, and use it as the next path node of the current path node in the target path.

[0236] In some embodiments, before determining at least one neighboring point of the current path node in the virtual scene height map, the method further includes:

[0237] The pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain the processed virtual scene height map.

[0238] Determine at least one neighboring point of the current path node in the virtual scene height map, including:

[0239] Determine at least one neighboring point of the current path node from the processed virtual scene height map.

[0240] In some embodiments, the pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain a processed virtual scene height map, including:

[0241] The set of multiple pixels to be fused in the virtual scene height map is determined based on preset sampling parameters;

[0242] Based on the preset pixel value weight, the pixel values ​​of pixels in each pixel set that fall within the first pixel value range or the second pixel value range are weighted to obtain the weighted pixels in the pixel set.

[0243] The weighted pixels in each pixel set are merged to obtain new pixels corresponding to each pixel set;

[0244] Based on all the new pixels, a processed virtual scene height map is obtained.

[0245] In some embodiments, based on preset pixel value weights, the pixel values ​​of pixels in each set of pixels whose pixel values ​​fall within a first pixel value range or a second pixel value range are weighted, including:

[0246] The pixel values ​​of pixels in the pixel set that fall within the first pixel value range are weighted based on a preset first pixel value weight, and the pixel values ​​of pixels in the pixel set that fall within the second pixel value range are weighted based on a preset second pixel value weight.

[0247] The weight of the third pixel value is determined based on the weight of the first pixel value and the weight of the second pixel value, and the pixel values ​​of pixels in the pixel set that are not in the first pixel value range or the second pixel value range are weighted based on the weight of the third pixel value.

[0248] In some embodiments, the subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point to obtain the target path, including:

[0249] The process involves using the subsequent path node as the new current path node and returning to perform the step of determining at least one adjacent point of the current path node in the virtual scene height map until the subsequent path node coincides with the end point, thus obtaining the target path.

[0250] In some embodiments, a graphical user interface is provided via a terminal device, the graphical user interface including at least a height map display area and a path generation control;

[0251] Obtain the virtual scene height map, including:

[0252] In response to the upload operation of the virtual scene height map for the height map display area, the virtual scene height map is obtained and displayed in the height map display area.

[0253] In some embodiments, after determining the next path node of the new current path node by using the next path node as the new current path node, and continuing until the next path node coincides with the end point to obtain the target path, the method further includes:

[0254] Display the virtual scene height map and the target path in the height map display area.

[0255] This embodiment of the application selects a start point and an end point in a virtual scene height map, using the start point as a path node. Based on the height information of the path node and each adjacent point in the virtual scene height map, it determines the slope value between the path node and each adjacent point. Based on the slope value and the distance values ​​between each adjacent point and the path node and the end point, it determines the movement cost value generated by the path node reaching the end point through each adjacent point. Based on the movement cost value, it determines the next path node from at least one adjacent point, uses this next path node as a new path node, and re-determines the next path node for the new path node, until the next path node coincides with the end point, thus obtaining the target path. This improves the efficiency of path generation in a virtual scene.

[0256] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0257] Optional, such as Figure 11As shown, the computer device 500 also includes: a touch screen display 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen display 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 11 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0258] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, guidance information, icons, videos, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), an organic light-emitting diode (OLED), or other similar devices. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.

[0259] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.

[0260] Audio circuitry 505 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and output to processor 501 for processing. The audio data is then transmitted via radio frequency circuitry 504 to, for example, another computer device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.

[0261] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0262] Power supply 507 is used to supply power to various components of computer device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0263] although Figure 11 As not shown in the diagram, the computer device 500 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0264] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0265] As can be seen from the above, the computer device provided in this embodiment acquires a virtual scene height map, and the starting point and ending point of the target path to be generated in the virtual scene height map; takes the starting point as the current path node of the target path, and determines at least one adjacent point of the current path node in the virtual scene height map; determines the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map; determines the movement cost value generated by the current path node reaching the ending point by passing through each adjacent point based on the slope value and the distance value between each adjacent point and the current path node and the ending point; determines the subsequent path node of the current path node in the target path from at least one adjacent point based on the movement cost value; takes the subsequent path node as the new current path node, and re-determines the subsequent path node of the new current path node, until the subsequent path node coincides with the ending point, thus obtaining the target path.

[0266] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0267] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute steps in any of the virtual scene path generation methods provided in embodiments of this application. For example, the computer program can execute the following steps:

[0268] Obtain the virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map;

[0269] Using the starting point as the current path node of the target path, determine at least one adjacent point of the current path node in the virtual scene height map;

[0270] Based on the height information of the current path node and each adjacent point in the virtual scene height map, determine the slope value between the current path node and each adjacent point;

[0271] Based on the slope value and the distance between each adjacent point and the current path node and the end point, determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0272] Based on the movement cost value, determine the next path node of the current path node in the target path from at least one neighboring point;

[0273] The subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point, thus obtaining the target path.

[0274] In some embodiments, determining the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map includes:

[0275] Obtain the first height value of the current path node and the second height value of each adjacent point from the virtual scene height map;

[0276] Calculate the distance between the current path node and each of its adjacent nodes;

[0277] Based on the first elevation value, the second elevation value, and the distance value, calculate the slope value between the current path node and its adjacent points.

[0278] In some embodiments, the slope value between the current path node and its neighboring points is calculated based on a first height value, a second height value, and a distance value, including:

[0279] Based on the first and second height values, calculate the height difference between the current path node and its adjacent points;

[0280] The slope value is obtained by calculating the ratio of the height difference to the distance value.

[0281] In some embodiments, before determining the movement cost of the current path node reaching the end point by passing through each adjacent point based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, the method further includes:

[0282] Determine the target slope value range corresponding to the slope value from a set of preset slope value ranges;

[0283] Obtain the slope weight corresponding to the target slope value range;

[0284] The slope values ​​are weighted based on the slope weight to obtain the weighted slope values;

[0285] Based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, determine the movement cost value generated by the current path node passing through each adjacent point to reach the end point, including:

[0286] Based on the weighted slope value and the distance between each adjacent point and the current path node and the end point, the movement cost generated by the current path node passing through each adjacent point to reach the end point is determined.

[0287] In some embodiments, based on the slope value and the distance values ​​between each adjacent point and the current path node and the end point, the movement cost value generated by the current path node passing through each adjacent point to reach the end point is determined, including:

[0288] Calculate the first distance between each adjacent point and the current path node, and calculate the second distance between each adjacent point and the end point;

[0289] The initial movement cost value corresponding to each adjacent point is determined based on the first distance value and the second distance value;

[0290] Based on the slope value and the initial movement cost value, calculate the movement cost value generated by the current path node passing through each adjacent point to reach the end point.

[0291] In some embodiments, determining the subsequent path node of the current path node in the target path from at least one neighboring point based on the mobility consumption value includes:

[0292] Determine the neighboring point with the minimum movement cost from at least one neighboring point, and use it as the next path node of the current path node in the target path.

[0293] In some embodiments, before determining at least one neighboring point of the current path node in the virtual scene height map, the method further includes:

[0294] The pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain the processed virtual scene height map.

[0295] Determine at least one neighboring point of the current path node in the virtual scene height map, including:

[0296] Determine at least one neighboring point of the current path node from the processed virtual scene height map.

[0297] In some embodiments, the pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain a processed virtual scene height map, including:

[0298] The set of multiple pixels to be fused in the virtual scene height map is determined based on preset sampling parameters;

[0299] Based on the preset pixel value weight, the pixel values ​​of pixels in each pixel set that fall within the first pixel value range or the second pixel value range are weighted to obtain the weighted pixels in the pixel set.

[0300] The weighted pixels in each pixel set are merged to obtain new pixels corresponding to each pixel set;

[0301] Based on all the new pixels, a processed virtual scene height map is obtained.

[0302] In some embodiments, based on preset pixel value weights, the pixel values ​​of pixels in each set of pixels whose pixel values ​​fall within a first pixel value range or a second pixel value range are weighted, including:

[0303] The pixel values ​​of pixels in the pixel set that fall within the first pixel value range are weighted based on a preset first pixel value weight, and the pixel values ​​of pixels in the pixel set that fall within the second pixel value range are weighted based on a preset second pixel value weight.

[0304] The weight of the third pixel value is determined based on the weight of the first pixel value and the weight of the second pixel value, and the pixel values ​​of pixels in the pixel set that are not in the first pixel value range or the second pixel value range are weighted based on the weight of the third pixel value.

[0305] In some embodiments, the subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point to obtain the target path, including:

[0306] The process involves using the subsequent path node as the new current path node and returning to perform the step of determining at least one adjacent point of the current path node in the virtual scene height map until the subsequent path node coincides with the end point, thus obtaining the target path.

[0307] In some embodiments, a graphical user interface is provided via a terminal device, the graphical user interface including at least a height map display area and a path generation control;

[0308] Obtain the virtual scene height map, including:

[0309] In response to the upload operation of the virtual scene height map for the height map display area, the virtual scene height map is obtained and displayed in the height map display area.

[0310] In some embodiments, after determining the next path node of the new current path node by using the next path node as the new current path node, and continuing until the next path node coincides with the end point to obtain the target path, the method further includes:

[0311] Display the virtual scene height map and the target path in the height map display area.

[0312] This embodiment of the application selects a start point and an end point in a virtual scene height map, using the start point as a path node. Based on the height information of the path node and each adjacent point in the virtual scene height map, it determines the slope value between the path node and each adjacent point. Based on the slope value and the distance values ​​between each adjacent point and the path node and the end point, it determines the movement cost value generated by the path node reaching the end point through each adjacent point. Based on the movement cost value, it determines the next path node from at least one adjacent point, uses this next path node as a new path node, and re-determines the next path node for the new path node, until the next path node coincides with the end point, thus obtaining the target path. This improves the efficiency of path generation in a virtual scene.

[0313] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0314] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0315] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the virtual scene path generation methods provided in the embodiments of this application, the beneficial effects that any of the virtual scene path generation methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0316] The foregoing has provided a detailed description of a virtual scene path generation method, apparatus, computer-readable storage medium, and computer device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A path generation method for a virtual scene, characterized in that, The method includes: Obtain the virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map; Using the starting point as the current path node of the target path, determine at least one adjacent point of the current path node in the virtual scene height map; Based on the height information of the current path node and each adjacent point in the virtual scene height map, determine the slope value between the current path node and each adjacent point; The target slope value range corresponding to the slope value is determined from a set of preset slope value ranges; Obtain the slope weight corresponding to the target slope value range; The slope value is weighted based on the slope weight to obtain the weighted slope value; Based on the weighted slope value and the distance between each adjacent point and the current path node and the end point, the movement cost value generated by the current path node reaching the end point through each adjacent point is determined. Based on the movement consumption value, determine the next path node of the current path node in the target path from the at least one neighboring point; The subsequent path node is used as the new current path node, and the subsequent path node of the new current path node is re-determined until the subsequent path node coincides with the end point, thus obtaining the target path.

2. The method according to claim 1, characterized in that, The step of determining the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map includes: Obtain the first height value of the current path node and the second height value of each adjacent point from the virtual scene height map; Calculate the distance between the current path node and each of its adjacent points; Based on the first height value, the second height value, and the distance value, calculate the slope value between the current path node and the adjacent point.

3. The method according to claim 2, characterized in that, The step of calculating the slope value between the current path node and the adjacent point based on the first height value, the second height value, and the distance value includes: Based on the first height value and the second height value, calculate the height difference between the current path node and the adjacent point; The slope value is obtained by calculating the ratio of the height difference to the distance value.

4. The method according to claim 1, characterized in that, The determination of the movement cost value generated by the current path node reaching the end point through each adjacent point, based on the weighted slope value and the distance values ​​between each adjacent point and the current path node and the end point, includes: Calculate a first distance value between each adjacent point and the current path node, and calculate a second distance value between each adjacent point and the end point; The initial movement cost value corresponding to each adjacent point is determined based on the first distance value and the second distance value; Based on the weighted slope value and the initial movement cost value, calculate the movement cost value generated by the current path node reaching the end point through each adjacent point.

5. The method according to claim 1, characterized in that, The step of determining the subsequent path node of the current path node in the target path from the at least one neighboring point based on the mobility consumption value includes: The neighboring point with the minimum movement cost is determined from the at least one neighboring point and is selected as the next path node of the current path node in the target path.

6. The method according to claim 1, characterized in that, Before determining at least one neighboring point of the current path node in the virtual scene height map, the method further includes: The pixels in the virtual scene height map are resampled based on preset sampling parameters to obtain the processed virtual scene height map. Determining at least one neighboring point of the current path node in the virtual scene height map includes: Determine at least one neighboring point of the current path node from the processed virtual scene height map.

7. The method according to claim 6, characterized in that, The process of resampling pixels in the virtual scene height map based on preset sampling parameters to obtain a processed virtual scene height map includes: The set of multiple pixels to be fused in the virtual scene height map is determined according to the preset sampling parameters; Based on the preset pixel value weight, the pixel values ​​of pixels in each pixel set that fall within the first pixel value range or the second pixel value range are weighted to obtain the weighted pixels in the pixel set. The weighted pixels in each pixel set are merged to obtain new pixels corresponding to each pixel set; Based on all the new pixels, the processed virtual scene height map is obtained.

8. The method according to claim 7, characterized in that, The weighted processing of pixel values ​​in each pixel set that fall within a first pixel value interval or a second pixel value interval, based on preset pixel value weights, includes: The pixel values ​​of pixels in the pixel set that fall within the first pixel value range are weighted based on a preset first pixel value weight, and the pixel values ​​of pixels in the pixel set that fall within the second pixel value range are weighted based on a preset second pixel value weight. A third pixel value weight is determined based on the first pixel value weight and the second pixel value weight, and the pixel values ​​of pixels in the pixel set whose pixel values ​​are not in the first pixel value range and the second pixel value range are weighted based on the third pixel value weight.

9. The method according to claim 1, characterized in that, The step of taking the subsequent path node as the new current path node, re-determining the subsequent path node of the new current path node, until the subsequent path node coincides with the end point to obtain the target path includes: The subsequent path node is used as the new current path node. The process of determining at least one neighboring point of the current path node in the virtual scene height map is repeated until the subsequent path node coincides with the end point, thus obtaining the target path.

10. The method according to claim 1, characterized in that, A graphical user interface is provided through a terminal device, the graphical user interface including at least a height map display area and a path generation control; The process of obtaining the virtual scene height map includes: In response to the upload operation of the virtual scene height map for the height map display area, the virtual scene height map is obtained and displayed in the height map display area.

11. The method according to claim 10, characterized in that, After determining the subsequent path node as the new current path node, and re-determining the subsequent path node of the new current path node, until the subsequent path node coincides with the end point to obtain the target path, the method further includes: The height map of the virtual scene and the target path are displayed in the height map display area.

12. A path generation device for a virtual scene, characterized in that, The device includes: The first acquisition unit is used to acquire a virtual scene height map, and the start and end points of the target path to be generated in the virtual scene height map; The first determining unit is used to take the starting point as the current path node of the target path and determine at least one adjacent point of the current path node in the virtual scene height map; The second determining unit is used to determine the slope value between the current path node and each adjacent point based on the height information of the current path node and each adjacent point in the virtual scene height map. The sixth determining unit is used to determine the target slope value range corresponding to the slope value from a preset range of multiple slope value ranges; The second acquisition unit is used to acquire the slope weight corresponding to the target slope value range; The first processing unit is used to perform weighted processing on the slope value based on the slope weight to obtain the weighted slope value; The third determining unit is used to determine the movement cost value generated by the current path node reaching the end point by passing through each adjacent point based on the weighted slope value and the distance value between each adjacent point and the current path node and the end point. The fourth determining unit is used to determine the next path node of the current path node in the target path from the at least one neighboring point based on the movement consumption value; The fifth determining unit is used to take the subsequent path node as the new current path node, redetermine the subsequent path node of the new current path node, until the subsequent path node coincides with the end point, and obtain the target path.

13. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein, When the processor executes the program, it implements the path generation method for the virtual scene as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the path generation method for a virtual scene according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • DEM-based multi-target-point path planning method under mountainous area road-free condition

    CN114562998A