A method, device, equipment and storage medium for generating height map
By expanding the sampling area of the height map to obtain more information, the problem of inaccurate information at the height map boundary is solved, the rendering effect of the game scene is improved, and the quality of the picture display is enhanced.
Patent Information
- Application Number
- CN202010724145.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-24
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-07-24
AI Technical Summary
In game scene generation, inaccurate height information at the boundary of the height map leads to poor display effect of the game screen, especially cracks appear at the junction of multiple height maps.
By expanding the sampling area of the target height map, the coverage area is greater than the coverage area of the effective area, and more height information is obtained, so as to accurately interpolate sampling at the height map boundary to generate a more accurate height map.
It improves the rendering effect of the game scene, avoids poor screen display effect caused by inaccurate information at the boundary of the height map, and enhances the display quality of the scene.
Smart Images

Figure CN111870955B_ABST
Abstract
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 scene model is generally sampled to generate a height map, and then the height map is sampled to generate the game scene. However, when the game scene is generated through multiple height maps, since interpolation calculations are performed when sampling the height map, the height information obtained at the boundary of the height map is inaccurate, that is, the height information at the junction of two height maps connected in the horizontal direction is inaccurate, which may cause cracks in the scene elements rendered in the game scene corresponding to the junction of the height maps, that is, the display effect of the game screen is poor. Summary of the invention
[0004] Embodiments of the present invention provide a height map generation method, device, equipment and storage medium to improve the display effect of scene images.
[0005] In a first aspect, an embodiment of the present invention provides a method for generating a height map, comprising:
[0006] Determine a sampling area of the target height map based on the valid area of the target height map, wherein a coverage area of the sampling area is greater than a coverage area of the valid area;
[0007] Sample the scene model based on the sampling area to obtain the height information of the sampling points;
[0008] Generate a target height map based on the height information of each sampling point.
[0009] In a second aspect, an embodiment of the present invention further provides a height map generating device, comprising:
[0010] A sampling area determination module, used to determine a sampling area of a target height map based on a valid area of the target height map, wherein a coverage range of the sampling area is larger than a coverage range of the valid area;
[0011] A height information determination module is used to sample the scene model based on the sampling area and obtain the height information of the sampling point;
[0012] The target height map generation module is used to generate a target height map based on the height information of each sampling point.
[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 determines a sampling area of a target height map based on an effective area of the target height map, wherein the coverage of the sampling area is greater than the coverage of the effective area; samples a scene model based on the sampling area to obtain height information of the sampling points; generates a target height map based on the height information of each sampling point, and generates a height map whose sampling area is greater than the effective area by adjusting the sampling area for generating the height map, so that when the height map is interpolated and sampled in the rendering of a game scene process, accurate height information can be obtained at the boundary of the height map based on extended data outside the effective area contained in the height map, thereby avoiding the technical problem of poor game screen display effect caused by inaccurate height information at the boundary of the height map, and improving the display effect of the scene screen. 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 2 is a flow chart of a method for generating a height map provided in Embodiment 2 of the present invention;
[0021] Figure 3 is a structural schematic diagram of a height map generating device provided by Embodiment 3 of the present invention;
[0022] Figure 4 It is a structural diagram of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0023] 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.
[0024] Embodiment 1
[0025] Figure 1 1 is a flow chart of a method for generating a height map provided in the first embodiment of the present invention. This embodiment is applicable to the case of generating a height map. 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:
[0026] S110. Determine a sampling area of the target height map based on the valid area of the target height map, wherein a coverage range of the sampling area is larger than a coverage range of the valid area.
[0027] In this embodiment, the target height map can be understood as a height map to be generated. It can be understood that each height map corresponds to a certain valid area, and the valid area of the height map can be understood as the area effectively represented in the scene model corresponding to the height map. Exemplarily, a height map can correspond to a range of 128 meters × 128 meters in the game scene, and the corresponding range of 128 meters × 128 meters in the game scene is the valid range of the height map.
[0028] In general, the height map is generated based on the sampling data by sampling the scene model. The existing sampling range of the scene model corresponds to the effective range of the height map, that is, if it is necessary to generate a height map of area A (128 meters × 128 meters), the area A in the scene model is sampled, and the height map is generated based on the sampling data. However, since it is necessary to sample the height map and perform interpolation calculations when rendering the game scene to obtain height information, and render the game scene based on the height information obtained by sampling the height map, the interpolated height information is inaccurate at the boundary of the height map, that is, the junction of two height maps connected in the horizontal direction, and there will be cracks in the performance of the scene elements in the game scene rendered based on the height map. In order to solve the above technical problems, in this embodiment, the sampling range of the target height map is expanded so that the edge data of the height map adjacent to it is included in the height map, so that the interpolated height information is accurate height information. Optionally, the sampling area of the target height map can be determined based on the effective area of the target height map to expand the effective area to obtain the sampling area. It can be understood that the coverage of the sampling area is greater than the coverage of the effective area.
[0029] In one embodiment, the sampling area can be obtained based on the coordinates of the effective area. Optionally, the sampling area of the target height map is determined based on the effective area of the target height map, including: obtaining the effective area of the target height map; determining the effective coordinate range corresponding to the effective area, expanding the effective coordinate range to obtain the sampling coordinate range, and determining the sampling area based on the sampling coordinate range. Specifically, the effective coordinate range corresponding to the effective area in the scene model can be determined, the effective coordinate range can be expanded to obtain the sampling coordinate range, and thus the sampling area can be determined. Among them, the method of expanding the effective coordinate range is not limited here, as long as at least one coordinate of the effective coordinate range is expanded outward to obtain a sampling coordinate range whose coverage range is greater than the effective coordinate range. Determining the sampling area by obtaining the sampling coordinate range based on the expansion of the effective coordinate range can quickly determine the sampling area.
[0030] S120: Sampling the scene model based on the sampling area to obtain height information of the sampling points.
[0031] In this embodiment, after the sampling area is determined, the scene model is sampled within the sampling area to obtain the height information of the sampling points. The sampling frequency for sampling the scene model can be set according to actual needs and is not limited here. In one embodiment, sampling can be performed in the sampling area by ray detection to obtain the height information of the sampling points. The density of ray detection can be set according to actual needs. For example, the density information can be set to 1×1 units, that is, the scene model is ray-detected from top to bottom at a density of 1x1 units in the scene.
[0032] S130: Generate a target height map based on the height information of each sampling point.
[0033] In this embodiment, after obtaining the height information of each sampling point, for each sampling point, the coordinate point corresponding to the sampling point in the target height map is determined, the color information of the corresponding coordinate point is determined based on the height information of the sampling point, and the color information of the corresponding coordinate point of each sampling point is combined to generate the target height map. Wherein, the color information of the corresponding coordinate point is determined based on the height information of the sampling point, which can be: the height information of the sampling point is used as the gray value of a set color channel (such as the red channel) in the color information of the corresponding coordinate point, and the color information of the coordinate point is obtained by combining the set gray values of other channels. Exemplarily, if the height information of the sampling point is 152, 152 is used as the gray value of the red channel of the coordinate point in the target height map corresponding to the sampling point. Assuming that the set gray values of other channels are 255, the color information of the coordinate point corresponding to the sampling point is (152, 255, 255).
[0034] In one embodiment of the present invention, a target height map is generated based on the height information of each sampling point, including: generating a sampling height map of a resolution corresponding to the sampling area based on the height information of each sampling point; scaling the sampling height map to obtain a target height map of a resolution corresponding to the effective area. It can be understood that when the coverage corresponding to the sampling area increases, the resolution of the height map generated based on the sampling data will increase accordingly. Exemplarily, if the effective area is 128×128, and the sampling area obtained by expanding the effective area is 130×130, a height map with a resolution of 130×130 will be generated, that is, the resolution of the height map is not an integer power of 2, which will affect the sampling efficiency of the graphics card when the height map is sampled. In order to ensure the sampling efficiency when sampling the target height map, after generating a sampling height map of a resolution corresponding to the sampling area based on the height information of the sampling points, the sampling height map is scaled to obtain a target height map of a resolution corresponding to the effective area, that is, the sampling height map is scaled back to the resolution corresponding to the effective area. Optionally, the image scaling method of the traditional bilinear interpolation can be sampled to scale the sampling height map to the target height map.
[0035] On the basis of the above scheme, considering that there may be some invalid points on the sampled height map during the scaling process, it is possible to improve the traditional bilinear interpolation image scaling method to scale the sampled height map to the target height map. Optionally, the sampled height map is scaled to obtain a target height map of the resolution corresponding to the effective area, including: scaling the sampled height map to the target height map based on an image scaling method of a weighted average of domain effective values. That is, based on the traditional bilinear interpolation image scaling method, it is adjusted to a method of taking the weighted average of the four domain effective values for scaling.
[0036] In addition, it should be noted that, since the area of height information contained in the height map is larger than its effective area, when sampling the height map during the rendering process of the scene image, it is also necessary to adjust the sampled uv coordinates accordingly so that the sampled uv coordinates can match the height information in the target height map. Optionally, sampling the height map during the rendering of the scene image includes: determining the original sampling coordinates corresponding to the sampling points of the height map, offsetting the original sampling coordinates based on the expanded range of the sampling area to obtain offset sampling coordinates, sampling the height map based on the offset sampling coordinates to obtain height map sampling data. Exemplarily, assuming that the effective area of the height map is an area consisting of a horizontal coordinate x range [128, 256] and a vertical coordinate y range [128, 256], the sampling area obtained after the effective area is expanded is an area consisting of a horizontal coordinate x range [127, 257] and a vertical coordinate y range [127, 257], that is, the height map contains height information in the area consisting of a horizontal coordinate x range [127, 257] and a vertical coordinate y range [127, 257]. Correspondingly, when sampling the height map, the uv coordinates need to be offset accordingly. Assuming that the height information at the coordinate (152, 152) needs to be collected, and the corresponding original sampling coordinate uv coordinate is (0.1875, 0.1875), then the original sampling coordinates are offset to obtain the offset sampling coordinate uv coordinate (0.1923, 0.1923), and sampling is performed based on the offset sampling coordinates.
[0037] The embodiment of the present invention determines a sampling area of a target height map based on a valid area of the target height map, wherein the coverage of the sampling area is greater than the coverage of the valid area; samples a scene model based on the sampling area to obtain height information of the sampling points; generates a target height map based on the height information of each sampling point, and generates a height map whose sampling area is greater than the valid area by adjusting the sampling area for generating the height map, so that when the height map is interpolated and sampled during the rendering of the game scene, accurate height information can be obtained at the boundary of the height map based on extended data outside the valid area contained in the height map, thereby avoiding the technical problem of poor game screen display effect caused by inaccurate height information at the boundary of the height map, and improving the display effect of the scene screen.
[0038] Based on the above scheme, it also includes: obtaining rendering parameters corresponding to the target height map, constructing a corresponding relationship between the rendering parameters and the target height map; rendering and displaying the scene image according to the target height map and the rendering parameters associated with the target height map. Optionally, the rendering parameters may include color information, density information, etc., and the target height map is associated with the rendering parameters so that the corresponding scene image can be rendered based on the rendering parameters and the target height map.
[0039] Embodiment 2
[0040] Figure 21 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 2 As shown, the method includes:
[0041] S210: Obtain a valid area of the target height map.
[0042] S220: Determine the effective coordinates of the horizontal edge and the effective coordinates of the vertical edge corresponding to the effective area.
[0043] In this embodiment, the sampling area is obtained by expanding the effective area based on the coordinate value. The coordinate values that can represent the effective area include the effective coordinates of the horizontal edge and the effective coordinates of the vertical edge, wherein the effective coordinates of the horizontal edge include the minimum coordinate value and the maximum coordinate value in the horizontal direction (such as the x-axis direction), and the effective coordinates of the vertical edge include the minimum coordinate value and the maximum coordinate value in the vertical direction (such as the y-axis direction). Exemplarily, assuming that the effective area is an area composed of coordinate points (128, 128), coordinate points (128, 256), coordinate points (256, 128) and coordinate points (256, 256), the effective coordinates of the horizontal edge are 128 and 256, and the effective coordinates of the vertical edge are 128 and 256.
[0044] S230 , expanding the horizontal effective range of the effective coordinate range based on the horizontal edge effective coordinates to obtain the horizontal edge sampling coordinates.
[0045] Optionally, the effective area can be expanded based on the effective coordinates of the horizontal edge and the effective coordinates of the vertical edge, so that the acquisition area on each boundary of the effective area can cover the effective area, so that the height map can include data of the height map adjacent to it in any direction, so that the transition in each direction can be smoother.
[0046] In one embodiment, the effective horizontal edge coordinates include the effective horizontal left edge coordinates and the effective horizontal right edge coordinates, and the horizontal edge sampling coordinates include the horizontal left edge sampling coordinates and the horizontal right edge sampling coordinates. Based on the effective horizontal edge coordinates, the effective horizontal range of the effective coordinate range is expanded to obtain the horizontal edge sampling coordinates, including: shifting the effective horizontal left edge coordinates to the left to set the horizontal offset to obtain the horizontal left edge sampling coordinates; shifting the effective horizontal right edge coordinates to the right to set the horizontal offset to obtain the horizontal right edge sampling coordinates. Optionally, the horizontal offset can be set in advance, and after determining the effective horizontal edge coordinates, the effective horizontal edge coordinates are expanded outward to set the horizontal offset to obtain the horizontal edge sampling coordinates. Optionally, the effective horizontal edge coordinates include the effective horizontal left edge coordinates and the effective horizontal right edge coordinates, and the horizontal edge sampling coordinates include the horizontal left edge sampling coordinates and the horizontal right edge sampling coordinates. Among them, the effective horizontal left edge coordinates are the minimum coordinate values in the horizontal direction of the effective area (such as the x-axis direction), and the effective horizontal right edge coordinates are the maximum coordinate values in the horizontal direction of the effective area; the horizontal edge sampling coordinates are the minimum coordinate values in the horizontal direction of the sampling area, and the horizontal right edge sampling coordinates are the maximum coordinate values in the horizontal direction of the sampling area. The horizontal offset can be set according to actual needs. Exemplarily, the horizontal offset can be 1. Exemplarily, assuming that the horizontal edge effective coordinates are 128 and 256, that is, the horizontal left edge effective coordinates are 128 and the horizontal right edge effective coordinates are 256, then the horizontal left edge effective coordinates are shifted left by 1 to obtain the horizontal left edge sampling coordinates 127, and the horizontal right edge effective coordinates are shifted right by 1 to obtain the horizontal right edge sampling coordinates 257, that is, the horizontal edge sampling coordinates are 127 and 257.
[0047] S240 . Expand the longitudinal effective range of the effective coordinate range based on the longitudinal effective edge coordinates to obtain the longitudinal edge sampling coordinates.
[0048] In this embodiment, the method of expanding the longitudinal effective range of the effective coordinate range is similar to the method of expanding the transverse coordinate range. In one embodiment, the longitudinal edge effective coordinates include the longitudinal upper edge effective coordinates and the longitudinal lower edge effective coordinates, the longitudinal edge sampling coordinates include the longitudinal upper edge sampling coordinates and the longitudinal lower edge sampling coordinates, and expanding the longitudinal effective range of the effective coordinate range based on the longitudinal effective edge coordinates to obtain the longitudinal edge sampling coordinates includes: moving the longitudinal upper edge effective coordinates upward to set the longitudinal offset to obtain the longitudinal upper edge sampling coordinates; moving the longitudinal lower edge effective coordinates downward to set the longitudinal offset to obtain the longitudinal lower edge sampling coordinates.
[0049] Optionally, the effective coordinates of the longitudinal edge include the effective coordinates of the upper longitudinal edge and the effective coordinates of the lower longitudinal edge, and the sampling coordinates of the longitudinal edge include the sampling coordinates of the upper longitudinal edge and the sampling coordinates of the lower longitudinal edge. Among them, the effective coordinates of the upper longitudinal edge are the minimum coordinate values in the longitudinal direction of the effective area (such as the y-axis direction), and the effective coordinates of the lower longitudinal edge are the maximum coordinate values in the longitudinal direction of the effective area; the sampling coordinates of the longitudinal edge are the minimum coordinate values in the longitudinal direction of the sampling area, and the sampling coordinates of the lower longitudinal edge are the maximum coordinate values in the longitudinal direction of the sampling area. The longitudinal offset can be set according to actual needs. Exemplarily, the longitudinal offset can be 1. Exemplarily, assuming that the effective coordinates of the longitudinal edge are 128 and 256, that is, the effective coordinates of the upper longitudinal edge are 128 and the effective coordinates of the lower longitudinal edge are 256, then the effective coordinates of the upper longitudinal edge are moved up by 1 to obtain the sampling coordinates of the upper longitudinal edge 127, and the effective coordinates of the lower longitudinal edge are moved down by 1 to obtain the sampling coordinates of the lower longitudinal edge 257, that is, the sampling coordinates of the longitudinal edge are 127 and 257.
[0050] S250: Determine a sampling coordinate range according to the horizontal edge sampling coordinates and the vertical edge sampling coordinates.
[0051] In this embodiment, after determining the horizontal edge sampling coordinates and the vertical edge sampling coordinates, the sampling coordinate range is obtained by combining the horizontal edge sampling coordinates and the vertical edge sampling coordinates. Taking the horizontal edge sampling coordinates as 127 and 257 and the vertical edge sampling coordinates as 127 and 257 as an example, the sampling coordinate range is the horizontal coordinate range [127, 257] and the vertical coordinate range [127, 257].
[0052] S260: Determine a sampling area based on the sampling coordinate range.
[0053] S270: Sampling the scene model based on the sampling area to obtain height information of the sampling points.
[0054] S280: Generate a target height map based on the height information of each sampling point.
[0055] Based on the above embodiments, the embodiment of the present invention concretizes the expansion of the effective coordinate range to obtain the sampling coordinate range, by determining the horizontal edge effective coordinates and the vertical edge effective coordinates corresponding to the effective area; expanding the horizontal effective range of the effective coordinate range based on the horizontal edge effective coordinates to obtain the horizontal edge sampling coordinates; expanding the vertical effective range of the effective coordinate range based on the vertical effective edge coordinates to obtain the vertical edge sampling coordinates; determining the sampling coordinate range according to the horizontal edge sampling coordinates and the vertical edge sampling coordinates, and reasonably determining the sampling coordinate range, avoiding the sampling coordinate range being too large to occupy storage and running space, and ensuring the accuracy of the height information at the junction of the height map.
[0056] Embodiment 3
[0057] 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 a sampling area determination module 310, a height information determination module 320 and a target height map generation module 330, wherein:
[0058] A sampling area determination module 310 is used to determine a sampling area of a target height map based on a valid area of the target height map, wherein a coverage area of the sampling area is larger than a coverage area of the valid area;
[0059] A height information determination module 320 is used to sample the scene model based on the sampling area to obtain height information of the sampling point;
[0060] The target height map generating module 330 is used to generate a target height map based on the height information of each sampling point.
[0061] In an embodiment of the present invention, a sampling area determination module determines a sampling area of a target height map based on a valid area of the target height map, wherein the coverage of the sampling area is greater than the coverage of the valid area; a height information determination module samples a scene model based on the sampling area to obtain height information of the sampling points; a target height map generation module generates a target height map based on the height information of each sampling point, and generates a height map whose sampling area is greater than the valid area by adjusting the sampling area for generating the height map, so that when the height map is interpolated and sampled during the rendering process of the game scene, accurate height information can be obtained at the boundary of the height map based on the extended data outside the valid area contained in the height map, thereby avoiding the technical problem of poor game screen display effect caused by inaccurate height information at the boundary of the height map, and improving the display effect of the scene screen.
[0062] Optionally, based on the above solution, the sampling area determination module 310 includes:
[0063] An effective area determination unit, used to obtain the effective area of the target height map;
[0064] The sampling area determination unit is used to determine the effective coordinate range corresponding to the effective area, expand the effective coordinate range to obtain the sampling coordinate range, and determine the sampling area based on the sampling coordinate range.
[0065] Optionally, based on the above solution, the sampling area determination unit includes:
[0066] An effective coordinate determination subunit, used to determine the effective coordinates of the horizontal edge and the vertical edge corresponding to the effective area;
[0067] A transverse sampling coordinate subunit, used for expanding the transverse effective range of the effective coordinate range based on the transverse edge effective coordinate to obtain the transverse edge sampling coordinate;
[0068] A longitudinal sampling coordinate subunit, used for expanding the longitudinal effective range of the effective coordinate range based on the longitudinal effective edge coordinates to obtain the longitudinal edge sampling coordinates;
[0069] The sampling coordinate determination subunit is used to determine the sampling coordinate range according to the horizontal edge sampling coordinates and the vertical edge sampling coordinates.
[0070] Optionally, based on the above solution, the horizontal edge effective coordinates include the horizontal left edge effective coordinates and the horizontal right edge effective coordinates, the horizontal edge sampling coordinates include the horizontal left edge sampling coordinates and the horizontal right edge sampling coordinates, and the horizontal sampling coordinate subunit is specifically used for:
[0071] Shift the effective coordinates of the horizontal left edge to the left by setting the horizontal offset to obtain the horizontal left edge sampling coordinates;
[0072] Shift the effective coordinates of the right horizontal edge to the right by setting the horizontal offset to obtain the sampling coordinates of the right horizontal edge.
[0073] Optionally, based on the above solution, the longitudinal edge valid coordinates include the longitudinal upper edge valid coordinates and the longitudinal lower edge valid coordinates, the longitudinal edge sampling coordinates include the longitudinal upper edge sampling coordinates and the longitudinal lower edge sampling coordinates, and the longitudinal sampling coordinate subunit is specifically used for:
[0074] The effective coordinates of the upper longitudinal edge are moved upward to set the longitudinal offset to obtain the sampling coordinates of the upper longitudinal edge;
[0075] The effective coordinates of the lower longitudinal edge are moved downward to set the longitudinal offset to obtain the sampling coordinates of the lower longitudinal edge.
[0076] Optionally, based on the above solution, the target height map generation module 330 includes:
[0077] A sampling height map generating unit, used to generate a sampling height map of a corresponding resolution of the sampling area based on the height information of each sampling point;
[0078] The target height map generation unit is used to scale the sampled height map to obtain a target height map of a resolution corresponding to the effective area.
[0079] Optionally, based on the above solution, the target height map generation unit is specifically used to:
[0080] The image scaling method based on the weighted average of the effective values of the community scales the sampled height map to the target height map.
[0081] 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.
[0082] Embodiment 4
[0083] 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.
[0084] 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).
[0085] 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.
[0086] 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.
[0087] 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 4Not 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.
[0088] 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.
[0089] 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.
[0090] 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:
[0091] Determine a sampling area of the target height map based on the valid area of the target height map, wherein a coverage area of the sampling area is greater than a coverage area of the valid area;
[0092] Sample the scene model based on the sampling area to obtain the height information of the sampling points;
[0093] Generate a target height map based on the height information of each sampling point.
[0094] 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.
[0095] Embodiment 5
[0096] 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:
[0097] Determine a sampling area of the target height map based on the valid area of the target height map, wherein a coverage area of the sampling area is greater than a coverage area of the valid area;
[0098] Sample the scene model based on the sampling area to obtain the height information of the sampling points;
[0099] Generate a target height map based on the height information of each sampling point.
[0100] 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.
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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).
[0105] 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: Determining a sampling area of the target height map based on a valid area of the target height map, wherein a coverage range of the sampling area is greater than a coverage range of the valid area; Sampling the scene model based on the sampling area to obtain height information of the sampling points; Generate a sampling height map of the corresponding resolution of the sampling area based on the height information of each sampling point; The image scaling method based on the weighted average of the domain effective values scales the sampled height map to the target height map.
2. The method according to claim 1, characterized in that The step of determining a sampling area of the target height map based on a valid area of the target height map comprises: Get the valid area of the target height map; Determine a valid coordinate range corresponding to the valid area, expand the valid coordinate range to obtain the sampling coordinate range, and determine the sampling area based on the sampling coordinate range.
3. The method according to claim 2, characterized in that The determining the valid coordinate range corresponding to the valid area and expanding the valid coordinate range to obtain the sampling coordinate range includes: Determine the effective coordinates of the horizontal edge and the vertical edge corresponding to the effective area; Expanding the lateral effective range of the effective coordinate range based on the lateral edge effective coordinates to obtain lateral edge sampling coordinates; Expanding the longitudinal effective range of the effective coordinate range based on the longitudinal effective edge coordinates to obtain longitudinal edge sampling coordinates; The sampling coordinate range is determined according to the transverse edge sampling coordinates and the longitudinal edge sampling coordinates.
4. The method according to claim 3, characterized in that The horizontal edge effective coordinates include horizontal left edge effective coordinates and horizontal right edge effective coordinates, the horizontal edge sampling coordinates include horizontal left edge sampling coordinates and horizontal right edge sampling coordinates, and the horizontal effective range of the effective coordinate range is expanded based on the horizontal edge effective coordinates to obtain the horizontal edge sampling coordinates, including: Shift the effective coordinates of the horizontal left edge to the left by a set horizontal offset to obtain the sampling coordinates of the horizontal left edge; The effective coordinates of the horizontal right edge are shifted rightward to set a horizontal offset to obtain the sampling coordinates of the horizontal right edge.
5. The method according to claim 3, characterized in that: The longitudinal edge valid coordinates include the longitudinal upper edge valid coordinates and the longitudinal lower edge valid coordinates, the longitudinal edge sampling coordinates include the longitudinal upper edge sampling coordinates and the longitudinal lower edge sampling coordinates, and the longitudinal effective range of the effective coordinate range is expanded based on the longitudinal effective edge coordinates to obtain the longitudinal edge sampling coordinates, including: The effective coordinates of the longitudinal upper edge are moved upward by a set longitudinal offset to obtain the sampling coordinates of the longitudinal upper edge; The longitudinal lower edge effective coordinates are moved downward to set a longitudinal offset to obtain the longitudinal lower edge sampling coordinates.
6. A height map generating device, characterized in that: include: A sampling area determination module, used to determine the sampling area of the target height map based on the effective area of the target height map, wherein the coverage of the sampling area is larger than the coverage of the effective area; A height information determination module, used to sample the scene model based on the sampling area to obtain height information of the sampling point; The target height map generation module is used to generate a sampling height map of the corresponding resolution of the sampling area based on the height information of each sampling point, and scale the sampling height map to the target height map based on an image scaling method of a weighted average of domain effective values.
7. 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-5.
8. 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 5 is implemented.
