Terrain division method and device in game scene, electronic equipment and storage medium
By obtaining the parameters of the game scene points and using automated processing flow, efficient and accurate division of terrain in the game scene is achieved, the problem of inefficient terrain division in the existing technology is solved, and the game development efficiency and scene authenticity are improved.
Patent Information
- Application Number
- CN202411320276.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-10
AI Technical Summary
The inefficient and insufficient accuracy of terrain division in game scenarios lead to limited game development efficiency.
By obtaining the point parameters of each scene in the game scene, the automatic processing process is used to divide the game scene into terrain, including precise division of areas such as peaks, cliffs, slopes and exposed rocks, and using technologies such as Laplace operators and threshold processing. , realize programmatic division of terrain.
It improves the efficiency and accuracy of terrain division, reduces the difficulty of user division, and enhances the authenticity and playability of game scenes.
Smart Images

Figure CN119280830A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method for dividing terrain in a game scene, a device for dividing terrain in a game scene, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the development of game technology, some games provide players with an open game world to satisfy players' desire to explore in the game world. Among them, for the game world, in order to improve its authenticity, game developers can usually build different terrains in the game world, such as mountains, forests, oceans, grasslands, etc. Through various terrain environments, while ensuring players' desire to explore, they can also provide players with a variety of gameplay. However, in the process of dividing the terrain in the game scene, it is often necessary to manually divide the terrain area. Manually drawing the area requires a lot of time and energy, which seriously affects the efficiency of game development and the accuracy of terrain division. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, electronic device and computer-readable storage medium for dividing terrain in a game scene, so as to solve or partially solve the problems of low efficiency and low accuracy in dividing terrain in a game scene.
[0004] The embodiment of the present invention discloses a method for dividing terrain in a game scene, comprising:
[0005] Get the point parameters corresponding to each scene point in the game scene;
[0006] The game scene is divided into terrains according to the point parameters to obtain a terrain area corresponding to the game scene.
[0007] The embodiment of the present invention further discloses a terrain division device in a game scene, comprising:
[0008] The parameter acquisition module is used to obtain the point parameters corresponding to each scene point in the game scene;
[0009] The terrain division module is used to divide the terrain of the game scene according to the point parameters to obtain a terrain area corresponding to the game scene.
[0010] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0011] The memory is used to store computer programs;
[0012] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0013] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0014] The embodiments of the present invention include the following advantages:
[0015] In an embodiment of the present invention, in the process of dividing the game scene into terrain, the point parameters corresponding to each scene point in the game scene can be obtained, and then the game scene can be divided into terrain according to the point parameters to obtain the terrain area corresponding to the game scene. By obtaining the point parameters, based on the automated processing flow, the user's division difficulty can be effectively reduced. At the same time, based on the automated processing flow, the division efficiency can be effectively improved and the accuracy of the division can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart of the steps of a method for dividing terrain in a game scene provided in an embodiment of the present invention;
[0017] Figure 2 is a schematic diagram of a raised area provided in an embodiment of the present invention;
[0018] Figure 3 is a schematic diagram of a raised area provided in an embodiment of the present invention;
[0019] Figure 4 is a schematic diagram of points provided in an embodiment of the present invention;
[0020] Figure 5 is a schematic diagram of a mountain region provided in an embodiment of the present invention;
[0021] Figure 6 is a schematic diagram of a first mask area provided in an embodiment of the present invention;
[0022] Figure 7 is a schematic diagram of a cliff area provided in an embodiment of the present invention;
[0023] Figure 8 is a schematic diagram of a slope area provided in an embodiment of the present invention;
[0024] Fig. 9 is a schematic diagram of an initial rock outcropping area provided in an embodiment of the present invention;
[0025] Fig.10 is a schematic diagram of an exposed rock area provided in an embodiment of the present invention;
[0026] Fig.11 is a schematic diagram of a terrain area provided in an embodiment of the present invention;
[0027] Fig.12 is a structural block diagram of a terrain division device in a game scene provided in an embodiment of the present invention;
[0028] Fig.13 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0030] As an example, in the process of dividing the terrain in the game scene, it is often necessary to manually divide the terrain areas. Manually drawing the areas takes a lot of time and effort, which seriously affects the efficiency of game development and the accuracy of terrain division.
[0031] In this regard, in the present invention, in the process of dividing the terrain of the game scene, by constructing a corresponding algorithm, the game terrain is divided programmatically based on the algorithm. Specifically, by obtaining the point parameters corresponding to each scene point in the game scene, and then dividing the terrain of the game scene according to the point parameters, the terrain area corresponding to the game scene is obtained, thereby obtaining the point parameters based on the automated processing flow, which can effectively reduce the user's division difficulty. At the same time, based on the automated processing flow, it can effectively improve the division efficiency and ensure the accuracy of the division.
[0032] Reference Figure 1 , shows a flowchart of a method for dividing terrain in a game scene provided in an embodiment of the present invention, which may specifically include the following steps:
[0033] Step 101, obtaining point parameters corresponding to each scene point in the game scene;
[0034] In the embodiment of the present invention, a game scene can be constructed in a programmatic manner, and the game scene can include corresponding terrain areas, and these terrain areas are interconnected and related, so that the user cannot perform further processing on different terrain areas, for example, adding mountain top rocks to the mountain peak area, placing cliff rocks on the cliff area, etc. Therefore, by dividing the game scene into terrains, it is convenient to add corresponding game assets to separate terrain areas in the future, thereby improving the authenticity of the game scene.
[0035] For the game scene, it can be composed of different scene points, and each scene point can be associated with corresponding point parameters, such as normal information, tangent information, and secondary tangent information, etc., which are not limited by the present invention. Among them, the normal information can be a vector perpendicular to the surface of the game scene, which is used to determine the direction of the scene point; the tangent information can be a vector tangent to the surface of the game scene and perpendicular to the normal; the secondary tangent can be a vector perpendicular to both the tangent and the normal, which can form a corresponding orthogonal coordinate system with the tangent and the normal. In the game scene, the secondary tangent information, the tangent information, and the normal are used together to construct the tangent space, etc., so as to obtain the point parameters corresponding to each scene point in the game scene, so as to realize the automatic division of the terrain of the game scene according to the point parameters.
[0036] Step 102: divide the game scene into terrain according to the point parameters to obtain a terrain area corresponding to the game scene.
[0037] In the embodiment of the present invention, by acquiring point parameters, based on the automated processing flow, the user's difficulty of division can be effectively reduced. At the same time, based on the automated processing flow, the division efficiency can be effectively improved and the accuracy of the division can be guaranteed.
[0038] Among them, terrain areas may include mountain areas, cliff areas, slope areas, and rocky outcrops. Mountain areas may be the highest parts of the game scene. These areas may be composed of sharp peaks or flat-topped mountaintops. In the game, mountain areas can be used as high-difficulty areas for players to explore, and may also contain important game elements, such as hidden treasures, important plot triggers, or viewing platforms. Cliff areas may be vertical or nearly vertical steep rock walls in the game scene. These areas usually have obvious drops. Cliff areas can be used as obstacles in the game to restrict the player's movement path. They may also contain action elements such as climbing and jumping. In addition, cliff areas may also be used as dangerous areas in the game. If the player is not careful You may fall and get injured or die; the slope area can be the terrain with a certain slope in the game scene. The terrain in these areas is relatively flat, but has a certain inclination angle. The slope area can be used as a natural path for players to move in the game, and may also include special actions such as sliding and skiing. In addition, the slope area may also affect the physical simulation in the game, such as gravity effects and friction; the exposed rock area can be the exposed rock surface in the game scene. These areas are usually not covered with vegetation, and the rocks are directly exposed. In the game, the exposed rock area can be used as an area for climbing, jumping and exploring, and may also contain hidden paths or secret areas. In addition, the exposed rock area may also affect the lighting and shadow effects in the game, increasing the realism of the scene.
[0039] In the process of terrain division of the game scene, for the mountain area, the game scene can be mapped first to obtain the terrain mask map corresponding to the game scene, and then the mapping value of each scene point in the terrain mask map can be obtained, and then the terrain mask map can be filtered according to the mapping value to obtain the convex area corresponding to the game scene, and the convex area includes edge points and internal points, and the edge points and the internal points correspond to the scene points. For the convex area, the first angle between the edge point and the vertical direction, and the first normal information corresponding to the internal point and the second angle in the vertical direction can be further obtained, and then the convex area can be filtered according to the first angle and the second angle to obtain the mountain area corresponding to the game scene.
[0040] It should be noted that the terrain mask map can be a binary image obtained by calculating the Laplacian operator on the game scene. By mapping it to a terrain mask map, specific terrain features can be highlighted. In the process of mapping the game scene, a mapping value corresponding to each scene point can be obtained. Based on the mapping value, a raised area and a non-raised area can be divided in the terrain mask map. Based on the raised area, the scene points in the game scene can be screened out to obtain corresponding edge points and internal points. The edge points can include scene points that constitute the periphery of the raised area, while the internal points can be scene points located inside the raised area.
[0041] In some feasible implementations, in the process of dividing the mountain area, before mapping the game scene, the game scene may be first fuzzy processed to obtain terrain information corresponding to the game scene, and the terrain information may be used to characterize the terrain contour of the game scene. After obtaining the terrain contour by fuzzy processing the game scene, the terrain information may be derived based on the Laplace operator to obtain the derivative result corresponding to the terrain information, and then the derivative result may be mapped to obtain the terrain mask corresponding to the game scene, and finally the scene points in the terrain mask whose mapping values are less than the first preset threshold may be formed into a raised area corresponding to the game scene.
[0042] In a specific implementation, the terrain details are reduced through blur processing to obtain the general outline of the terrain. For example, Gaussian blur or other blur filters can be used to process the game scene to obtain the terrain data corresponding to the game scene. Then the Laplace operator can be applied to the blurred terrain data. Since the Laplace operator is a second-order differential operator, it can be achieved by calculating the sum of the second-order partial derivatives of the terrain data. Then, the result of the Laplacian operator can be mapped into a binary image through threshold processing to highlight specific terrain features. For example, the result of the Laplacian operator can be threshold processed, and scene points less than -0.015 (i.e., the first preset threshold) are marked as 1 (red), and the remaining scene points are marked as 0 (non-red). The red part (mask is 1) can be used to represent significant edges or detail areas in the terrain, and these areas still maintain a strong contrast after blurring; while the non-red part (mask is 0) can represent relatively flat or blurred areas in the terrain, and these areas have a lower contrast after blurring. Therefore, after blurring the game scene, calculating the Laplacian operator and thresholding the game scene, the raised areas corresponding to the game scene can be obtained. These raised areas can be preliminarily used as the areas to be processed in the peak area. By further processing the raised areas, the areas to be processed in the game scene can be accurately divided.
[0043] like Figure 2 As shown, a schematic diagram of the raised area provided in an embodiment of the present invention is shown. After the raised area corresponding to the game scene is obtained through the above process, the first angle between the edge point and the vertical direction, as well as the first normal information of the internal point and the second angle in the vertical direction can be obtained. The raised area is screened according to the first angle and the second angle to obtain the peak area corresponding to the game scene.
[0044] In some possible implementations, for the raised area, it can be as follows Figure 3As shown, for the raised area, it can include different types of raised areas such as ①, ② and ③, but not every part of the raised area is a mountain top, so it is necessary to eliminate the situation ② and retain the situation ③, while ① is an example diagram of a conventional peak area. In a specific implementation, the edge point whose first angle is less than the first preset angle threshold can be used as the target edge point, and then the raised area whose target edge points belong to the same raised area and the number of target edge points reaches the preset number threshold can be used as the first target area, so that the area to be temporarily eliminated can be screened out from the raised area through the first angle corresponding to the edge point; then the first target area where the internal point whose second angle is less than or equal to the second preset angle threshold is located can be used as the second target area, and the first target area where the internal point whose second angle is greater than or equal to the third preset angle threshold is located can be used as the third target area, and then the second target area and the third target area are removed from the first target area to obtain the eliminated area, and the raised area except the eliminated area is used as the peak area corresponding to the game scene.
[0045] For the first target area, it can be an area determined based on the first angle between the edge point of the raised area and the vertical direction. When the first angle is less than the first preset angle threshold, it can be determined that the edge point is relatively flat relative to the surface of the game scene, and it is classified as a target edge point. Then, for the same raised area, the number of target edge points can be counted. If the number of target edge points reaches the preset number threshold (such as 40%, 50%, etc.), the raised area can be used as the first target area, that is, as a tentatively eliminated area. However, for the first target area to be tentatively eliminated, it may exist Figure 3 Therefore, further screening is needed to ensure the accuracy of area elimination.
[0046] Further, refer to Figure 4, shows a schematic diagram of the points provided in the embodiment of the present invention. For the raised area, the outside of the raised area is the edge point, and the other points can be internal points. For the internal points, if they belong to the points of the top of the mountain, it is necessary to satisfy that the second angle between the first normal information corresponding to the internal point and the vertical direction is less than or equal to the second preset angle threshold. If it does not satisfy, it indicates that the raised area belongs to the area that needs to be eliminated. If it satisfies, it indicates that the raised area belongs to the peak area and needs to be eliminated from the first target area. In addition, if the edge points of the raised area are all smaller than the first angle in the vertical direction, it may also be the case in ③ above. In this regard, it can be judged by the second angle corresponding to the internal point whether there is an internal point whose second angle is greater than or equal to the third preset angle threshold. If it exists, it indicates that the first target area belongs to the case in ③ above and needs to be retained. Therefore, after determining the first target area to be eliminated in the raised area, the area to be eliminated is further screened through the corresponding screening process, so that all areas to be eliminated can be accurately screened out. These areas are eliminated from the raised area, and the peak area corresponding to the game scene can be obtained, as shown in FIG. Figure 5 As shown, a schematic diagram of the mountain area provided in an embodiment of the present invention is shown. Based on the automated processing flow, the mountain area in the game scene can be effectively divided, while improving the division efficiency and ensuring the accuracy of the division.
[0047] It should be noted that the first preset angle threshold, the second preset angle threshold and the third preset angle threshold, etc., can be different values. For example, the first preset angle threshold can be 10°, the second preset angle threshold can be 3°, the third preset angle threshold can be 50°, etc. It can be understood that it can be set according to actual needs, and the present invention does not limit this.
[0048] For cliff areas and slope areas, both can be determined by calculating the angle between the terrain surface of the game scene and the vertical direction, and comparing the angle with a preset angle range to determine whether it belongs to a cliff area or a slope area. In some feasible implementations, the second normal information corresponding to the scene point can be determined based on the vector difference between the tangent information and the secondary tangent information, and the third angle between the second normal information and the vertical direction can be calculated, and then the third angle can be compared with a preset angle range. The cliff area and slope area corresponding to the game scene are determined based on the comparison result. Based on the automated processing flow, the cliff area and slope area in the game scene can be effectively divided, while improving the efficiency of the division and ensuring the accuracy of the division.
[0049] Among them, the preset angle range includes at least a first preset angle range and a second preset angle range. The scene points whose third corner falls into the first preset angle range can be first formed into a first mask area, and then the first mask area and the peak area are used to divide the terrain to obtain the cliff area corresponding to the game scene. Then, the scene points whose third corner falls into the second preset angle range can be formed into a second mask area, and the second mask area, the cliff area and the peak area are used to divide the terrain to obtain the slope area corresponding to the game scene.
[0050] In the process of processing the cliff area and the slope area, whether it is the first mask area or the second mask area, there may be multiple terrain areas. Therefore, after determining the first mask area and the second mask area according to the third angle between the ground surface and the vertical direction and the preset angle range, for the first mask area, the first mask area can be subtracted from the peak area calculated in the above embodiment to obtain the cliff area in the game scene, and then the second mask area can be subtracted from the peak area and the cliff area to obtain the slope area in the game scene, thereby ensuring the independence of each terrain area and improving the accuracy of the terrain division of the game scene.
[0051] It should be noted that the preset angle range can be adjusted according to the cliff area and the slope area. For example, the first preset angle range can be 30-90 degrees, the second preset angle range can be 0-30 degrees, etc. By setting the corresponding preset angle range, the cliff area and the slope area can be effectively divided, thereby improving the accuracy of terrain division.
[0052] In one example, if Figure 6 FIG. 1 is a schematic diagram of a first mask area provided in an embodiment of the present invention. For the cliff area, after the first mask area is obtained through the above process, the mountain area that has been divided can be subtracted from the first mask area. At the same time, since the cliff area is a long strip area, the area in the first mask area with an aspect ratio close to 1 (similar to a square) can also be eliminated, thereby obtaining Figure 7 The cliff area shown. Accordingly, based on the same or similar processing method, we can get Figure 8 The slope area shown can effectively divide the cliff area and slope area in the game scene based on the automated processing flow, thereby improving the division efficiency and ensuring the accuracy of the division.
[0053] For the exposed rock area, the processing process is similar to that of the mountain area, and both can be calculated using the Laplace operator. The difference between the processing process and the peak area is that the processing process of the exposed rock area does not require blurring the game scene, but can be calculated directly, so that relatively small raised areas can be calculated, so as to retain more terrain details and improve the accuracy of terrain division.
[0054] In a specific implementation, based on a processing process similar to that of the mountain area, after determining the convex area, the first angle between the edge point and the vertical direction, and the second angle between the first normal information corresponding to the internal point and the vertical direction can be obtained. Then, the edge point whose first angle is less than the fourth preset angle threshold can be used as the target edge point. Then, the convex area with target edge points belonging to the same convex area and the number of target edge points reaching the preset number threshold can be used as the fourth target area. Similarly, the fourth target area can also be the area that is tentatively required to be eliminated. After determining the area that is tentatively required to be eliminated, further judgment is made based on the second angle between the normal information of the internal point and the vertical direction. The fourth target area where the internal point where the second angle is less than or equal to the fifth preset angle threshold is located is used as the fifth target area, and the fourth target area where the internal point where the second angle is greater than or equal to the sixth preset angle threshold is located is used as the sixth target area. Then, the fifth target area and the sixth target area are removed from the fourth target area to obtain the eliminated area, and the convex area except the eliminated area is used as the initial exposed rock area corresponding to the game scene. Similarly, for the initial exposed rock area, it may overlap with the peak area, cliff area and slope area. In this case, the peak area, cliff area and slope area obtained by dividing the game scene as mentioned above can be combined with the initial exposed rock area for regional filtering. The initial exposed rock area can be subtracted from the peak area, cliff area and slope area to obtain the target exposed rock area corresponding to the game scene. Based on the automated processing flow, the exposed rock area in the game scene can be effectively divided, which can improve the efficiency of division and ensure the accuracy of division.
[0055] In one example, referring to Fig. 9 , shows a schematic diagram of the initial rock outcropping area provided in an embodiment of the present invention. Based on a calculation process similar to that of the mountain peak area, after obtaining the initial rock outcropping area, the mountain peak area, the cliff area and the slope area can be subtracted, and particularly small pieces of debris can also be subtracted, thereby obtaining Fig.10 The target rock exposed area shown in the figure can be effectively divided into rock exposed areas in the game scene based on the automated processing flow, which improves the efficiency of division and ensures the accuracy of division. Finally, by dividing the game scene, we can get Fig.11The terrain areas shown, that is, the game scene is divided into mountain areas, cliff areas, slope areas, and exposed rock areas, etc., based on the automated processing flow, can effectively reduce the difficulty of division for users. At the same time, based on the automated processing flow, it can effectively improve the division efficiency and ensure the accuracy of the division.
[0056] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0057] In an embodiment of the present invention, in the process of dividing the game scene into terrain, the point parameters corresponding to each scene point in the game scene can be obtained, and then the game scene can be divided into terrain according to the point parameters to obtain the terrain area corresponding to the game scene. By obtaining the point parameters, based on the automated processing flow, the user's division difficulty can be effectively reduced. At the same time, based on the automated processing flow, the division efficiency can be effectively improved and the accuracy of the division can be guaranteed.
[0058] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0059] Reference Fig.12 , shows a structural block diagram of a terrain division device in a game scene provided in an embodiment of the present invention, which may specifically include the following modules:
[0060] The parameter acquisition module 1201 is used to obtain the point parameters corresponding to each scene point in the game scene;
[0061] The terrain division module 1202 is used to divide the terrain of the game scene according to the point parameters to obtain a terrain area corresponding to the game scene.
[0062] In some feasible implementations, the point parameter includes first normal information, the terrain region includes a mountain region, and the terrain division module 1202 is specifically configured to:
[0063] Mapping the game scene to obtain a terrain mask map corresponding to the game scene;
[0064] Obtaining a mapping value of each of the scene points in the terrain mask map;
[0065] The terrain mask map is screened according to the mapping value to obtain a raised area corresponding to the game scene, wherein the raised area includes edge points and internal points;
[0066] Obtain a first angle between the edge point and the vertical direction, and a second angle between the first normal information of the internal point and the vertical direction, filter the raised area according to the first angle and the second angle, and obtain a peak area corresponding to the game scene.
[0067] In some feasible implementations, the terrain division module 1202 is specifically used to:
[0068] Performing fuzzy processing on the game scene to obtain terrain information corresponding to the game scene, wherein the terrain information is used to characterize the terrain contour of the game scene;
[0069] Derivative the terrain information to obtain a derivative result corresponding to the terrain information;
[0070] The derivation result is mapped to obtain a terrain mask map corresponding to the game scene.
[0071] In some feasible implementations, the terrain division module 1202 is specifically used to:
[0072] The scene points in the terrain mask map whose mapping values are less than a first preset threshold value form a raised area corresponding to the game scene.
[0073] In some feasible implementations, the terrain division module 1202 is specifically used to:
[0074] Taking an edge point whose first angle is less than a first preset angle threshold as a target edge point;
[0075] The convex regions whose target edge points belong to the same convex region and whose number of target edge points reaches a preset number threshold are used as the first target region;
[0076] The first target area where the internal points with a second angle less than or equal to a second preset angle threshold are located is taken as the second target area;
[0077] The first target area where the internal points whose second angle is greater than or equal to the third preset angle threshold are located is taken as the third target area;
[0078] The second target area and the third target area are removed from the first target area to obtain a rejection area, and the raised area except the rejection area is used as the peak area corresponding to the game scene.
[0079] In some feasible implementations, the point parameters include at least tangent information and secondary tangent information, the terrain region also includes a cliff region and a slope region, and the terrain division module 1202 is further configured to:
[0080] Determine second normal information corresponding to the scene point based on a vector difference between the tangent information and the secondary tangent information, and calculate a third angle between the second normal information and the vertical direction;
[0081] The third angle is compared with a preset angle range, and the cliff area and the slope area corresponding to the game scene are determined according to the comparison result.
[0082] In some feasible implementations, the preset angle range includes at least a first preset angle range and a second preset angle range, and the terrain division module 1202 is specifically used to:
[0083] The scene points whose third angle falls within the first preset angle range form a first mask area;
[0084] Using the first mask area and the mountain area to divide the terrain, to obtain a cliff area corresponding to the game scene;
[0085] The scene points whose third angle falls within the second preset angle range form a second mask area;
[0086] The second mask area, the cliff area and the peak area are used to divide the terrain to obtain a slope area corresponding to the game scene.
[0087] In some feasible implementations, the terrain area also includes an exposed rock area, and the terrain division module 1202 is further configured to:
[0088] Taking an edge point whose first angle is less than a fourth preset angle threshold as a target edge point;
[0089] The convex regions whose target edge points belong to the same convex region and whose number of target edge points reaches a preset number threshold are used as fourth target regions;
[0090] The fourth target area where the internal points whose second angle is less than or equal to the fifth preset angle threshold are located is taken as the fifth target area;
[0091] The fourth target area where the internal points whose second angle is greater than or equal to the sixth preset angle threshold are located is taken as the sixth target area;
[0092] The fifth target area and the sixth target area are removed from the fourth target area to obtain a rejection area, and a raised area other than the rejection area is used as an initial exposed rock area corresponding to the game scene;
[0093] The initial exposed rock area, the peak area, the cliff area and the slope area are used to divide the terrain to obtain a target exposed rock area corresponding to the game scene.
[0094] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0095] In addition, an embodiment of the present invention further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the terrain division method embodiment in the above-mentioned game scene are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0096] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the terrain division method in the game scene is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0097] Fig.13 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0098] The electronic device 1300 includes but is not limited to: a radio frequency unit 1301, a network module 1302, an audio output unit 1303, an input unit 1304, a sensor 1305, a display unit 1306, a user input unit 1307, an interface unit 1308, a memory 1309, a processor 1310, and a power supply 1311. Those skilled in the art can understand that the electronic device structure involved in the embodiment of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or less components than shown in the figure, or combine certain components, or arrange components differently. In the embodiment of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0099] It should be understood that in the embodiment of the present invention, the radio frequency unit 1301 can be used for receiving and sending signals during information transmission or call. Specifically, after receiving the downlink data from the base station, it is sent to the processor 1310 for processing; in addition, the uplink data is sent to the base station. Generally, the radio frequency unit 1301 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 1301 can also communicate with the network and other devices through a wireless communication system.
[0100] The electronic device provides users with wireless broadband Internet access through the network module 1302, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0101] The audio output unit 1303 can convert the audio data received by the RF unit 1301 or the network module 1302 or stored in the memory 1309 into an audio signal and output it as sound. Moreover, the audio output unit 1303 can also provide audio output related to a specific function performed by the electronic device 1300 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 1303 includes a speaker, a buzzer, a receiver, etc.
[0102] The input unit 1304 is used to receive audio or video signals. The input unit 1304 may include a graphics processor (GPU) 13041 and a microphone 13042. The graphics processor 13041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 1306. The image frame processed by the graphics processor 13041 can be stored in the memory 1309 (or other storage medium) or sent via the radio frequency unit 1301 or the network module 1302. The microphone 13042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 1301 in the case of a telephone call mode.
[0103] The electronic device 1300 also includes at least one sensor 1305, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 13061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 13061 and / or the backlight when the electronic device 1300 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 1305 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0104] The display unit 1306 is used to display information input by the user or information provided to the user. The display unit 1306 may include a display panel 13061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0105] The user input unit 1307 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 1307 includes a touch panel 13071 and other input devices 13072. The touch panel 13071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 13071 or near the touch panel 13071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 13071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 1310, receives the command sent by the processor 1310 and executes it. In addition, the touch panel 13071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 13071, the user input unit 1307 may also include other input devices 13072. Specifically, other input devices 13072 may include but are not limited to physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which will not be repeated here.
[0106] Further, the touch panel 13071 may be covered on the display panel 13061. When the touch panel 13071 detects a touch operation on or near it, it is transmitted to the processor 1310 to determine the type of the touch event, and then the processor 1310 provides a corresponding visual output on the display panel 13061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 13071 and the display panel 13061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 13071 and the display panel 13061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.
[0107] The interface unit 1308 is an interface for connecting an external device to the electronic device 1300. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 1308 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 1300 or may be used to transmit data between the electronic device 1300 and an external device.
[0108] The memory 1309 can be used to store software programs and various data. The memory 1309 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1309 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0109] The processor 1310 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 1309 and calling data stored in the memory 1309, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 1310 may include one or more processing units; preferably, the processor 1310 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1310.
[0110] The electronic device 1300 may also include a power supply 1311 (such as a battery) for supplying power to each component. Preferably, the power supply 1311 may be logically connected to the processor 1310 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system.
[0111] In addition, the electronic device 1300 includes some functional modules not shown, which will not be described in detail here.
[0112] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0113] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0114] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0115] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0117] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0119] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0121] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for dividing terrain in a game scene, characterized in that: include: Get the point parameters corresponding to each scene point in the game scene; The game scene is divided into terrains according to the point parameters to obtain a terrain area corresponding to the game scene.
2. The method according to claim 1, characterized in that The point parameter includes first normal information, the terrain region includes a mountain region, and the terrain division of the game scene according to the point parameter to obtain a terrain region corresponding to the game scene includes: Mapping the game scene to obtain a terrain mask map corresponding to the game scene; Obtaining a mapping value of each of the scene points in the terrain mask map; The terrain mask map is screened according to the mapping value to obtain a raised area corresponding to the game scene, wherein the raised area includes edge points and internal points; Obtain a first angle between the edge point and the vertical direction, and a second angle between the first normal information of the internal point and the vertical direction, filter the raised area according to the first angle and the second angle, and obtain a peak area corresponding to the game scene.
3. The method according to claim 2, characterized in that Mapping the game scene to obtain a terrain mask map corresponding to the game scene includes: Performing fuzzy processing on the game scene to obtain terrain information corresponding to the game scene, wherein the terrain information is used to characterize the terrain contour of the game scene; Derivative the terrain information to obtain a derivative result corresponding to the terrain information; The derivation result is mapped to obtain a terrain mask map corresponding to the game scene.
4. The method according to claim 2 or 3, characterized in that: The filtering of the terrain mask map according to the mapping value to obtain a raised area corresponding to the game scene includes: The scene points in the terrain mask map whose mapping values are less than a first preset threshold value form a raised area corresponding to the game scene.
5. The method according to claim 2, characterized in that: The step of screening the raised area according to the first angle and the second angle to obtain a peak area corresponding to the game scene includes: Taking an edge point whose first angle is less than a first preset angle threshold as a target edge point; The convex regions whose target edge points belong to the same convex region and whose number of target edge points reaches a preset number threshold are used as the first target region; The first target area where the internal points with a second angle less than or equal to a second preset angle threshold are located is taken as the second target area; The first target area where the internal points whose second angle is greater than or equal to the third preset angle threshold are located is taken as the third target area; The second target area and the third target area are removed from the first target area to obtain a rejection area, and the raised area except the rejection area is used as the peak area corresponding to the game scene.
6. The method according to claim 2, characterized in that The point parameters at least include tangent information and secondary tangent information, the terrain area also includes a cliff area and a slope area, and the terrain division of the game scene according to the point parameters to obtain the terrain area corresponding to the game scene also includes: Determine second normal information corresponding to the scene point based on a vector difference between the tangent information and the secondary tangent information, and calculate a third angle between the second normal information and the vertical direction; The third angle is compared with a preset angle range, and the cliff area and the slope area corresponding to the game scene are determined according to the comparison result.
7. The method according to claim 6, characterized in that The preset angle range includes at least a first preset angle range and a second preset angle range, and comparing the third angle with the preset angle range, and determining the cliff area and the slope area corresponding to the game scene according to the comparison result, comprises: The scene points whose third angle falls within the first preset angle range form a first mask area; Using the first mask area and the mountain area to divide the terrain, to obtain a cliff area corresponding to the game scene; The scene points whose third angle falls within the second preset angle range form a second mask area; The second mask area, the cliff area and the peak area are used to divide the terrain to obtain a slope area corresponding to the game scene.
8. The method according to claim 6 or 7, characterized in that: The terrain area also includes an exposed rock area, and the terrain division of the game scene according to the point parameters to obtain a terrain area corresponding to the game scene also includes: Taking an edge point whose first angle is less than a fourth preset angle threshold as a target edge point; The convex regions whose target edge points belong to the same convex region and whose number of target edge points reaches a preset number threshold are used as fourth target regions; The fourth target area where the internal points whose second angle is less than or equal to the fifth preset angle threshold are located is taken as the fifth target area; The fourth target area where the internal points whose second angle is greater than or equal to the sixth preset angle threshold are located is taken as the sixth target area; The fifth target area and the sixth target area are removed from the fourth target area to obtain a rejection area, and a raised area other than the rejection area is used as an initial exposed rock area corresponding to the game scene; The initial exposed rock area, the peak area, the cliff area and the slope area are used to divide the terrain to obtain a target exposed rock area corresponding to the game scene.
9. A terrain division device in a game scene, characterized in that: include: The parameter acquisition module is used to obtain the point parameters corresponding to each scene point in the game scene; The terrain division module is used to divide the terrain of the game scene according to the point parameters to obtain a terrain area corresponding to the game scene.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 8 when executing the program stored in the memory.
11. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 8.