CN116630555A - Terrain height map generation method and device and electronic equipment - Google Patents

Terrain height map generation method and device and electronic equipment Download PDF

Info

Publication number
CN116630555A
CN116630555A CN202310494584.1A CN202310494584A CN116630555A CN 116630555 A CN116630555 A CN 116630555A CN 202310494584 A CN202310494584 A CN 202310494584A CN 116630555 A CN116630555 A CN 116630555A
Authority
CN
China
Prior art keywords
target
terrain
map
updated
block
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.)
Pending
Application number
CN202310494584.1A
Other languages
Chinese (zh)
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202310494584.1A priority Critical patent/CN116630555A/en
Publication of CN116630555A publication Critical patent/CN116630555A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/10Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Remote Sensing (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method, a device and electronic equipment for generating a terrain elevation map, which are used for acquiring terrain parameters of a target terrain, generating an initial elevation map of the target terrain according to the terrain parameters, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.

Description

Terrain height map generation method and device and electronic equipment
Technical Field
The present invention relates to the field of computer graphics, and in particular, to a method and an apparatus for generating a topographic elevation map, and an electronic device.
Background
In game development, it is often necessary to use a height map of the terrain, and control the generation of the terrain in accordance with the height map program. In the related art, a topographic elevation map is usually generated by an artist through graphic processing software, and if a three-dimensional scene of a subsequent topography is updated, the artist is required to modify the entire topographic elevation map in graphic repair software. However, the modification process is complicated, especially when the local topographic elevation map is large, or the three-dimensional scene needs to be repeatedly modified, the topographic elevation map needs to be repeatedly modified, which is time-consuming and labor-consuming. In addition, the terrain elevation map needs to be enlarged to the pixel level at the time of modification, and the overall control of the terrain elevation map is determined at such a view angle, so that the modified terrain elevation map is poor in effect.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method, an apparatus, and an electronic device for generating a terrain elevation map, in which after a local terrain model is updated, a pre-generated basic block is modified to generate a terrain elevation map after updating the terrain, so as to avoid repeatedly modifying the terrain elevation map as a whole, improve the generating efficiency of the terrain elevation map, and improve the effect of the terrain elevation map.
In a first aspect, an embodiment of the present invention provides a method for generating a topographic elevation map, where the method includes: obtaining a terrain parameter of a target terrain, generating an initial height map of the target terrain according to the terrain parameter, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated.
In a second aspect, an embodiment of the present invention provides a device for generating a topographic elevation map, where the device includes: the determining module is used for obtaining the terrain parameters of the target terrain, generating an initial height map of the target terrain according to the terrain parameters, and determining a basic block of the target terrain; the modification module is used for modifying the appointed basic block according to the updated target topography to obtain a target block if the target topography is updated; the generating module is used for generating a target height map of the updated target terrain based on the target image block and the initial height map.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory stores computer executable instructions executable by the processor, where the processor executes the computer executable instructions to implement the method for generating a terrain elevation map according to any one of the first aspects.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement a method of generating a terrain elevation map of any one of the first aspects.
The embodiment of the invention has the following beneficial effects:
the invention provides a method, a device and electronic equipment for generating a terrain elevation map, which are used for acquiring terrain parameters of a target terrain, generating an initial elevation map of the target terrain according to the terrain parameters, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are some embodiments of the invention and that other drawings may be obtained from these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for generating a terrain elevation map according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a basic block according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another basic block provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram of a target height map according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a device for generating a topographic elevation map according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In current game development, it is generally necessary to use a height map of the terrain, and to program the generation of the terrain based on the height map. In the related art, a topographic elevation map is typically manually made by an artist through graphic processing software (such as Adobe Photoshop, abbreviated as "PS"), and if a three-dimensional scene of a subsequent topography is updated, the artist is required to manually modify the entire topographic elevation map in the image processing software. However, the modification process is complicated, especially when the local topographic elevation map is large, or the three-dimensional scene needs to be repeatedly modified, the topographic elevation map needs to be repeatedly modified, which is time-consuming and labor-consuming. In addition, the terrain elevation map needs to be enlarged to the pixel level at the time of modification, and the overall control of the terrain elevation map is determined at such a view angle, so that the modified terrain elevation map is poor in effect. Based on the above, the method, the device and the electronic equipment for generating the topographic elevation map provided by the embodiment of the invention can be applied to equipment with graphic processing functions such as notebooks and computers.
For the sake of understanding the present embodiment, first, a method for generating a topographic elevation map according to an embodiment of the present invention is described in detail, as shown in fig. 1, where the method includes the following steps:
step S102, obtaining a topographic parameter of a target topography, generating an initial height map of the target topography according to the topographic parameter, and determining a basic block of the target topography;
the target terrain may be a hill, a lake, etc. in a game scene, and the terrain parameters generally include a dimension parameter of the terrain, that is, a range of the terrain, and may further include altitude information of various positions in the terrain, etc. The dimensions of the initial height map generally correspond to the terrain range of the target terrain.
In one mode, the pixel color of each pixel point in the initial elevation map is used to indicate the terrain range of the target terrain. In another manner, the pixel color of each pixel point in the initial height map is used to indicate the height of the terrain, that is, the pixel color corresponds to the height information of the terrain. That is, the initial height map is used to represent the terrain size of the target terrain, or is used to represent the terrain size and the terrain height of the target terrain. Specifically, an initial elevation map of the target terrain is typically automatically generated in an engine that develops the game based on the terrain parameters.
The base tile is a height map having a specified size, wherein the size of the base tile is substantially smaller than the initial height map. The basic blocks can be obtained by dividing an initial height map, and can be automatically generated according to the topographic parameters or manually manufactured according to the topographic parameters. In summary, the base tiles are similar or identical to the partial areas in the initial height map.
Step S104, if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block;
typically, due to the update iterations of the game, it is necessary to modify the three-dimensional model in the game scene, i.e. the target terrain described above. If the target topography is changed, the initial altitude map needs to be modified according to the changed target topography, specifically, a designated basic block corresponding to the updated topography can be modified according to the updated target topography, for example, the designated position of the topography is updated from a right angle to a round angle, the basic block corresponding to the designated position can be modified, and the right angle in the basic block is modified to the round angle, so that the target block is obtained.
In one manner, if the base tile is partitioned from the initial altitude map, a designated base tile corresponding to the updated terrain may be obtained from the base tile based on the updated target terrain. Alternatively, if the base tile is determined based on terrain parameters, an area corresponding to the updated terrain may be determined from the initial elevation map based on the updated target terrain, and then a designated base tile similar to the area may be obtained from the base tile.
Step S106, generating a target height map of the updated target terrain based on the target block and the initial height map.
Specifically, the updated area in the initial altitude map can be directly replaced by a target image block, and a target altitude map of the updated target land block is generated; a target elevation map of the updated target terrain may also be generated from the base tiles and target tiles of the base tiles corresponding to the updated target terrain. Wherein the target height map is used to represent a terrain size of the updated target terrain or is used to represent a terrain size and a terrain height of the updated target terrain.
The embodiment of the invention provides a generation method of a topographic elevation map, which comprises the steps of obtaining topographic parameters of a target topography, generating an initial elevation map of the target topography according to the topographic parameters, and determining a basic block of the target topography; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.
The terrain parameter comprises a dimension parameter of the target terrain; a step of generating an initial elevation map of the target terrain from the terrain parameters, one possible implementation: generating an initial height map with a specified size according to the size parameter; the specified size has a corresponding relation with the size parameter.
Specifically, a height map of the specified size without content or without specified preset style is generated according to the size parameter. Wherein the dimensional parameter corresponds to a terrain range of the target terrain. Since the picture itself is composed of pixels, each pixel records R, G, B three channels of information, and the recorded data has a correspondence with the size and height information of the target topography. For example, a full blue plot of 10x10 size, with color channels all designated (0,0,255), i.e., the initial height plot described above, can be generated directly from the dimensional parameters. This color is typically used to represent the range of terrain.
Further, the terrain parameter further comprises altitude information of the target terrain; after the step of generating the initial height map of the specified size from the size parameter, the method further comprises: according to the height information, configuring the pixel colors of all pixel points of the initial height map; wherein, the pixel color and the height information have a corresponding relation.
Specifically, a plurality of different color values are generally preset for representing different height information. In this embodiment, after determining the initial height map corresponding to the size of the target terrain, the color value corresponding to the height information may be determined according to the height information of each position in the target terrain, the pixel point corresponding to the position is determined in the initial height map, and then the corresponding color value is set in the pixel point. For example, the height of each position in the target terrain is 20 meters, the color value corresponding to the 20 meters is determined to be (0, 100,255), and the color value of each pixel point is set to be (0,100,255) in the initial height map.
The step of determining a base map of the target terrain, as described above, may be another possible embodiment: dividing the initial height map to obtain a plurality of basic blocks of the target topography; wherein each base tile is a tile of a specified size.
The initial height map may be divided generally according to a specified size, which may be set in advance as needed. In this embodiment, a specified dimension may be set according to the size of a unit land block of the target terrain, and partition parameters of the initial height map may be configured, including a transverse partition parameter and a longitudinal partition parameter, which are set to x0 and y0, respectively, and the initial height map may be partitioned according to x0 and y0, where each x0 in the transverse direction and each y0 in the longitudinal direction are a grid, so as to generate a plurality of basic tiles.
In another possible embodiment: determining a basic block of the target terrain according to the terrain parameters; wherein, every basic block is the block of appointed size, and basic block includes at least: a tile of angular terrain, a tile of side terrain, a tile of L terrain, a solid-color tile.
The foundation tiles determined in the above manner include various shapes of the target terrain. Specifically, a base pattern block can be created according to the trend of the target terrain. In this embodiment, the height of each position in the target terrain is the same, and the terrain is illustrated as a cross shape, and an exemplary basic block of the target terrain is determined according to the terrain parameters, as shown in fig. 2, wherein an angular block corresponds to a block of the angular terrain, an edge block corresponds to a block of the edge terrain, a turning block corresponds to a block of the L-shaped terrain, and a solid block corresponds to the solid block. Where white represents the ground, grey represents the terrain, and the height of the terrain. If the height of each location in the target terrain is different and the shape of the terrain is different, the corresponding base tiles are also different.
It should be noted that if the height information of the target terrain is relatively small, the corresponding basic block may be automatically generated, and if the height information of the target terrain is relatively large, the artist is generally required to automatically generate the corresponding basic block. Of course, to save time, when the target terrain has more different altitude information, the corresponding base tiles may be generally determined directly by dividing the initial altitude map.
Further, after the step of determining a base tile of the target terrain, the method further comprises: dividing the initial height map according to the designated size to obtain a middle height map; wherein the middle height graph comprises a plurality of grids; position information of each lattice is determined.
Because the basic image blocks are not divided by the initial height map, the position information of each grid in the initial height map is divided in advance, so that the target image blocks and the basic image blocks can be spliced according to the correct position information.
The step of modifying the specified base block according to the updated target terrain to obtain the target block, which is one possible implementation manner: determining a designated basic block needing to be modified from the basic blocks according to the updated target terrain; and modifying the pixel color of each pixel point in the designated basic block according to the updated terrain parameters of the target terrain to obtain the target block.
Determining a terrain area where modification occurs according to the updated target terrain, determining a foundation block corresponding to the terrain area from the foundation blocks, and determining the foundation block as a designated foundation block needing modification; alternatively, a base tile similar to the terrain region is determined from the base tiles, and the base tile is determined as the designated base tile that needs modification.
The terrain size of the designated base pattern representation, as well as the terrain elevation, is then modified in accordance with the updated terrain parameters for the target plot. For example, the updated target terrain is a corner terrain, and the corner terrain is updated to be a circular terrain after updating, so that the block of the corner terrain can be modified to be a block of the circular terrain.
Illustratively, as shown in fig. 3, the base tile is edited (modified) as needed to obtain an edited base tile, i.e., the target tile.
Further, if the base tile is obtained by performing segmentation processing on the initial altitude map, the step of generating the updated target altitude map of the target terrain based on the target tile and the initial altitude map, which is a possible implementation manner: and replacing a designated basic block in the basic blocks of the initial height map segmentation with a target block, and performing splicing processing on the basic blocks and the target blocks of the initial height map segmentation after replacement to generate a target height map of the updated target terrain.
If the base tile is determined according to the terrain parameters of the target terrain, the step of generating the updated target altitude map of the target terrain based on the target tile and the initial altitude map, as described above, is a possible implementation: determining a target foundation block which does not need modification from the foundation blocks according to the updated target terrain; based on the target base tile, the target tile, and the initial altitude map, a target altitude map of the updated target terrain is generated.
Specifically, since the base tiles include various shapes of the target terrain, a target base tile corresponding to a terrain in which no update has occurred in the updated target terrain may be determined from the base tiles. And splicing the target basic image block and the target image block to corresponding positions according to the initial height map, and generating a target height map of the updated target terrain.
The step of generating the target height map of the updated target terrain based on the target base tile, the target tile, and the initial height map, is one possible implementation: determining first position information corresponding to a target block and second position information corresponding to a target basic block according to the position information of the grids divided by the initial height map; placing a corresponding target block in a grid corresponding to the first position information in the initial height map; placing a corresponding target basic block in a grid corresponding to second position information in the initial height map; and performing splicing processing on the target image block and the target base image block to generate a target height map of the updated target terrain.
For example, as shown in fig. 4, the target basic image block and the target image block are spliced together according to the corresponding position information to obtain a corresponding height map before splicing, and by performing the splicing process, a complete and seamless target height map, that is, a corresponding height map after splicing, can be derived.
In the above manner, a plurality of basic image blocks are generated in advance according to the target topography, then an initial height map with the same size as the target topography is generated, the initial height map is divided into a plurality of unit grids, the unit grids are the same as the basic image blocks in size, then corresponding appointed basic image blocks are selected from the basic image blocks according to the updated topography, the appointed basic image blocks are modified according to the updated topography to obtain target image blocks, then the image block level combined editing is performed through fine arts, and finally the target image blocks are spliced according to corresponding coordinates according to the corresponding relation between the unit grids and the target image blocks to obtain the target height map.
The invention is equivalent to freely editing the height map based on PS instead of editing the content of the image block and editing the combination of the image block and the image block, and has the advantages that the detail control of the pixel level is realized on the height map, the combination editing based on the image block is more efficient and labor-saving compared with the free editing of PS, and meanwhile, the effect of the height map also meets the requirement.
Corresponding to the above method embodiment, the embodiment of the present invention provides a device for generating a terrain elevation map, as shown in fig. 5, where the device includes:
A determining module 501, configured to obtain a terrain parameter of a target terrain, generate an initial altitude map of the target terrain according to the terrain parameter, and determine a base block of the target terrain;
the modifying module 502 is configured to modify the specified basic block according to the updated target terrain if the target terrain is updated, so as to obtain a target block;
a generating module 503 is configured to generate a target altitude map of the updated target terrain based on the target tile and the initial altitude map.
The embodiment of the invention provides a generating device of a terrain elevation map, which is used for acquiring terrain parameters of a target terrain, generating an initial elevation map of the target terrain according to the terrain parameters, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.
The determining module is further configured to: generating an initial height map with a specified size according to the size parameter; the specified size has a corresponding relation with the size parameter.
The terrain parameter further comprises altitude information of the target terrain; the above-mentioned determination module further includes a color configuration unit for: according to the height information, configuring the pixel colors of all pixel points of the initial height map; wherein, the pixel color and the height information have a corresponding relation.
The determining module is further configured to: dividing the initial height map to obtain a plurality of basic blocks of the target topography; wherein each base tile is a tile of a specified size.
The determining module is further configured to: determining a basic block of the target terrain according to the terrain parameters; wherein, every basic block is the block of appointed size, and basic block includes at least: a tile of angular terrain, a tile of side terrain, a tile of L terrain, a solid-color tile.
The device further comprises a dividing module for: dividing the initial height map according to the designated size to obtain a middle height map; wherein the middle height graph comprises a plurality of grids; position information of each lattice is determined.
The modification module is further configured to: determining a designated basic block needing to be modified from the basic blocks according to the updated target terrain; and modifying the pixel color of each pixel point in the designated basic block according to the updated terrain parameters of the target terrain to obtain the target block.
If the basic block is obtained by dividing the initial height map, the generating module is further configured to: and replacing a designated basic block in the basic blocks of the initial height map segmentation with a target block, and performing splicing processing on the basic blocks and the target blocks of the initial height map segmentation after replacement to generate a target height map of the updated target terrain.
The generation module is further configured to, if the base tile is determined from a terrain parameter of the target terrain: determining a target foundation block which does not need modification from the foundation blocks according to the updated target terrain; based on the target base tile, the target tile, and the initial altitude map, a target altitude map of the updated target terrain is generated.
The generation module is further used for: determining first position information corresponding to a target block and second position information corresponding to a target basic block according to the position information of the grids divided by the initial height map; placing a corresponding target block in a grid corresponding to the first position information in the initial height map; placing a corresponding target basic block in a grid corresponding to second position information in the initial height map; and performing splicing processing on the target image block and the target base image block to generate a target height map of the updated target terrain.
The generating device of the topographic elevation map provided by the embodiment of the invention has the same technical characteristics as the generating method of the topographic elevation map provided by the embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved.
The embodiment also provides an electronic device, including a processor and a memory, where the memory stores machine executable instructions executable by the processor, and the processor executes the machine executable instructions to implement the method for generating a terrain elevation map. The electronic device may be a server or a terminal device.
Referring to fig. 6, the electronic device includes a processor 100 and a memory 101, the memory 101 storing machine executable instructions executable by the processor 100, the processor 100 executing the machine executable instructions to implement the above-described method of generating a terrain elevation map.
Further, the electronic device shown in fig. 6 further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
The memory 101 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 103 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc. Bus 102 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 6, but not only one bus or type of bus.
The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 100 or by instructions in the form of software. The processor 100 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processor, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and, in combination with its hardware, performs the steps of the method of the previous embodiment.
The processor in the electronic device may implement the following operations in the method for generating a terrain elevation map by executing machine executable instructions:
obtaining a terrain parameter of a target terrain, generating an initial height map of the target terrain according to the terrain parameter, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.
The terrain parameter comprises a dimension parameter of the target terrain; a step of generating an initial elevation map of the target terrain from the terrain parameters, comprising: generating an initial height map with a specified size according to the size parameter; the specified size has a corresponding relation with the size parameter.
The terrain parameters also comprise the altitude information of the target terrain; after the step of generating the initial height map of the specified size according to the size parameter, the method further comprises: according to the height information, configuring the pixel colors of all pixel points of the initial height map; wherein, the pixel color and the height information have a corresponding relation.
The step of determining a base pattern of the target terrain includes: dividing the initial height map to obtain a plurality of basic blocks of the target topography; wherein each base tile is a tile of a specified size.
The step of determining a base pattern of the target terrain includes: determining a basic block of the target terrain according to the terrain parameters; wherein, every basic block is the block of appointed size, and basic block includes at least: a tile of angular terrain, a tile of side terrain, a tile of L terrain, a solid-color tile.
After the step of determining a base tile of the target terrain, the method further comprises: dividing the initial height map according to the designated size to obtain a middle height map; wherein the middle height graph comprises a plurality of grids; position information of each lattice is determined.
The step of modifying the specified basic block according to the updated target topography to obtain the target block includes: determining a designated basic block needing to be modified from the basic blocks according to the updated target terrain; and modifying the pixel color of each pixel point in the designated basic block according to the updated terrain parameters of the target terrain to obtain the target block.
If the basic image block is obtained by dividing the initial altitude map, generating a target altitude map of the updated target terrain based on the target image block and the initial altitude map, including: and replacing a designated basic block in the basic blocks of the initial height map segmentation with a target block, and performing splicing processing on the basic blocks and the target blocks of the initial height map segmentation after replacement to generate a target height map of the updated target terrain.
The step of generating a target height map of the updated target terrain based on the target tile and the initial height map if the base tile is determined according to the terrain parameters of the target terrain, includes: determining a target foundation block which does not need modification from the foundation blocks according to the updated target terrain; based on the target base tile, the target tile, and the initial altitude map, a target altitude map of the updated target terrain is generated.
The step of generating the target height map of the updated target terrain based on the target base block, the target block and the initial height map comprises the following steps: determining first position information corresponding to a target block and second position information corresponding to a target basic block according to the position information of the grids divided by the initial height map; placing a corresponding target block in a grid corresponding to the first position information in the initial height map; placing a corresponding target basic block in a grid corresponding to second position information in the initial height map; and performing splicing processing on the target image block and the target base image block to generate a target height map of the updated target terrain.
The present embodiment also provides a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the method of generating a terrain elevation map described above.
The machine-executable instructions stored on the machine-readable storage medium may implement the following operations in the method for generating a terrain elevation map:
obtaining a terrain parameter of a target terrain, generating an initial height map of the target terrain according to the terrain parameter, and determining a basic block of the target terrain; if the target topography is updated, modifying the designated basic block according to the updated target topography to obtain a target block; based on the target tile and the initial altitude map, a target altitude map of the updated target terrain is generated. In the mode, after the initial height map of the target terrain is generated, if the target terrain is updated, the updated terrain height map of the target terrain can be generated by modifying the pre-generated basic image blocks, so that the situation that the original height map is repeatedly modified by an art staff is avoided, the workload of the art staff is reduced, the generation efficiency of the terrain height map is improved, and meanwhile, the effect of the terrain height map is improved.
The terrain parameter comprises a dimension parameter of the target terrain; a step of generating an initial elevation map of the target terrain from the terrain parameters, comprising: generating an initial height map with a specified size according to the size parameter; the specified size has a corresponding relation with the size parameter.
The terrain parameters also comprise the altitude information of the target terrain; after the step of generating the initial height map of the specified size according to the size parameter, the method further comprises: according to the height information, configuring the pixel colors of all pixel points of the initial height map; wherein, the pixel color and the height information have a corresponding relation.
The step of determining a base pattern of the target terrain includes: dividing the initial height map to obtain a plurality of basic blocks of the target topography; wherein each base tile is a tile of a specified size.
The step of determining a base pattern of the target terrain includes: determining a basic block of the target terrain according to the terrain parameters; wherein, every basic block is the block of appointed size, and basic block includes at least: a tile of angular terrain, a tile of side terrain, a tile of L terrain, a solid-color tile.
After the step of determining a base tile of the target terrain, the method further comprises: dividing the initial height map according to the designated size to obtain a middle height map; wherein the middle height graph comprises a plurality of grids; position information of each lattice is determined.
The step of modifying the specified basic block according to the updated target topography to obtain the target block includes: determining a designated basic block needing to be modified from the basic blocks according to the updated target terrain; and modifying the pixel color of each pixel point in the designated basic block according to the updated terrain parameters of the target terrain to obtain the target block.
If the basic image block is obtained by dividing the initial altitude map, generating a target altitude map of the updated target terrain based on the target image block and the initial altitude map, including: and replacing a designated basic block in the basic blocks of the initial height map segmentation with a target block, and performing splicing processing on the basic blocks and the target blocks of the initial height map segmentation after replacement to generate a target height map of the updated target terrain.
The step of generating a target height map of the updated target terrain based on the target tile and the initial height map if the base tile is determined according to the terrain parameters of the target terrain, includes: determining a target foundation block which does not need modification from the foundation blocks according to the updated target terrain; based on the target base tile, the target tile, and the initial altitude map, a target altitude map of the updated target terrain is generated.
The step of generating the target height map of the updated target terrain based on the target base block, the target block and the initial height map comprises the following steps: determining first position information corresponding to a target block and second position information corresponding to a target basic block according to the position information of the grids divided by the initial height map; placing a corresponding target block in a grid corresponding to the first position information in the initial height map; placing a corresponding target basic block in a grid corresponding to second position information in the initial height map; and performing splicing processing on the target image block and the target base image block to generate a target height map of the updated target terrain.
The method, the device and the system for generating the topographic elevation map provided by the embodiment of the invention comprise a computer readable storage medium storing program codes, and the instructions included in the program codes can be used for executing the method described in the method embodiment, and specific implementation can be referred to the method embodiment and will not be repeated here.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In addition, in the description of embodiments of the present invention, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood by those skilled in the art in specific cases.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention for illustrating the technical solution of the present invention, but not for limiting the scope of the present invention, and although the present invention has been described in detail with reference to the foregoing examples, it will be understood by those skilled in the art that the present invention is not limited thereto: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (13)

1. A method for generating a terrain elevation map, the method comprising:
obtaining a topographic parameter of a target topography, generating an initial altitude map of the target topography according to the topographic parameter, and determining a basic block of the target topography;
if the target terrain is updated, modifying the designated basic block according to the updated target terrain to obtain a target block;
based on the target tile and the initial altitude map, an updated target altitude map of the target terrain is generated.
2. The method of claim 1, wherein the topographical parameters include dimensional parameters of the target topography;
generating an initial elevation map of the target terrain according to the terrain parameters, including:
generating an initial height map with a specified size according to the size parameter; wherein the specified size has a corresponding relationship with the size parameter.
3. The method of claim 2, wherein the terrain parameter further comprises altitude information of the target terrain;
after the step of generating an initial height map of a specified size from the size parameter, the method further comprises:
According to the height information, configuring pixel colors of all pixel points of the initial height map; wherein the pixel color has a correspondence with the height information.
4. The method of claim 1, wherein the step of determining a base tile of the target terrain comprises:
dividing the initial height map to obtain a plurality of basic blocks of the target terrain; wherein each of the base tiles is a tile of a specified size.
5. The method of claim 1, wherein the step of determining a base tile of the target terrain comprises:
determining a base block of the target terrain according to the terrain parameter; wherein each basic block is a block with a specified size, and the basic block at least comprises: a tile of angular terrain, a tile of side terrain, a tile of L terrain, a solid-color tile.
6. The method of claim 5, wherein after the step of determining a base tile of the target terrain, the method further comprises:
dividing the initial height map according to the specified size to obtain an intermediate height map; wherein the middle height map comprises a plurality of grids;
And determining the position information of each grid.
7. The method of claim 1, wherein modifying the designated base tile to obtain the target tile based on the updated target terrain comprises:
determining the designated basic block needing modification from the basic blocks according to the updated target terrain;
and modifying the pixel color of each pixel point in the appointed foundation block according to the updated topographic parameters of the target topography to obtain the target block.
8. The method of claim 1, wherein if the base tile is obtained by segmenting the initial height map, the step of generating an updated target height map of the target terrain based on the target tile and the initial height map comprises:
and replacing a designated basic block in the basic blocks of the initial height map segmentation with the target block, and performing splicing processing on the basic blocks of the initial height map segmentation after replacement and the target block to generate an updated target height map of the target terrain.
9. The method of claim 1, wherein if the base tile is determined from the terrain parameters of the target terrain, the step of generating an updated target elevation map of the target terrain based on the target tile and the initial elevation map comprises:
Determining a target foundation block without modification from the foundation blocks according to the updated target terrain;
based on the target base tile, the target tile, and the initial elevation map, an updated target elevation map of the target terrain is generated.
10. The method of claim 1, wherein generating an updated target elevation map of the target terrain based on the target base tile, the target tile, and the initial elevation map comprises:
determining first position information corresponding to the target image block and second position information corresponding to the target basic image block according to the position information of the grids divided by the initial height map;
placing the corresponding target tiles in grids corresponding to the first position information in the initial height map; placing the corresponding target basic block in a grid corresponding to the second position information in the initial height map;
and performing splicing processing on the target block and the target base block to generate an updated target height map of the target terrain.
11. A terrain elevation map generation apparatus, the apparatus comprising:
The determining module is used for obtaining the topographic parameters of the target topography, generating an initial altitude map of the target topography according to the topographic parameters, and determining a basic block of the target topography;
the modification module is used for modifying the designated basic block according to the updated target terrain to obtain a target block if the target terrain is updated;
and the generation module is used for generating an updated target altitude map of the target terrain based on the target image block and the initial altitude map.
12. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor to perform the method of generating a terrain elevation map as claimed in any one of claims 1 to 10.
13. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the method of generating a terrain elevation map according to any one of claims 1 to 10.
CN202310494584.1A 2023-04-28 2023-04-28 Terrain height map generation method and device and electronic equipment Pending CN116630555A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310494584.1A CN116630555A (en) 2023-04-28 2023-04-28 Terrain height map generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310494584.1A CN116630555A (en) 2023-04-28 2023-04-28 Terrain height map generation method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116630555A true CN116630555A (en) 2023-08-22

Family

ID=87596471

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310494584.1A Pending CN116630555A (en) 2023-04-28 2023-04-28 Terrain height map generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116630555A (en)

Similar Documents

Publication Publication Date Title
CN111583381B (en) Game resource map rendering method and device and electronic equipment
CN115641415B (en) Method, device, equipment and medium for generating three-dimensional scene based on satellite image
CN115797592B (en) Method and device for automatically generating building block based on oblique photography three-dimensional model
CN115906751A (en) Mask layout correction method
CN110866869B (en) Image mosaic method and device combining Thiessen polygon and minimum spanning tree image segmentation
CN111508054A (en) Terrain construction method, device and equipment
CN113034688B (en) Three-dimensional map model generation method and device
CN112233241B (en) Method and device for generating height map of virtual scene terrain and storage medium
CN110136262B (en) Water body virtual visualization method and device
CN116630555A (en) Terrain height map generation method and device and electronic equipment
CN115033972B (en) Method and system for unitizing building main body structures in batches and readable storage medium
JP2007256402A (en) Map data generating device
CN115170688A (en) Optimal projection plane solving and drawing automatic generation method for spatial structure construction drawing
CN114444185A (en) In-situ labeling identification method and device and electronic equipment
JPH0636013A (en) Method and device for generating topographic data
CN112419137A (en) Method and device for displaying mask picture and method and device for displaying mask picture
CN117036626A (en) Rendering method and device of three-dimensional terrain model and electronic equipment
CN115858519B (en) DEM leveling method and device
CN117392333A (en) Terrain data processing method and device and electronic equipment
CN112906572B (en) Identification method and identification device for vertical section in construction drawing
CN117557710B (en) Texture rendering method and device, terminal equipment and storage medium
CN115168112B (en) Method, device, equipment and medium for restoring section data under dynamic section change
CN113436306B (en) Image rendering method, device and storage medium
CN111127322B (en) Terrain illumination map joint processing method and device
CN117912016A (en) Document scanning method and device and electronic equipment

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