CN114332397B - Method and device for realizing same-level adjacent terrain transition effect - Google Patents

Method and device for realizing same-level adjacent terrain transition effect Download PDF

Info

Publication number
CN114332397B
CN114332397B CN202111667803.9A CN202111667803A CN114332397B CN 114332397 B CN114332397 B CN 114332397B CN 202111667803 A CN202111667803 A CN 202111667803A CN 114332397 B CN114332397 B CN 114332397B
Authority
CN
China
Prior art keywords
terrain
preset
image block
identification
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111667803.9A
Other languages
Chinese (zh)
Other versions
CN114332397A (en
Inventor
蒋法源
吴宗安
赵云飞
吕学斌
朱玮晓
郝利强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Discovery Bay Technology Co ltd
Original Assignee
Beijing Discovery Bay Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Discovery Bay Technology Co ltd filed Critical Beijing Discovery Bay Technology Co ltd
Priority to CN202111667803.9A priority Critical patent/CN114332397B/en
Publication of CN114332397A publication Critical patent/CN114332397A/en
Application granted granted Critical
Publication of CN114332397B publication Critical patent/CN114332397B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application provides a method and a device for realizing a transition effect of adjacent terrains at the same level, and relates to the technical field of information. The method comprises the following steps: identifying the terrain of each image block forming the terrain map to be processed and identifying the terrain of each image block according to the terrain of the image block to obtain a first identification terrain map of the image block with the terrain identification; moving a preset grid on the first identification topographic map according to a first preset amount and a second preset amount, and segmenting the first identification topographic map through the grid; finding a sub-lattice comprising different terrain blocks in the grid, and obtaining a first area ratio between different terrains in the found sub-lattice; and generating a first transition image block corresponding to the found sub-lattice according to the first area ratio and a preset first image block template. The method and the device can improve the problem that the performance effect of the terrain and the required material quantity cannot meet the requirements of the user at the same time, and achieve the effect that the performance effect of the terrain and the required material quantity meet the requirements of the user at the same time.

Description

Method and device for realizing same-level adjacent terrain transition effect
Technical Field
The embodiment of the application relates to the technical field of information, in particular to a method and a device for realizing a transition effect of adjacent terrains at the same level.
Background
In a simulation game, "simulation" is the core of the simulation game. "true" represents the real world, and the simulation game with higher simulation degree has more help meaning to real life; conversely, a lower simulation level will increase the entertainment of the game. The level of the simulation degree does not represent the excellence or not of the simulation game, but the market faced by the game.
In a game using image blocks to represent terrain, the terrain is generally realized by only using one image layer, if the transition effect among the terrains is not considered, only one image block needs to be drawn for each terrain, so that the used resources are few, but because the transition effect does not exist among different terrains, the picture looks like a mosaic formed by grids, the terrain representation effect is extremely poor, and the map is rarely used at present. Meanwhile, if the transition effect between different terrains is considered, the image blocks need to include the transition effect in various directions between all types of terrains, so that the required material amount is increased in geometric magnification.
In the process of implementing the invention, the inventor finds that in the current game for expressing the terrain by using the image blocks, the representation effect of the terrain and the required material amount cannot simultaneously meet the requirements of the user.
Disclosure of Invention
The embodiment of the application provides a method and a device for realizing adjacent terrain transition effects in the same level, which can solve the problem that the representation effect of the terrain and the required material quantity cannot simultaneously meet the requirements of users in the current game for representing the terrain by using image blocks.
In a first aspect of the present application, a method for implementing a same-level adjacent terrain transition effect is provided, including:
identifying the terrain of each image block forming the terrain map to be processed, and carrying out terrain identification on each image block in the terrain map to be processed according to the terrain of the image block to obtain a first identification terrain map formed by the image blocks with terrain identifications;
moving a preset grid up and down according to a first preset amount and moving a preset grid left and right according to a second preset amount on the first identification topographic map, and segmenting the first identification topographic map through the grid; the size of the grid is the same as that of the first identification topographic map, each sub-grid of the grid is the same as the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with the first identification topographic map;
traversing each of the sub-lattices of the mesh, finding the sub-lattices comprising different terrain patches, and obtaining a first area ratio between different terrains in the found sub-lattices;
setting a preset first pattern block template corresponding to any area ratio according to any area ratio among different terrains, and constructing a preset first pattern block template library; aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to a first area proportion, and processing different terrains in the first image block template to obtain a first transition image block;
and replacing all the found image blocks in the sub-lattices with corresponding first transition image blocks to realize adjacent terrain transition at the same level.
By adopting the technical scheme, in the implementation method of the adjacent terrain transition effect at the same level provided by the embodiment of the application, the terrain of each image block forming the terrain map to be processed is firstly identified, and the terrain identification is carried out on each image block in the terrain map to be processed according to the terrain of the image block, so that a first identification terrain map formed by the image blocks with the terrain identification is obtained; moving the preset grids on the first identification topographic map up and down according to a first preset amount and moving the preset grids left and right according to a second preset amount, and segmenting the first identification topographic map through the grids; traversing each sub-lattice of the grid, finding the sub-lattices comprising different terrain image blocks, and obtaining a first area ratio between different terrains in the found sub-lattices; generating a first transition image block corresponding to the found sub-lattice according to the first area ratio and a preset first image block template; finally, replacing all the image blocks in the found sub-lattices with corresponding first transition image blocks to realize adjacent terrain transition of the same level; based on the method, the first transition image block of the topographic map to be processed is generated, the material required by the topographic map to be processed can be subjected to the operation of breaking the whole into parts, the reuse rate of resources is improved, the first transition image block of the topographic map to be processed is replaced into the topographic map to be processed, the adjacent topographic transitions in the same level can be realized on the premise of improving the reuse rate of resources, and the representation effect of the image block terrain in the topographic map to be processed is enhanced; the problem that the representation effect of the terrain and the required material quantity cannot meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks can be solved, and the effect that the representation effect of the terrain and the required material quantity can meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks is achieved.
In one possible implementation, the obtaining a first area ratio between different terrains in the found sub-lattice includes:
acquiring the first preset quantity and the second preset quantity;
and calculating a first area ratio between different terrains according to the first preset quantity and the second preset quantity.
In a possible implementation manner, according to the first area proportion, a preset first image block template is selected from a preset first image block template library, and different terrains in the first image block template are processed to obtain a first transition image block; the method comprises the following steps:
selecting a preset first image block template according to the first area proportion;
and filling different terrains into the first image block template according to the first area ratio and the terrain identification of the image block to obtain a first transition image block.
In one possible implementation, the method further includes a flow of implementation of adjacent terrain transition effects of different levels:
dividing different terrains according to the height of the terrains to obtain preset levels;
carrying out hierarchical identification on each image block in the first identification topographic map according to the terrain of the image block and the preset hierarchy to obtain a second identification topographic map formed by the image blocks with hierarchical identification;
traversing each said sub-lattice of said grid, finding said sub-lattice comprising tiles identified at different levels, obtaining a second area ratio between different levels in said found sub-lattice;
generating a second transition image block corresponding to the found sub-lattice according to the preset hierarchy, the first transition image block, the second area ratio and a preset second image block template;
and replacing all the found image blocks in the sub-lattices with corresponding second transition image blocks to realize adjacent terrain transition of different levels.
In one possible implementation, the obtaining a second area ratio between different levels in the found sub-lattice comprises:
acquiring the first preset quantity and the second preset quantity;
and calculating a second area ratio between different levels according to the first preset quantity and the second preset quantity.
In one possible implementation manner, the generating, according to the preset level, the first transition tile block, the second area proportion, and a preset second tile block template, a second transition tile block corresponding to the found sub-lattice includes:
selecting a second image block template of each level according to the second area ratio;
performing same-level equivalent replacement on the second image block template according to the first transition image block to obtain a level image block of each level;
and superposing the hierarchical image blocks of different hierarchies according to the preset hierarchy to obtain a second transition image block.
In a second aspect of the present application, there is provided an apparatus for implementing adjacent terrain transition effect at the same level, comprising:
the first identification module is used for identifying the terrain of each image block forming the terrain map to be processed, identifying the terrain of each image block in the terrain map to be processed according to the terrain of the image block and obtaining a first identification terrain map formed by the image blocks with terrain identifications;
the moving module is used for moving the preset grids on the first identification topographic map up and down according to a first preset amount and moving the preset grids left and right according to a second preset amount, and segmenting the first identification topographic map through the grids; the size of the grid is the same as that of the first identification topographic map, the size of each sub-grid of the grid is the same as that of the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with that of the first identification topographic map;
a first traversal module for traversing each of said sub-lattices of said mesh, finding said sub-lattices that comprise different terrain patches, obtaining a first area ratio between different terrains in said found sub-lattices;
the first generation module is used for setting a preset first image block template corresponding to any area ratio according to any area ratio among different terrains and constructing a preset first image block template library; aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to a first area proportion, and processing different terrains in the first image block template to obtain a first transition image block;
and the first replacement module is used for replacing all the found image blocks in the sub-lattices with corresponding first transition image blocks to realize adjacent terrain transition at the same level.
In one possible implementation, the apparatus further includes:
the dividing module is used for dividing different terrains according to the height of the terrains to obtain preset levels;
the second identification module is used for carrying out hierarchy identification on each image block in the first identification topographic map according to the terrain of the image block and the preset hierarchy to obtain a second identification topographic map formed by the image blocks with hierarchy identification;
a second traversal module for traversing each of the sub-lattices of the lattice, finding the sub-lattices that include tiles identified by different levels, and obtaining a second area-to-area ratio between different levels in the found sub-lattices;
a second generation module, configured to generate a second transition image block corresponding to the found sub-lattice according to the preset hierarchy, the first transition image block, the second area ratio, and a preset second image block template;
and the second replacement module is used for replacing all the found image blocks in the sub lattices with corresponding second transition image blocks so as to realize adjacent terrain transition of different levels.
In a third aspect of the present application, an electronic device is provided. The electronic device includes: a memory having a computer program stored thereon and a processor implementing the method as described above when executing the computer program.
In a fourth aspect of the application, a computer-readable storage medium is provided, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method.
It should be understood that the statements described in this summary are not intended to limit the scope of the disclosure, or the various features described in this summary. Other features of the present application will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of various embodiments of the present application will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, like or similar reference characters designate like or similar elements, and wherein:
fig. 1 shows a schematic diagram of different effects of one land according to eight adjacent surrounding lands in the embodiment of the present application.
Fig. 2 shows a flowchart of an implementation method of adjacent terrain transition effects at the same level in the embodiment of the present application.
Fig. 3 shows a schematic diagram of moving a preset grid in a first labeled topographic map and segmenting the first labeled topographic map through the grid in the embodiment of the present application.
FIG. 4 is a schematic diagram of a preset first tile template in an embodiment of the present application.
FIG. 5 shows a schematic diagram of a first transition tile generated in an embodiment of the present application.
Fig. 6 shows a schematic diagram of the sub lattices found in the embodiment of the present application all completing replacement.
FIG. 7 shows a schematic diagram of terrain layer level partitioning in an embodiment of the present application.
Fig. 8 shows a structure diagram of an apparatus for implementing adjacent terrain transition effect at the same level in the embodiment of the present application.
Fig. 9 shows a schematic structural diagram of an electronic device suitable for implementing embodiments of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The method for realizing the transition effect of the adjacent terrains at the same level can be applied to the technical field of information.
In the related art, in a game in which a terrain is represented by tiles, only one layer is generally used to realize the presentation of a terrain effect.
If the transition effect between terrains is not considered, only one tile needs to be rendered for each terrain. Based on the mode, the effect of using fewer resources can be achieved. However, in a method of realizing the presentation of a topographic effect using only one layer without considering a transitional effect between different topographies, the screen looks like a mosaic composed of squares, and the presentation effect is extremely poor, and therefore, this method is rarely used at present.
If the transition effect between different terrains is considered, the image block needs to contain the transition effect in various directions between all types of terrains, and the required material amount is increased in geometric magnification.
Fig. 1 is a schematic diagram illustrating different effects of one plot according to eight surrounding adjacent plots in the embodiment of the present application. Referring to fig. 1, there are three different terrains in the game, and if each plot needs to have different effects according to eight adjacent plots around, a total of 3 is needed 9 (19683) Different map tiles. However, this is clearly impractical. Therefore, in a general game, only the transition effect between four adjacent plots including fixed terrain types is performed, so that about dozens of plots can meet the requirement.
In summary, in the current game using blocks to represent terrain, the representation effect of terrain and the required material amount cannot meet the requirements of users at the same time.
In order to solve the technical problem, an embodiment of the present application provides a method for implementing a same-level adjacent terrain transition effect. In some embodiments, the method for implementing the same-level adjacent terrain transition effect may be performed by an electronic device.
Fig. 2 shows a flowchart of a method for implementing a same-level adjacent terrain transition effect in an embodiment of the present application. Referring to fig. 2, the method for implementing the adjacent terrain transition effect at the same level in the embodiment includes:
step 201: the method comprises the steps of identifying the terrain of each image block forming a terrain map to be processed, identifying the terrain of each image block in the terrain map to be processed according to the terrain of the image block, and obtaining a first identification terrain map formed by the image blocks with terrain identifications.
Step 202: moving a preset grid up and down according to a first preset amount and moving a preset grid left and right according to a second preset amount on the first identification topographic map, and segmenting the first identification topographic map through the grid; the size of the grid is the same as that of the first identification topographic map, the size of each sub-grid of the grid is the same as that of the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with that of the first identification topographic map.
Step 203: traversing each of the sub-lattices of the mesh, finding the sub-lattices that include different terrain tiles, and obtaining a first area ratio between different terrains in the found sub-lattices.
Step 204: and generating a first transition image block corresponding to the found sub-lattice according to the first area ratio and a preset first image block template.
Step 205: and replacing all the found image blocks in the sub-lattices with corresponding first transition image blocks to realize adjacent terrain transition at the same level.
By adopting the technical scheme, in the method for realizing the same-level adjacent terrain transition effect, the terrain of each image block forming the terrain map to be processed is firstly identified, and the terrain of each image block in the terrain map to be processed is identified according to the terrain of the image block, so that a first identification terrain map formed by the image blocks with the terrain identifications is obtained; moving the preset grids on the first identification topographic map up and down according to a first preset amount and moving the preset grids left and right according to a second preset amount, and segmenting the first identification topographic map through the grids; traversing each sub lattice of the grid, finding the sub lattices comprising different terrain blocks, and obtaining a first area ratio between different terrains in the found sub lattices; generating a first transition image block corresponding to the found sub-lattice according to the first area ratio and a preset first image block template; finally, replacing all the image blocks in the found sub lattices with corresponding first transition image blocks to realize adjacent terrain transition of the same level; based on the method, the first transition image block of the topographic map to be processed is generated, the material required by the topographic map to be processed can be subjected to the operation of breaking up the whole into parts, the reuse rate of resources is improved, the first transition image block of the topographic map to be processed is replaced into the topographic map to be processed, the adjacent topographic transitions in the same level can be realized on the premise of improving the reuse rate of resources, and the expression effect of the image block and the topographic shape in the topographic map to be processed is enhanced; the problem that the representation effect of the terrain and the required material quantity cannot meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks can be solved, and the effect that the representation effect of the terrain and the required material quantity can meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks is achieved.
In step 201, the terrain map to be processed may be a single terrain map corresponding to each terrain scene in the virtual world presented in the game playing process, or may be a total terrain map corresponding to the whole world of the virtual world in the game. The plurality of blocks (such as mosaic tiles) form a terrain map to be processed, and the terrain map to be processed comprises the terrain of each block in the plurality of blocks.
Types of terrain include, but are not limited to, ocean, river, lake, pond, beach, land, grass (lawn), stone, and snow. Based on the identification of the terrain, each image block included in the terrain map to be processed is provided with a terrain identifier, namely a first identification terrain map.
In step 202, the size of the preset mesh is the same as that of the first identification topographic map, the size of each sub-lattice of the preset mesh is also the same as that of the block in the first identification topographic map, and the initial position of the preset mesh is also completely overlapped with that of the first identification topographic map.
Further, the preset grid can be obtained according to the first identification topographic map, that is, the outer boundary of the first identification topographic map and the outer boundary of the block in the first identification topographic map are linearized to obtain the preset grid.
Further, the preset grid may also be a grid set artificially according to the rule of the grid, or a grid set by the system according to the rule of the grid.
In the embodiment of the present application, the first preset amount and the second preset amount may be set manually or randomly by the system. The magnitudes of the first predetermined amount and the second predetermined amount may be the same magnitude or different magnitudes.
In the embodiment of the present application, the sub-lattices in the grid after being moved by the first preset amount and the second preset amount exist to surround the different levels of the tiles.
For convenience of description, the first predetermined quantity and the second predetermined quantity are the same quantity, i.e. half of the side length of the block.
Fig. 3 shows a schematic diagram of moving a preset grid in a first labeled topographic map and segmenting the first labeled topographic map through the grid in the embodiment of the present application. Referring to fig. 3, in the schematic part (a) before the preset grid is moved in the first identification topographic map, the blocks pointed by the arrow are sand, the blocks in fig. 3 with the same color as the blocks pointed by the arrow are sand, and the blocks with other colors are land.
Referring to fig. 3, the schematic part (b) of the marking of the magnitude according to the preset grid moves the preset grid according to the magnitudes of the first preset amount and the second preset amount. According to the marked magnitude, the preset grid on the first identification topographic map is moved downwards according to the first preset amount (one half of the side length of the image block), and then the preset grid on the first identification topographic map is moved rightwards according to the second preset amount (one half of the side length of the image block), so that the schematic part (c) after the preset grid is moved in the first identification topographic map is obtained.
Referring to fig. 3, the first identification topographic map is segmented by a preset grid to obtain sub-lattices in the moved grid, where the sub-lattices surround different topographic map blocks. As can be seen from the schematic section (d) where there are sub-lattices in the moved grid that enclose different terrain tiles, the tiles in each sub-lattice include material that is different in terrain identity.
In some embodiments, if the magnitudes of the first predetermined amount and the second predetermined amount are the same magnitude, and the segments can be cut equally according to the magnitudes, the sub-lattices in the moved grid can also be obtained according to the splitting, moving and recombining, and the sub-lattices surrounding the segments with different terrain exist.
For convenience of description, the first predetermined amount and the second predetermined amount are still selected to be the same amount, i.e. half of the side length of the block.
Specifically, each image block in the first identification topographic map is equally split according to a first preset amount or a second preset amount, that is, each image block is split into four equal small cells, the preset grid on the first identification topographic map is moved one small cell (namely, the original half cell) in the vertical direction (namely, downward), then moved one small cell (namely, the original half cell) in the horizontal direction (namely, rightward), is staggered with the original grid, and then is recombined with the adjacent image blocks around to form the image blocks with the same size as the original image blocks. Based on the steps, the sub lattices in the moved grid are obtained, and the sub lattices surrounding different terrain blocks exist.
In step 203, based on the terrain identity, the area fraction between different terrains in the found sub-grid is calculated. The area ratio between different terrains is the ratio of the area of each terrains to the total area.
In step 204, the preset first image block template is an image block template that can be set manually or by a system according to the first preset amount and the second preset amount.
Fig. 4 is a schematic diagram illustrating a preset first tile template in an embodiment of the present application. Referring to fig. 4, according to any area ratio between different terrains, a preset first image block template corresponding to the any area ratio is set, and a preset first image block template library is constructed. And aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to the first area proportion, and processing different terrains in the first image block template to obtain a first transition image block.
FIG. 5 shows a schematic diagram of a first transition tile generated in an embodiment of the present application. Referring to fig. 5, the first tile template is filled with different terrains according to the first area proportion and the terrain identifier of the tile, so as to generate a first transition tile.
In step 205, the tiles including different terrain identifications in the found sub-lattices are processed, and transition of adjacent terrains at the same level is realized.
Fig. 6 shows a schematic diagram of the sub lattices found in the embodiment of the present application all completing replacement. Referring to fig. 6, when all the image blocks in the found sub-lattices are completely replaced, the presentation of the transition effect can be obviously embodied by comparing with the terrain map to be processed which is not subjected to the transition processing. Meanwhile, based on the multiplexing of the first transition image blocks, the occupation of resources is also reduced.
In some embodiments, step 203 comprises: step A1-step A2.
Step A1: and acquiring the first preset quantity and the second preset quantity.
Step A2: and calculating a first area ratio between different terrains according to the first preset quantity and the second preset quantity.
In the embodiment of the present application, when the first preset quantity and the second preset quantity are the same quantity, and the image blocks can be cut equally according to the quantity, the area ratio can be calculated by calculating the number of the equal number of cells after each image block is split.
Otherwise, when the magnitude values of the first preset amount and the second preset amount are different magnitude values, or the magnitude values of the first preset amount and the second preset amount are the same magnitude values, and the image blocks cannot be equally cut according to the magnitude values, the area ratio can be calculated based on a wide search space (BFS) algorithm.
In some embodiments, step 204 comprises: step B1-step B2.
Step B1: and selecting a preset first image block template according to the first area proportion.
And step B2: and filling different terrains into the first image block template according to the first area ratio and the terrain identification of the image block to obtain a first transition image block.
In the embodiment of the present application, the first area ratio is determined according to a first preset amount and a second preset amount. Different first area ratios correspond to different preset first image block templates, and therefore a corresponding first image block template library is generated according to any first area ratio. And selecting a corresponding first image block template from the first image block template library according to the first area proportion.
In some embodiments, the method further comprises a flow of implementation of adjacent terrain transition effects of different levels:
step C1: and dividing different terrains according to the height of the terrains to obtain preset levels.
And step C2: and carrying out hierarchical identification on each image block in the first identification topographic map according to the terrain of the image blocks and the preset hierarchy, and obtaining a second identification topographic map formed by the image blocks with hierarchical identification.
And C3: traversing each said sub-lattice of said grid, finding said sub-lattice comprising tiles identified at different levels, obtaining a second area ratio between different levels in said found sub-lattice.
And C4: and generating a second transition image block corresponding to the found sub-lattice according to the preset hierarchy, the first transition image block, the second area ratio and a preset second image block template.
And C5: and replacing all the found image blocks in the sub-lattices with corresponding second transition image blocks to realize adjacent terrain transition of different levels.
In the embodiment of the application, the preset hierarchy can be artificially divided into different terrains according to the heights of the terrains. The preset level can also be defined by the system for terrains with different heights, and then the different terrains are divided according to the height of the terrains according to the definition rules. The number of the levels included by the preset levels is set by a designer according to the resource occupation and the transition effect.
FIG. 7 shows a schematic diagram of terrain layer level partitioning in an embodiment of the present application. Referring to fig. 7, the terrain in the pattern diagram of the terrain is identified, and the terrain can be divided into three layers by using the rule that the ground is divided from low to high, that is, the preset hierarchy comprises three layers, namely, a water surface layer, a soil layer and a ground surface covering layer from low to high.
Wherein the surface layer includes, but is not limited to, oceans, rivers, lakes, and ponds; the ground layer includes, but is not limited to, beach and land; surface coverings include, but are not limited to, grass plants (turf), rocks, and snow.
In the embodiment of the present application, the predetermined hierarchy is used to define the order in which hierarchical tiles are stacked in each hierarchy when the second transition tiles are generated.
In the embodiment of the application, each image block in the first identification topographic map is subjected to level identification according to the terrain of the image block and the preset level, namely, in the game, the material used by the terrain of the presented image block is divided into three layers according to the preset level set in the step.
Based on the identification of the terrain and the identification of the levels, each image block to be included in the first identification terrain map is provided with a terrain identification and a level identification, and the first identification terrain map is the second identification terrain map.
Based on the level identification, a second area occupation ratio between different levels in the found sub-lattice is calculated. The second area ratio is the ratio of the area of each level to the total area.
In the embodiment of the application, the preset second image block template corresponding to any area ratio is set according to any area ratio among different levels, and a preset second image block template library is constructed. And aiming at the image blocks in one sub-lattice, selecting a preset second image block template from a preset second image block template library according to a second area proportion, obtaining the hierarchical image blocks of each hierarchy based on the obtained first transition image block, and then superposing the hierarchical image blocks of each hierarchy according to the preset hierarchy to generate a second transition image block.
In some embodiments, step C3 comprises: step c 1-step c2.
Step c1: and acquiring the first preset quantity and the second preset quantity.
And c2: and calculating a second area ratio between different levels according to the first preset quantity and the second preset quantity.
In the embodiment of the application, when the first preset quantity and the second preset quantity have the same quantity and the image blocks can be cut equally according to the quantity, the area ratio can be calculated by calculating the quantity of the equal number of the cells after each image block is split.
On the contrary, when the magnitude values of the first preset quantity and the second preset quantity are different magnitude values, or the magnitude values of the first preset quantity and the second preset quantity are the same magnitude values, and the image blocks can not be equally cut according to the magnitude values, the area ratio can be calculated based on a wide search (BFS) algorithm.
In some embodiments, step C4 comprises: step c 3-step c5.
And c3: selecting a second tile template for each level according to the second area proportion.
And c4: and carrying out same-level equivalent replacement on the second image block template according to the first transition image block to obtain a level image block of each level.
And c5: and superposing the hierarchical image blocks of different levels according to the preset hierarchy to obtain a second transition image block.
In the embodiment of the present application, the second area ratio is determined according to the first preset amount and the second preset amount. Different second area ratios correspond to different second image block templates, and therefore a corresponding second image block template library is generated according to any second area ratio. And selecting a corresponding second image block template from the second image block template library according to the second area ratio.
In the embodiment of the application, in order to realize the adjacent terrain transition effects of different levels, namely, in order to realize that each terrain square can present different transition effects according to 8 adjacent terrain squares, the terrain material is divided into a plurality of levels (preset levels) based on the steps, and the terrain material is replaced and overlapped according to the first transition image block and the preset levels, so that the adjacent terrain transition effects are recombined with the adjacent image blocks.
Compared with the prior art, the method combines the methods, and the materials required by the topographic map to be processed in the game are subjected to the operation of breaking into whole parts, so that the reuse rate of resources is improved, and only 3 x 2 is required 4 (48) Map tiles can meet the requirements.
It should be noted that for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that the acts and modules referred to are not necessarily required in this application.
The above is a description of method embodiments, and the embodiments of the present application are further described below by way of apparatus embodiments.
Fig. 8 shows a structural diagram of an apparatus for implementing adjacent terrain transition effects at the same level in the embodiment of the present application. Referring to fig. 8, the apparatus for implementing the effect of the same-level adjacent terrain transition includes a first identification module 801, a movement module 802, a first traversal module 803, a first generation module 804 and a first replacement module 805.
A first identification module 801, configured to identify a terrain of each of the blocks forming the terrain map to be processed, and perform terrain identification on each of the blocks in the terrain map to be processed according to the terrain of the block, to obtain a first identification terrain map formed by the blocks with the terrain identification;
a moving module 802, configured to move up and down according to a first preset amount and move a preset grid left and right according to a second preset amount on the first identification topographic map, and segment the first identification topographic map through the grid; the size of the grid is the same as that of the first identification topographic map, the size of each sub-grid of the grid is the same as that of the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with that of the first identification topographic map;
a first traversal module 803 for traversing each of the sub-lattices of the mesh, finding the sub-lattices that comprise different terrain patches, obtaining a first area ratio between different terrains in the found sub-lattices;
the first generation module 804 is configured to set a preset first image block template corresponding to any area proportion according to any area proportion between different terrains, and construct a preset first image block template library; aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to a first area proportion, and processing different terrains in the first image block template to obtain a first transition image block;
a first replacing module 805, configured to replace all the found tiles in the sub-lattices with corresponding first transition tiles, so as to implement the same-level adjacent terrain transition.
In some embodiments, the apparatus further comprises: a partitioning module 806, a second identifying module 807, a second traversing module 808, a second generating module 809, and a second replacing module 810.
A dividing module 806, configured to divide different terrains according to heights of the terrains to obtain preset levels;
a second identification module 807, configured to perform hierarchical identification on each tile in the first identification topographic map according to the terrain of the tile and the preset hierarchy, so as to obtain a second identification topographic map composed of tiles with hierarchical identifications;
a second traversal module 808 configured to traverse each of the sub-lattices of the lattice, find the sub-lattices that include tiles identified at different levels, and obtain a second area ratio between different levels in the found sub-lattices;
a second generating module 809, configured to generate a second transition image block corresponding to the found sub-lattice according to the preset hierarchy, the first transition image block, the second area ratio, and a preset second image block template;
and a second replacement module 810, configured to replace all the found tiles in the sub-lattice with corresponding second transition tiles, so as to implement adjacent terrain transitions of different levels.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working process of the described module may refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
Fig. 9 shows a schematic structural diagram of an electronic device suitable for implementing embodiments of the present application. As shown in fig. 9, the electronic device 900 shown in fig. 9 includes: a processor 901 and a memory 903. The processor 901 is coupled to the memory 903. Optionally, the electronic device 900 may also include a transceiver 904. It should be noted that the transceiver 904 is not limited to one in practical applications, and the structure of the electronic device 900 is not limited to the embodiment of the present application.
The Processor 901 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein. The processor 901 may also be a combination of computing functions, e.g., comprising one or more microprocessors in combination, a DSP and a microprocessor in combination, or the like.
Bus 902 may include a path that transfers information between the above components. The bus 902 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 902 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 9, but that does not indicate only one bus or one type of bus.
The Memory 903 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
The memory 903 is used for storing application program codes for executing the scheme of the application, and the execution is controlled by the processor 901. The processor 901 is configured to execute application program code stored in the memory 903 to implement the content shown in the foregoing method embodiments.
Wherein, the electronic device includes but is not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
The embodiment of the present application provides a computer readable storage medium, on which a computer program is stored, and when the computer program runs on a computer, the computer is enabled to execute the corresponding content in the foregoing method embodiment. Compared with the prior art, in the embodiment of the application, the terrain of each image block forming the terrain map to be processed is firstly identified, and the terrain identification is carried out on each image block in the terrain map to be processed according to the terrain of the image block, so that a first identification terrain map formed by the image blocks with the terrain identification is obtained; moving the preset grids on the first identification topographic map up and down according to a first preset amount and moving the preset grids left and right according to a second preset amount, and segmenting the first identification topographic map through the grids; traversing each sub-lattice of the grid, finding the sub-lattices comprising different terrain image blocks, and obtaining a first area ratio between different terrains in the found sub-lattices; generating a first transition image block corresponding to the found sub-lattice according to the first area ratio and a preset first image block template; finally, replacing all the image blocks in the found sub lattices with corresponding first transition image blocks to realize adjacent terrain transition of the same level; based on the method, the first transition image block of the topographic map to be processed is generated, the material required by the topographic map to be processed can be subjected to the operation of breaking up the whole into parts, the reuse rate of resources is improved, the first transition image block of the topographic map to be processed is replaced into the topographic map to be processed, the adjacent topographic transitions in the same level can be realized on the premise of improving the reuse rate of resources, and the expression effect of the image block and the topographic shape in the topographic map to be processed is enhanced; the problem that the representation effect of the terrain and the required material quantity cannot meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks can be solved, and the effect that the representation effect of the terrain and the required material quantity meet the requirements of the user simultaneously in the current game for representing the terrain by using the image blocks is achieved.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a few embodiments of the present application and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present application, and that these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A method for realizing the transition effect of adjacent terrains at the same level is characterized by comprising the following steps:
identifying the terrain of each image block forming the terrain map to be processed, and carrying out terrain identification on each image block in the terrain map to be processed according to the terrain of the image block to obtain a first identification terrain map formed by the image blocks with terrain identifications;
moving a preset grid up and down according to a first preset amount and moving a preset grid left and right according to a second preset amount on the first identification topographic map, and segmenting the first identification topographic map through the grid; the size of the grid is the same as that of the first identification topographic map, each sub-grid of the grid is the same as the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with the first identification topographic map;
traversing each of the sub-lattices of the mesh, finding the sub-lattices comprising different terrain tiles, and obtaining a first area ratio between different terrains in the found sub-lattices;
setting a preset first pattern block template corresponding to any area ratio according to any area ratio among different terrains, and constructing a preset first pattern block template library; aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to a first area proportion, and processing different terrains in the first image block template to obtain a first transition image block;
and replacing all the found image blocks in the sub lattices with corresponding first transition image blocks to realize adjacent terrain transition at the same level.
2. The method of claim 1, wherein said obtaining a first area ratio between different terrains in the found sub-lattices comprises:
acquiring the first preset quantity and the second preset quantity;
and calculating a first area ratio between different terrains according to the first preset quantity and the second preset quantity.
3. The method of claim 1, wherein selecting a predetermined first tile template from a predetermined first tile template library according to the first area proportion, and processing different features in the first tile template to obtain a first transition tile, comprises:
selecting a preset first image block template according to the first area proportion;
and filling different terrains into the first image block template according to the first area ratio and the terrain identification of the image block to obtain a first transition image block.
4. The method according to claim 1, further comprising a flow of implementation of adjacent terrain transition effects of different levels:
dividing different terrains according to the height of the terrains to obtain preset levels;
carrying out hierarchical identification on each image block in the first identification topographic map according to the terrain of the image block and the preset hierarchy to obtain a second identification topographic map formed by the image blocks with hierarchical identification;
traversing each of said sub-lattices of said lattice, finding said sub-lattice comprising patches identified at different levels, obtaining a second area ratio between different levels in said found sub-lattice;
generating a second transition image block corresponding to the found sub-lattice according to the preset hierarchy, the first transition image block, the second area ratio and a preset second image block template;
and replacing all the found image blocks in the sub-lattices with corresponding second transition image blocks to realize adjacent terrain transition of different levels.
5. The method of claim 4, wherein obtaining a second area ratio between different levels in the found sub-lattice comprises:
acquiring the first preset quantity and the second preset quantity;
and calculating a second area ratio between different levels according to the first preset quantity and the second preset quantity.
6. The method as claimed in claim 4, wherein the generating a second transition tile corresponding to the found sub-lattice according to the preset level, the first transition tile, the second area ratio and a preset second tile template comprises:
selecting a second image block template of each level according to the second area ratio;
performing same-level equivalent replacement on the second image block template according to the first transition image block to obtain a level image block of each level;
and superposing the hierarchical image blocks of different hierarchies according to the preset hierarchy to obtain a second transition image block.
7. An apparatus for implementing adjacent terrain transition effect at the same level, comprising:
the first identification module is used for identifying the terrain of each image block forming the terrain map to be processed, carrying out terrain identification on each image block in the terrain map to be processed according to the terrain of the image block and obtaining a first identification terrain map formed by the image blocks with terrain identifications;
the moving module is used for moving the preset grids on the first identification topographic map up and down according to a first preset amount and moving the preset grids left and right according to a second preset amount, and segmenting the first identification topographic map through the grids; the size of the grid is the same as that of the first identification topographic map, each sub-grid of the grid is the same as the image blocks forming the first identification topographic map, and the initial position of the grid is completely coincided with the first identification topographic map;
a first traversal module for traversing each of said sub-lattices of said mesh, finding said sub-lattices that comprise different terrain patches, obtaining a first area ratio between different terrains in said found sub-lattices;
the first generation module is used for setting a preset first image block template corresponding to any area ratio according to any area ratio among different terrains and constructing a preset first image block template library; aiming at the image blocks in one sub-lattice, selecting a preset first image block template from a preset first image block template library according to a first area proportion, and processing different terrains in the first image block template to obtain a first transition image block;
and the first replacement module is used for replacing all the found image blocks in the sub-lattices with corresponding first transition image blocks to realize adjacent terrain transition at the same level.
8. The apparatus of claim 7, further comprising:
the dividing module is used for dividing different terrains according to the height of the terrains to obtain preset levels;
the second identification module is used for carrying out hierarchy identification on each image block in the first identification topographic map according to the terrain of the image block and the preset hierarchy to obtain a second identification topographic map formed by the image blocks with hierarchy identification;
a second traversal module for traversing each of the sub-lattices of the lattice, finding the sub-lattices that include tiles identified at different levels, and obtaining a second area ratio between different levels in the found sub-lattices;
a second generation module, configured to generate a second transition image block corresponding to the found sub-lattice according to the preset level, the first transition image block, the second area proportion, and a preset second image block template;
and the second replacement module is used for replacing all the found image blocks in the sub-lattices with corresponding second transition image blocks to realize adjacent terrain transition of different levels.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, wherein the processor, when executing the computer program, implements the method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202111667803.9A 2021-12-30 2021-12-30 Method and device for realizing same-level adjacent terrain transition effect Active CN114332397B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111667803.9A CN114332397B (en) 2021-12-30 2021-12-30 Method and device for realizing same-level adjacent terrain transition effect

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111667803.9A CN114332397B (en) 2021-12-30 2021-12-30 Method and device for realizing same-level adjacent terrain transition effect

Publications (2)

Publication Number Publication Date
CN114332397A CN114332397A (en) 2022-04-12
CN114332397B true CN114332397B (en) 2022-10-28

Family

ID=81020581

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111667803.9A Active CN114332397B (en) 2021-12-30 2021-12-30 Method and device for realizing same-level adjacent terrain transition effect

Country Status (1)

Country Link
CN (1) CN114332397B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077090A (en) * 2013-03-25 2014-10-01 北京发现角科技有限公司 Particle system based on gravity sensing and sound-based control of injection rate and method
CN106204735A (en) * 2016-07-18 2016-12-07 中国人民解放军理工大学 Unity3D terrain data using method in Direct3D 11 environment
CN110559665A (en) * 2019-09-29 2019-12-13 珠海文景科技有限公司 Game map processing method and device, terminal device and storage medium
CN111915479A (en) * 2020-07-15 2020-11-10 北京字节跳动网络技术有限公司 Image processing method and device, electronic equipment and computer readable storage medium
CN113457137A (en) * 2021-06-30 2021-10-01 完美世界(北京)软件科技发展有限公司 Game scene generation method and device, computer equipment and readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10275923B2 (en) * 2016-02-09 2019-04-30 Google Llc Determining and presenting solar flux information
CN112345450B (en) * 2020-10-29 2023-10-13 钢研纳克检测技术股份有限公司 Method for identifying scanning area and determining scanning path of large-size irregular sample surface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077090A (en) * 2013-03-25 2014-10-01 北京发现角科技有限公司 Particle system based on gravity sensing and sound-based control of injection rate and method
CN106204735A (en) * 2016-07-18 2016-12-07 中国人民解放军理工大学 Unity3D terrain data using method in Direct3D 11 environment
CN110559665A (en) * 2019-09-29 2019-12-13 珠海文景科技有限公司 Game map processing method and device, terminal device and storage medium
CN111915479A (en) * 2020-07-15 2020-11-10 北京字节跳动网络技术有限公司 Image processing method and device, electronic equipment and computer readable storage medium
CN113457137A (en) * 2021-06-30 2021-10-01 完美世界(北京)软件科技发展有限公司 Game scene generation method and device, computer equipment and readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Level of detail optimization for real-time terrain;Wang shiyun;《2020 International Conference on Computer Engineering and Application》;20200529;295-298 *
保持边界的地形网格简化算法与组织格式;刘思江等;《计算机辅助设计与图形学学报》;20130115(第01期);74-80 *
基于二叉树和GPU的无缝地形场景渲染方法;曹巍等;《计算机应用》;20120901(第09期);2548-2552 *

Also Published As

Publication number Publication date
CN114332397A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
EP1754196B1 (en) Resource management for rule-based procedural terrain generation
KR101235538B1 (en) Rule-based procedural terrain generation
EP1754199B1 (en) Terrain editor tool for rule-based procedural terrain generation
JP2022024065A (en) Multi-resolution image system
KR102672603B1 (en) Map generation method and apparatus, electronic device, and computer storage media
CN108057245B (en) Map generation method and device, storage medium and terminal
CN111445576B (en) Map data acquisition method and device, storage medium and electronic device
Derzapf et al. River networks for instant procedural planets
KR20230061521A (en) Method and apparatus, storage medium, and electronic device for displaying a virtual picture of the earth's surface
CN109499067B (en) Terrain texture drawing method and device, electronic equipment and storage medium
CN114332397B (en) Method and device for realizing same-level adjacent terrain transition effect
CN114404984A (en) Data processing method and device for game scene, computer equipment and medium
CN114332396B (en) Method and device for realizing adjacent terrain transition effect of different levels
CN115952252B (en) Semantic tile data processing method and device based on dynamic rendering and electronic equipment
CN109827585B (en) Method for rapidly filling concave area in grid map
Maung et al. Applying formal picture languages to procedural content generation
CN108553902A (en) A kind of transform method of the multi-dimension material based on UE engines
CN117237503B (en) Geographic element data accelerated rendering and device
US20230298259A1 (en) Voxel-based approach for design models
US11620820B1 (en) Repetition reduction for real-time tile-based texture synthesis of aerial imagery
CN113181655B (en) Terrain construction method, terrain construction device, electronic equipment and storage medium
CN109325086B (en) Discrete geographic data archiving management method
CN109559376B (en) Three-dimensional terrain generation method and device
CN113856201A (en) Game landform creating method, system, storage medium and computing equipment
Raman et al. Efficient terrain triangulation and modification algorithms for game applications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant