A method, device, equipment and storage medium for generating height map

By generating multi-layer height maps and performing effective area expansion processing on them, the problem of unnatural grass distribution in the existing technology is solved, and the display effect of game scene animation is improved.

CN111870953BActive Publication Date: 2024-08-27SHANGHAI MIHOYO TIANMING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010722490.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-24
Publication Date
2024-08-27
Estimated Expiration
2040-07-24

AI Technical Summary

Technical Problem

In the existing game scene generation method, the height map based on the ground surface construction tool can only be brushed once in one position, resulting in an unnatural distribution of grass at different heights at the same horizontal position, affecting the display effect of the game screen.

Method used

By obtaining the element height information of scene elements in the target scene, generate multi-layer original height maps, perform effective area expansion processing on each layer height map, adjust the effective area in the height map, and generate a target height map to improve the animation display effect of grass. .

Benefits of technology

It realizes that grass can grow on the surface of any compliant object, improves the display effect of game scene animation, and solves the problem of unnatural grass distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111870953B
    Figure CN111870953B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a height map generation method, device, equipment and storage medium, the method comprising: obtaining element height information of scene elements in a target scene; generating multiple layers of original height maps based on the element height information, and determining the height map information of each layer of the original height maps; for at least one of the original height maps, performing effective area expansion processing on the original height map based on the height map information of the original height map to obtain a target height map. The height map generation method provided by the embodiment of the present invention improves the display effect of the scene picture by generating multiple layers of height maps, adjusting the effective area in the height map, and then rendering the surface details.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of image rendering technology, and in particular to a height map generation method, device, equipment and storage medium. Background Art

[0002] With the development of network technology, people have higher and higher requirements for the experience of game screens in games. For example, during the game process, the display effect of the game screen will affect the user's gaming experience.

[0003] In the current generation of game scenes, the height map in the terrain construction tool (terrain) is generally used to store height information to represent the distribution information of grass, and the grass animation in the game scene is generated based on the height map in the terrain. However, due to the characteristics of the terrain, the terrain can only be refreshed once at one location, resulting in only one place where grass can grow at different heights at the same horizontal position (such as the upper and lower sides of a cliff), and the display effect of the game screen is poor. Summary of the invention

[0004] The embodiments of the present invention provide a height map generation method, device, equipment and storage medium to improve the display effect of scene animation.

[0005] In a first aspect, an embodiment of the present invention provides a method for generating a height map, comprising:

[0006] Get the element height information of the scene element in the target scene;

[0007] Generate multiple layers of original height maps based on element height information, and determine height map information of each layer of original height maps;

[0008] For at least one original height map, effective area dilation processing is performed on the original height map based on height map information of the original height map to obtain a target height map.

[0009] In a second aspect, an embodiment of the present invention further provides a height map generating device, comprising:

[0010] An element height acquisition module is used to obtain element height information of scene elements in the target scene;

[0011] The original height map generation module is used to generate multiple layers of original height maps based on element height information, and determine the height map information of each layer of the original height map;

[0012] The height map area processing module is used to perform effective area expansion processing on at least one original height map based on the height map information of the original height map to obtain a target height map.

[0013] In a third aspect, an embodiment of the present invention further provides a computer device, the device comprising:

[0014] one or more processors;

[0015] A storage device for storing one or more programs

[0016] When one or more programs are executed by one or more processors, the one or more processors implement the height map generation method provided by any embodiment of the present invention.

[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a height map generation method as provided in any embodiment of the present invention.

[0018] The embodiment of the present invention obtains element height information of scene elements in a target scene; generates multiple layers of original height maps based on the element height information, and determines the height map information of each layer of the original height map; for at least one original height map, performs effective area expansion processing on the original height map based on the height map information of the original height map to obtain a target height map, generates multiple layers of height maps, adjusts the effective area in the height map, and then renders the surface details, thereby improving the display effect of the scene picture. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of a method for generating a height map provided in Embodiment 1 of the present invention;

[0020] Figure 2a is a flow chart of a method for generating a height map provided in Embodiment 2 of the present invention;

[0021] Figure 2b This is a schematic diagram of adjusting pixels to be processed provided by the second embodiment of the present invention;

[0022] Figure 3 is a structural schematic diagram of a height map generating device provided by Embodiment 3 of the present invention;

[0023] Figure 4 It is a structural diagram of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0024] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0025] Embodiment 1

[0026] Figure 1 1 is a flow chart of a method for generating a height map provided by the first embodiment of the present invention. This embodiment is applicable to the case of generating a height map, and is particularly applicable to the case of generating a height map of grass in a game scene. The method can be executed by a height map generating device, and the height map generating device can be implemented in software and / or hardware. For example, the height map generating device can be configured in a computer device. Figure 1 As shown, the method includes:

[0027] S110: Obtain element height information of scene elements in the target scene.

[0028] In this embodiment, the target scene may be a scene where grass needs to be rendered. It is understandable that the terrain in the game scene is constructed based on models. Multiple models are fused to form the terrain effect in the game scene. In this embodiment, in order to improve the display effect of grass so that grass can grow on the surface of any compliant object, a layer of height map in the terrain is no longer used to render the grass. Instead, the height information of the grass is determined based on the object where the grass grows, and a multi-layer height map is constructed based on the height information of the grass, so that the corresponding grass animation can be rendered at the corresponding position of each layer.

[0029] Optionally, scene elements refer to elements that need to be rendered in the scene. In the present embodiment, the original scene elements are grass elements in the scene. Optionally, the height information of each layer of grass that needs to be rendered can be obtained through a height acquisition tool. It is understandable that grass needs to be rendered on the surface of the object. Therefore, the height information of the object that needs to grow grass can be detected by ray detection as the height information of the grass. In one embodiment, obtaining the element height information of the scene elements in the target scene includes: obtaining the scene model of the target scene, performing ray detection on the scene model using a ray detection method, and obtaining the height information of each layer of scene elements. Optionally, the scene that needs to render the scene elements can be used as the target scene, the scene model of the target scene is obtained, ray detection is used on the scene model from top to bottom, and the height information of the object is determined by using the collision point generated by the collision of the ray and the collision body, thereby obtaining the height information of the grass as the element height information.

[0030] In one embodiment, the density of ray detection can also be set according to the size of the object. When performing ray detection, ray detection is performed on the scene model from top to bottom according to the set density information, and the height information of the collision point of the ray is obtained, and the height information of the collision point is used as the height information of the grass. The density of ray detection can be set according to the actual size of the object. Exemplarily, the density information can be set to 1×1 units, that is, ray detection is performed on the scene model from top to bottom with a density of 1x1 units in the scene.

[0031] S120 , generating multiple layers of original height maps based on the element height information, and determining height map information of each layer of the original height map.

[0032] In this embodiment, the scene elements are divided into multiple layers according to the element height information of the scene elements, and for each layer of scene elements, an original height map corresponding to the scene elements of the layer is constructed, and the height map information of each layer of the original height map is determined. The height map information of each layer of the original height map includes the range information and height information of the layer.

[0033] In one embodiment, if the element height information is obtained based on ray detection, the scene elements can be divided into multiple layers according to the object identification of the object to which the ray detection collision point belongs, and the collision points with the same object identification are divided into the same layer. Specifically, after obtaining the collision point, the height information of the collision point and the object identification of the object to which the collision point belongs are obtained, and the collision points belonging to the same object (i.e., the object identification of the objects to which they belong is the same) are divided into one category, and a layer of height map is generated as collision points of the same category.

[0034] S130 . For at least one original height map, perform effective area dilation processing on the original height map based on height map information of the original height map to obtain a target height map.

[0035] In the present embodiment, the number of layers of the height map may affect the rendering effect of the scene elements in the scene picture rendered based on the height map. If a continuous layer of height map is used, some edges will not be invalid values, and the rendering effect of the scene elements in the scene picture will not be affected. In the present embodiment, a multi-layer height map is used. The scheme of rendering scene elements based on the multi-layer height map will cause some edges in the height map to be invalid values, such as the height map on the trarain stone, where there will be invalid values ​​(i.e., the gray value is 0). In addition, the method of linear interpolation when sampling the height map will cause the values ​​of the edge of the height map to be affected by the invalid values ​​around it, affecting the display effect of the scene animation. Exemplarily, if a pixel with a gray value of 100 is generated based on gray value 0 and gray value 200 by a linear interpolation algorithm when sampling the height map, the obtained height value will be low, which is manifested as grass stretching downward in the scene animation, and the display effect is poor.

[0036] In this embodiment, the technical problem of poor rendering effect of scene elements (such as grass elements) in the scene picture caused by the above reasons is solved by adjusting the effective area in the height map. For at least one of the original height maps generated, the effective area in the original height map is adjusted, and the effective area in the original height map is expanded outward to obtain a target height map, and the scene picture is rendered based on the target height map, which solves the problem of grass stretching at the effective area boundary. Optionally, an effective area expansion process can be performed for each original height map to ensure the display effect of the scene animation, or the original height map corresponding to the set object can be screened out according to the characteristics of the object, and the effective area expansion process is performed on the screened original height map to simplify the calculation amount and improve processing efficiency. Exemplarily, there will be an invalid area on the height map on the tarrain stone, so the original height map corresponding to the tarrain stone can be screened out, and the effective area expansion process is performed on the corresponding original height map to obtain the target height map.

[0037] In one embodiment of the present invention, the original height map is subjected to regional expansion processing based on the height map information of the original height map to obtain a target height map, including: traversing each pixel point in the original height map, taking the currently traversed pixel point as the pixel point to be processed, and judging whether the area corresponding to the pixel point to be processed is an invalid area; if the corresponding position of the pixel point to be processed is an invalid area, obtaining the auxiliary pixel point corresponding to the pixel point to be processed, and adjusting the original grayscale value of the pixel point to be processed based on the auxiliary pixel point, until all the pixels are traversed to obtain the target height map. Optionally, the effective area expansion processing of the original height map can be: traversing each pixel point in the original height map, taking the current pixel point as the pixel point to be processed, and when the corresponding position of the pixel point to be processed is an invalid area, adjusting the original grayscale value of the pixel point to be processed based on the auxiliary pixel point corresponding to the pixel point to be processed, so that the corresponding position of the pixel point to be processed is adjusted to a valid area, until all the pixels are traversed to obtain the target height map. By adjusting the invalid area in the original height map to a valid area in the above manner, the valid area range in the original height map is expanded, and the correctness of the interpolation sampling based on the height map is ensured, thereby improving the display effect of the scene elements in the scene picture. Among them, the auxiliary pixel points corresponding to the pixel points to be processed can be determined according to a pre-set association relationship. Adjusting the original grayscale value of the pixel points to be processed based on the auxiliary pixel points corresponding to the pixel points to be processed can be to adjust the original grayscale value based on the auxiliary grayscale value corresponding to the auxiliary pixel points. Exemplarily, the adjustment value corresponding to the original grayscale value can be calculated based on the auxiliary grayscale value through effective mathematical operations. Among them, effective mathematical operations can be operations such as addition, subtraction, multiplication, and division.

[0038] The embodiment of the present invention obtains element height information of scene elements in a target scene; generates multiple layers of original height maps based on the element height information, and determines the height map information of each layer of the original height map; for at least one original height map, performs effective area expansion processing on the original height map based on the height map information of the original height map to obtain a target height map, generates multiple layers of height maps, adjusts the effective area in the height map, and then renders the scene elements, thereby improving the display effect of the scene picture.

[0039] On the basis of the above scheme, it also includes: obtaining the rendering parameters corresponding to each target height map, constructing the corresponding relationship between the rendering parameters and the target height map; rendering the scene elements (such as grass elements) and displaying them according to the target height map and the rendering parameters associated with the target height map. Optionally, after generating multiple layers of target height maps, the rendering parameters corresponding to each layer of the target height map, such as color information, density information, direction information, etc., can be obtained, and the target height map can be associated with the rendering parameters so that the corresponding scene animation can be generated based on the rendering parameters and the target height map. Among them, the color information is used to represent the color of the target scene element, the density information is used to represent the density of the target scene element, and the direction information is used to represent the growth direction of the target scene element. In addition, the lighting and shadow parameters of the grass can also be calculated according to the direction information, and the shadow of the grass can be generated according to the lighting and shadow parameters. Specifically, the scene animation can be generated according to the rendering parameters associated with the target height map and the target height map, and the growth direction of the grass can be determined according to the direction information and the lighting and shadow parameters can be calculated, the shadow of the grass can be determined according to the lighting and shadow parameters, the color of the grass can be determined according to the color information, and the density of the grass can be determined according to the density information, and the shadow, direction, color, density and other information of the grass can be integrated to generate a scene animation containing grass. By generating animations of places at the same horizontal position and different heights based on multi-layer target height maps, the display effect of scene animation is improved.

[0040] Embodiment 2

[0041] Figure 2a 1 is a flow chart of a method for generating a height map provided by the second embodiment of the present invention. This embodiment is further optimized on the basis of the above embodiment. Figure 2a As shown, the method includes:

[0042] S210: Obtain element height information of scene elements in the target scene.

[0043] S220 , generating multiple layers of original height maps based on the element height information, and determining height map information of each layer of the original height map.

[0044] S230: For at least one original height map, traverse each pixel point in the original height map, and use the currently traversed pixel point as a pixel point to be processed.

[0045] S240, obtaining the original grayscale value of the pixel to be processed.

[0046] S250: If the original grayscale value is 0, determine that the area corresponding to the pixel to be processed is an invalid area.

[0047] S260: If the original gray value is not 0, determine that the area corresponding to the pixel to be processed is not an invalid area, continue traversing, and take the next pixel as the pixel to be processed.

[0048] Optionally, the original grayscale value of the pixel to be processed represents the height value of the scene element at that location, so whether the area corresponding to the pixel to be processed is an invalid area can be determined based on the original grayscale value of the pixel to be processed. When the original grayscale value of the pixel to be processed is 0, it indicates that the area corresponding to the pixel to be processed is an invalid area; when the original grayscale value of the pixel to be processed is not 0, it indicates that the area corresponding to the pixel to be processed is not an invalid area. When the pixel to be processed is an invalid area, execute S260; when the pixel to be processed is not an invalid area, continue traversing, take the next pixel as the pixel to be processed, and return to execute S240.

[0049] S270: If the position corresponding to the pixel to be processed is an invalid area, set the pixel points in the neighborhood of the pixel to be processed as auxiliary pixel points.

[0050] When the position corresponding to the pixel to be processed is an invalid area, the auxiliary pixel corresponding to the pixel to be processed can be obtained according to the pre-set area. Optionally, the pixel within the neighborhood of the pixel to be processed can be pre-set as the auxiliary pixel, such as the pixel within the eight neighborhoods of the pixel to be processed as the auxiliary pixel, or the pixel within the four neighborhoods of the pixel to be processed as the auxiliary pixel, etc.

[0051] S270, obtaining the auxiliary grayscale value corresponding to the auxiliary pixel point, adjusting the original grayscale value corresponding to the pixel point to be processed based on the auxiliary grayscale value, and obtaining the target grayscale value corresponding to the pixel point to be processed, until all the pixels are traversed to obtain the target height map.

[0052] In this embodiment, after the auxiliary pixel is determined, the target grayscale value of the pixel to be processed is calculated based on the auxiliary grayscale value of the auxiliary pixel.

[0053] In one embodiment, the original grayscale value corresponding to the pixel to be processed is adjusted based on the auxiliary grayscale value to obtain the target grayscale value corresponding to the pixel to be processed, including: taking the mean of the auxiliary grayscale values ​​as the target grayscale value. Optionally, the average value of the auxiliary grayscale values ​​can be directly taken as the target grayscale value of the pixel to be processed, and the area corresponding to the pixel to be processed is changed into a valid area. Exemplarily, taking the auxiliary pixel as a pixel within the 8 neighborhood of the pixel to be processed as an example, assuming that the auxiliary grayscale values ​​corresponding to the auxiliary pixel are: 0, 0, 0, 0.7, 0, 1, 0.8, 0.7, respectively, then taking the average of the above auxiliary grayscale values ​​to obtain a target grayscale value of 0.4, then 0.4 is used as the target grayscale value corresponding to the pixel to be processed.

[0054] In another embodiment, the original grayscale value corresponding to the pixel to be processed is adjusted based on the auxiliary grayscale value to obtain the target grayscale value corresponding to the pixel to be processed, including: obtaining the effective grayscale value in the auxiliary grayscale value, and taking the mean of the effective grayscale values ​​as the target grayscale value. Optionally, the average value of the effective grayscale values ​​in the auxiliary grayscale value can be directly taken as the target grayscale value of the pixel to be processed, and the area corresponding to the pixel to be processed is changed into a valid area. Among them, the effective grayscale value refers to the auxiliary grayscale value whose grayscale value is not 0. Taking the mean of the effective grayscale values ​​as the target grayscale value makes the target grayscale value closer to the grayscale value of the effective area, so that the display effect of the original height map after the expansion of the effective area is better. Still taking the auxiliary pixel as a pixel within the 8-neighborhood of the pixel to be processed as an example, assuming that the auxiliary grayscale values ​​corresponding to the auxiliary pixel points are: 0, 0, 0, 0.7, 0, 1, 0.8, 0.7, then the valid grayscale values ​​in the above amplitude grayscale values ​​are: 0.7, 1, 0.8, 0.7. The average of the above valid grayscale values ​​is 0.8, then 0.8 is used as the target grayscale value corresponding to the pixel to be processed.

[0055] Figure 2b This is a schematic diagram of adjusting pixels to be processed provided in the second embodiment of the present invention. Figure 2b The left side in the middle is the original height map, and the circular area in the original height map represents the pixels to be processed; Figure 2b The first table from left to right in the figure shows the grayscale values ​​of the pixels to be processed and the auxiliary pixels before the pixels to be processed are adjusted. The center position is the original grayscale value of the pixel to be processed, and the grayscale values ​​outside the center position are the auxiliary grayscale values ​​of the auxiliary pixels. Figure 2b It can be seen that the original grayscale value of the pixel to be processed is 0, and the auxiliary grayscale values ​​corresponding to the auxiliary pixels are: 0, 0, 0, 0.7, 0, 1, 0.8, 0.7; Figure 2b The second table from left to right in the figure shows the grayscale values ​​of the pixels to be processed and the auxiliary pixels after the pixels to be processed are adjusted. The center position is the target grayscale value 0.8 of the pixels to be processed after adjustment, and the grayscale values ​​outside the center position are the auxiliary grayscale values ​​of the auxiliary pixels. Figure 2b The target grayscale value of the pixel to be processed is obtained by averaging the valid grayscale values ​​in the auxiliary grayscale values.

[0056] Based on the above embodiments, the embodiment of the present invention concretizes the effective area expansion processing of the original height map. When the original grayscale value of the pixel point in the original height map is 0, the target grayscale value of the pixel point is calculated based on the grayscale values ​​of the auxiliary pixels around the pixel point, so that the area corresponding to the pixel point becomes the effective area, and the expansion of the effective area in the original height map is more reasonable, so that the display effect of the original height map after the effective area expansion is better.

[0057] Embodiment 3

[0058] Figure 3 Schematic diagram of the structure of a height map generating device provided by the third embodiment of the present invention. The height map generating device can be implemented in software and / or hardware, for example, the height map generating device can be configured in a computer device. Figure 3 As shown, the device includes an element height acquisition module 310, an original height map generation module 320 and a height map area processing module 330, wherein:

[0059] The element height acquisition module 310 is used to acquire element height information of scene elements in the target scene;

[0060] The original height map generation module 320 is used to generate multiple layers of original height maps based on the element height information, and determine the height map information of each layer of the original height map;

[0061] The height map region processing module 330 is used to perform effective region dilation processing on at least one original height map based on the height map information of the original height map to obtain a target height map.

[0062] The embodiment of the present invention obtains element height information of scene elements in the target scene through an element height acquisition module; the original height map generation module generates multiple layers of original height maps based on the element height information, and determines the height map information of each layer of the original height map; the height map area processing module performs effective area expansion processing on the original height map based on the height map information of the original height map for at least one original height map to obtain a target height map, and by generating multiple layers of height maps, adjusting the effective area in the height map, and then rendering the surface details, the display effect of the scene picture is improved.

[0063] Optionally, based on the above solution, the height map area processing module 330 includes:

[0064] The invalid area judgment unit is used to traverse each pixel point in the original height map, take the currently traversed pixel point as the pixel point to be processed, and judge whether the area corresponding to the pixel point to be processed is an invalid area;

[0065] The original grayscale value adjustment unit is used to obtain the auxiliary pixel point corresponding to the pixel point to be processed if the corresponding position of the pixel point to be processed is an invalid area, and adjust the original grayscale value of the pixel point to be processed based on the auxiliary pixel point until all pixels are traversed to obtain the target height map.

[0066] Optionally, based on the above solution, the invalid area determination unit is specifically used for:

[0067] Get the original grayscale value of the pixel to be processed;

[0068] If the original gray value is 0, the area corresponding to the pixel to be processed is determined to be an invalid area;

[0069] If the original gray value is not 0, it is determined that the area corresponding to the pixel to be processed is not an invalid area, and the traversal continues, and the next pixel is used as the pixel to be processed.

[0070] Optionally, based on the above solution, the original gray value adjustment unit is specifically used for:

[0071] The pixels in the neighborhood of the pixel to be processed are set as auxiliary pixels.

[0072] Optionally, based on the above solution, the original gray value adjustment unit is specifically used for:

[0073] The auxiliary grayscale value corresponding to the auxiliary pixel is obtained, and the original grayscale value corresponding to the pixel to be processed is adjusted based on the auxiliary grayscale value to obtain the target grayscale value corresponding to the pixel to be processed.

[0074] Optionally, based on the above solution, the original gray value adjustment unit is specifically used for:

[0075] The mean of the auxiliary grayscale values ​​is taken as the target grayscale value.

[0076] Optionally, based on the above solution, the original gray value adjustment unit is specifically used for:

[0077] Get the valid grayscale values ​​in the auxiliary grayscale values, and take the mean of the valid grayscale values ​​as the target grayscale value.

[0078] The height map generation device provided in the embodiment of the present invention can execute the height map generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0079] Embodiment 4

[0080] Figure 4 It is a structural diagram of a computer device provided in Embodiment 4 of the present invention. Figure 4 A block diagram of an exemplary computer device 412 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The computer device 412 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0081] like Figure 4 As shown, the computer device 412 is in the form of a general-purpose computing device. The components of the computer device 412 may include, but are not limited to: one or more processors 416, a system memory 428, and a bus 418 that connects different system components (including the system memory 428 and the processor 416).

[0082] Bus 418 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a local bus to processor 416, or a bus structure using any of a variety of bus architectures. These architectures include, by way of example, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0083] The computer device 412 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 412, including volatile and non-volatile media, removable and non-removable media.

[0084] System memory 428 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 430 and / or cache memory 432. Computer device 412 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage device 434 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 418 via one or more data medium interfaces. The memory 428 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0085] A program / utility 440 having a set (at least one) of program modules 442 may be stored, for example, in memory 428, such program modules 442 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 442 generally perform the functions and / or methods of the embodiments described herein.

[0086] The computer device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 424, etc.), may also communicate with one or more devices that enable a user to interact with the computer device 412, and / or communicate with any device that enables the computer device 412 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via input / output (I / O) interface 422. Furthermore, the computer device 412 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) via network adapter 420. As shown, the network adapter 420 communicates with other modules of the computer device 412 via bus 418. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0087] The processor 416 executes various functional applications and data processing by running the program stored in the system memory 428, for example, implementing the height map generation method provided in the embodiment of the present invention, which includes:

[0088] Get the element height information of the scene element in the target scene;

[0089] Generate multiple layers of original height maps based on element height information, and determine height map information of each layer of original height maps;

[0090] For at least one original height map, effective area dilation processing is performed on the original height map based on height map information of the original height map to obtain a target height map.

[0091] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the height map generation method provided by any embodiment of the present invention.

[0092] Embodiment 5

[0093] Embodiment 5 of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the height map generation method provided in the embodiment of the present invention is implemented. The method includes:

[0094] Get the element height information of the scene element in the target scene;

[0095] Generate multiple layers of original height maps based on element height information, and determine height map information of each layer of original height maps;

[0096] For at least one original height map, effective area dilation processing is performed on the original height map based on height map information of the original height map to obtain a target height map.

[0097] Of course, the computer-readable storage medium provided by an embodiment of the present invention stores a computer program which is not limited to the above method operations, but can also perform related operations of the height map generation method provided by any embodiment of the present invention.

[0098] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0099] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0100] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0101] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0102] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for generating a height map, characterized in that: include: Get the element height information of the scene element in the target scene; Generate multiple layers of original height maps based on the element height information, and determine height map information of each layer of the original height map; For at least one of the original height maps, performing effective area expansion processing on the original height map based on the height map information of the original height map to obtain a target height map; The step of performing regional expansion processing on the original height map based on the height map information of the original height map to obtain a target height map includes: Traversing each pixel point in the original height map, taking the currently traversed pixel point as the pixel point to be processed, and determining whether the area corresponding to the pixel point to be processed is an invalid area; If the position corresponding to the pixel to be processed is an invalid area, the auxiliary pixel corresponding to the pixel to be processed is obtained, and the original grayscale value of the pixel to be processed is adjusted based on the auxiliary pixel until all the pixels are traversed to obtain the target height map.

2. The method according to claim 1, characterized in that: The determining whether the area corresponding to the pixel to be processed is an invalid area includes: Obtaining the original grayscale value of the pixel to be processed; If the original grayscale value is 0, the area corresponding to the pixel to be processed is determined to be an invalid area; If the original grayscale value is not 0, it is determined that the area corresponding to the pixel to be processed is not an invalid area, and the traversal continues, and the next pixel is used as the pixel to be processed.

3. The method according to claim 1, characterized in that The obtaining of the auxiliary pixel point corresponding to the pixel point to be processed includes: The pixel points in the neighborhood of the pixel point to be processed are set as the auxiliary pixel points.

4. The method according to claim 1, characterized in that: The adjusting the pixel to be processed based on the auxiliary pixel includes: An auxiliary grayscale value corresponding to the auxiliary pixel is obtained, and an original grayscale value corresponding to the pixel to be processed is adjusted based on the auxiliary grayscale value to obtain a target grayscale value corresponding to the pixel to be processed.

5. The method according to claim 4, characterized in that The adjusting the original grayscale value corresponding to the pixel to be processed based on the auxiliary grayscale value to obtain the target grayscale value corresponding to the pixel to be processed includes: The mean value of the auxiliary grayscale values ​​is used as the target grayscale value.

6. The method according to claim 4, characterized in that The adjusting the original grayscale value corresponding to the pixel to be processed based on the auxiliary grayscale value to obtain the target grayscale value corresponding to the pixel to be processed includes: The effective grayscale values ​​in the auxiliary grayscale values ​​are obtained, and the average value of the effective grayscale values ​​is used as the target grayscale value.

7. A height map generating device, characterized in that: include: An element height acquisition module is used to obtain element height information of scene elements in the target scene; An original height map generation module, used to generate multiple layers of original height maps based on the element height information, and determine the height map information of each layer of the original height map; A height map area processing module, configured to perform effective area expansion processing on at least one of the original height maps based on the height map information of the original height map to obtain a target height map; The step of performing regional expansion processing on the original height map based on the height map information of the original height map to obtain a target height map includes: Traversing each pixel point in the original height map, taking the currently traversed pixel point as the pixel point to be processed, and determining whether the area corresponding to the pixel point to be processed is an invalid area; If the position corresponding to the pixel to be processed is an invalid area, the auxiliary pixel corresponding to the pixel to be processed is obtained, and the original grayscale value of the pixel to be processed is adjusted based on the auxiliary pixel until all the pixels are traversed to obtain the target height map.

8. A computer device, characterized in that: The device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the height map generation method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the height map generation method as described in any one of claims 1 to 6 is implemented.