Scene terrain generation method and device, medium and electronic equipment

By determining the terrain tile type and performing mesh segmentation and height adjustment, the difficulty of terrain rendering in scene-based games was solved, enabling diversified terrain generation and enhanced realism, thus improving the user experience.

CN115804949BActive Publication Date: 2025-11-25DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211551319.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2025-11-25
Estimated Expiration
2042-12-05

Smart Images

  • Figure CN115804949B_ABST
    Figure CN115804949B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a scene terrain generation method, device, medium and electronic equipment, the method comprising: determining a terrain type corresponding to a terrain tile to be drawn; if the terrain type is a basic type, determining a height corresponding to each voxel in the terrain tile under the basic type as a target height corresponding to the voxel; if the terrain type is a composite type, performing mesh segmentation on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, wherein the terrain of the composite type is composed of a terrain based on the basic type and a terrain of an overlay type; for each target mesh, determining a basic height corresponding to each voxel in the target mesh under the basic type, and adjusting the basic height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel; and drawing each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type to obtain a scene terrain under the terrain type.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, in particular, to a scene terrain generation method and device, medium and electronic equipment. BACKGROUND

[0002] The corresponding use group of game applications gradually increases, and the corresponding use demand gradually increases. In related technologies, in scene games, it is usually necessary to generate and render scene terrain, such as generating corresponding terrain through height map in Unity. However, in the above process, the height of each terrain needs to be strictly controlled, and it is difficult to realize the drawing of interface graph under multiple terrains. SUMMARY

[0003] This summary is provided to introduce a selection of concepts that are further described below in the detailed description. This summary is not intended to identify key or essential features of the claimed technology, nor is it intended to be used to limit the scope of the claimed technology.

[0004] In a first aspect, the present disclosure provides a scene terrain generation method, wherein the method comprises:

[0005] determining a terrain type corresponding to a terrain tile to be drawn;

[0006] if the terrain type is a basic type, determining a height corresponding to each voxel in the terrain tile under the basic type as a target height corresponding to the voxel;

[0007] if the terrain type is a composite type, performing mesh segmentation on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, wherein the terrain of the composite type is composed of a terrain based on a basic type and a terrain of an overlay type;

[0008] for each target mesh, determining a basic height corresponding to each voxel in the target mesh under the basic type, and adjusting the basic height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel;

[0009] drawing each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type to obtain a scene terrain under the terrain type.

[0010] In a second aspect, the present disclosure provides a scene terrain generation device, comprising:

[0011] a first determination module configured to determine a terrain type corresponding to a terrain tile to be drawn;

[0012] The second determining module is configured to determine, if the terrain type is a basic type, a corresponding height of each voxel in the terrain tile under the basic type as a target height corresponding to the voxel.

[0013] The cutting module is configured to perform mesh cutting on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, if the terrain type is a composite type, wherein the terrain of the composite type is composed of a basic type terrain and an overlay type terrain.

[0014] The third determining module is configured to determine, for each target mesh, a corresponding basic height of each voxel in the target mesh under the basic type, and adjust the basic height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel.

[0015] The drawing module is configured to draw each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type, to obtain a scene terrain under the terrain type.

[0016] In a third aspect, the present disclosure provides a computer readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method of the first aspect.

[0017] In a fourth aspect, the present disclosure provides an electronic device, comprising:

[0018] A storage device having a computer program stored thereon;

[0019] A processing device configured to execute the computer program in the storage device to implement the steps of the method of the first aspect.

[0020] In the above technical solution, the terrain type corresponding to the terrain tile to be drawn is determined, so as to generate scene terrains under different terrain types respectively. In this process, the terrain of the composite type can be based on the terrain of the basic type, so as to ensure the smoothness and continuity of the height between the terrain tiles of different terrain types, so that the generated scene terrain conforms to the real terrain structure. Moreover, for the composite type, a plurality of meshes can be further divided for rendering, and the target height of each voxel is determined, so that the rendering can be performed based on the target height of each voxel in the scene terrain during the drawing of the scene terrain, so that various scene terrains can be rendered, effectively widening the accuracy and application range of the scene terrain generation method, providing diverse terrains in the game scene, and improving the user experience.

[0021] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0022] The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The same or similar components have the same or similar reference numbers throughout the drawings and the specification. It should be understood that the drawings are not necessarily to scale, the emphasis instead being placed upon illustrating the principles of the embodiments of the present disclosure. In the drawings:

[0023] Figure 1 is a flowchart of a scene terrain generation method according to an embodiment of the present disclosure;

[0024] Figure 2a is a schematic diagram of a target mesh according to an embodiment of the present disclosure;

[0025] Figure 2b is a rendering of a lake terrain according to an embodiment of the present disclosure;

[0026] Figure 3a is a schematic diagram of a target mesh according to an embodiment of the present disclosure;

[0027] Figure 3b is a rendering of an island terrain according to an embodiment of the present disclosure;

[0028] Figure 4 is a block diagram of a scene terrain generation apparatus according to an embodiment of the present disclosure;

[0029] Figure 5 shows a structural schematic diagram of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] Embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings. While several embodiments of the present disclosure have been illustrated and described, it will be appreciated that various changes can be made therein without departing from the spirit and scope of the present disclosure. It is to be understood that the drawings and descriptions are not intended to be limiting to the possible embodiments of the present disclosure, and that aspects of the present disclosure can be utilized in various forms. It is to be further understood that the embodiments of the present disclosure can be used in any combination of the forms of the present disclosure.

[0031] It should be understood that the various steps of the method embodiments of the present disclosure can be performed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit performing the steps shown. The scope of the present disclosure is not limited in this regard.

[0032] As used herein, the term "includes" and its variants are to be read to be analogous to "comprises," or "comprising." The term "based on" is to be read as "based, at least in part, on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments." Related terms have corresponding meanings.

[0033] It should be noted that the terms "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.

[0034] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative rather than limiting, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".

[0035] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0036] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0037] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the personal information of the user. Thus, the user can voluntarily choose whether to provide personal information to the software or hardware such as electronic device, application program, server or storage medium that performs the operation of the technical solutions of the present disclosure according to the prompt information.

[0038] As an optional but not limiting implementation, in response to receiving the active request of the user, the way of sending prompt information to the user may, for example, be the way of pop-up window, and the prompt information may, for example, be presented in the form of text in the pop-up window. In addition, the pop-up window may also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0039] It can be understood that the above notification and user authorization process is only illustrative and does not limit the implementation of the present disclosure, and other ways that meet the relevant laws and regulations can also be applied to the implementation of the present disclosure.

[0040] Meanwhile, it can be understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws, regulations and relevant provisions.

[0041] Figure 1 A flowchart of a method for generating a scene terrain is shown, which is provided according to an embodiment of the present disclosure, as shown in Figure 1 As shown, the method can include:

[0042] In step 11, the terrain type corresponding to the terrain tile to be drawn is determined.

[0043] The terrain tile can be Quantized-mesh format data commonly used in the art for rendering the scene interface in the game, and the terrain type corresponding to the terrain tile can be determined according to the user's selection. For example, the corresponding terrain type can be displayed in the drawing interface, and the user can select from it, and then the type selected by the user can be determined as the terrain type corresponding to the terrain tile to be drawn. The size of the terrain tile can be set in advance, and the terrain tile can be used as a unit for drawing in the present disclosure.

[0044] In step 12, if the terrain type is a basic type, the height corresponding to each voxel in the terrain tile under the basic type is determined as the target height corresponding to the voxel.

[0045] For example, the basic type can be a plain type, which serves as the basis for drawing the terrain of each type. Under the plain type, the height of each voxel in the terrain tile can be directly determined in order to draw the plain terrain.

[0046] In step 13, if the terrain type is a composite type, the terrain tile is meshed to obtain a plurality of target meshes corresponding to the terrain tile, wherein the terrain of the composite type is composed of a terrain based on the basic type and a terrain of the superimposed type.

[0047] For example, the terrain tile can be divided according to the size of the mesh, for example, the target mesh can be divided in the following way:

[0048] It is determined whether the first boundary information and the second boundary information of the candidate mesh satisfy the mesh constraint condition, and the mesh constraint condition is that the first boundary information and the second boundary information are less than a preset threshold. Different preset thresholds can be set for different boundary information, or the same preset threshold can be set, which is not limited herein. The candidate mesh is initially the terrain tile, the first boundary information can be the length of the mesh, and the second boundary information can be the width of the mesh.

[0049] Then, the boundary information of the candidate grid that does not meet the grid constraint condition is averaged to obtain a plurality of divided grids. For example, define xMin as the x coordinate of the lower left corner of the current grid, xMax as the x coordinate of the upper right corner of the current grid, yMin as the y coordinate of the lower left corner of the current grid, and xMax as the y coordinate of the upper right corner of the current grid.

[0050] For example, if the x boundary information of the current grid does not meet the grid constraint condition, the average of xMin and xMax can be taken as the intermediate value xMid, so that the divided grid with (xMin, xMid, yMin, yMax) as the vertex and the divided grid with (xMid, xMax, yMin, yMax) as the vertex can be obtained, and the division operation of the y boundary information is the same.

[0051] Then, it is determined whether the first boundary information and the second boundary information of the divided grid meet the grid constraint condition.

[0052] If the grid constraint condition is not met, each divided grid is taken as a new candidate grid, and the subsequent steps of averaging the boundary information of the candidate grid that does not meet the grid constraint condition and the subsequent steps are performed until the first boundary information and the second boundary information of the new divided grid meet the grid constraint condition. In this way, the terrain tile can be uniformly divided to obtain a plurality of grids with the same size, so that each grid can be processed individually, and the accuracy of the generated scene terrain is improved.

[0053] In step 14, for each target grid, the basis height corresponding to each voxel in the target grid under the basis type is determined, and the basis height is adjusted based on the height information corresponding to the overlay type to obtain the target height corresponding to the voxel.

[0054] The height information corresponding to the overlay type can be the height range or height center under the overlay type, which can be set for different overlay types and consistent with the actual terrain of the overlay type. In this step, the height of each grid can be calculated in units of grids, and the basis height corresponding to the basis type can be used as the basis height in this process, so that the continuity of the heights of the grids and the terrain tile is ensured, and the basis height is adjusted according to the specific overlay type to ensure the matching of the height of the grid and the specific overlay type to a certain extent.

[0055] In step 15, each voxel in the terrain tile is rendered according to the target height and the terrain type corresponding to the voxel to obtain the scene terrain under the terrain type.

[0056] After determining the target height corresponding to each voxel, the corresponding terrain of each voxel at the target height can be further determined according to the superimposition type, and then the rendering of each voxel is performed to obtain the scene terrain.

[0057] In the above technical solution, the terrain type corresponding to the terrain tile to be drawn is determined, so as to draw and generate the scene terrain under different terrain types. In this process, the composite type can be based on the terrain of the basic type to ensure the smoothness and continuity of the height between the terrain tiles of different terrain types, so that the drawn scene terrain conforms to the real terrain structure. Moreover, for the composite type, it can be further divided into multiple grids for rendering, and the target height of each voxel is determined, so that the rendering can be performed based on the target height of each voxel in the scene terrain during the drawing of the scene terrain, so that various scene terrains can be rendered, effectively widening the accuracy and scope of application of the scene terrain generation method, providing diverse terrains in the game scene, and improving the user experience.

[0058] In one possible embodiment, for each target grid, the exemplary implementation of determining the basic height corresponding to each voxel in the target grid under the basic type can include:

[0059] For each voxel, the position information corresponding to the voxel is used for two-dimensional noise sampling to obtain the noise information corresponding to the voxel.

[0060] In this embodiment, the position information corresponding to the voxel and the two-dimensional noise can be used for sampling, for example, a noise function can be newly created according to seed, for example:

[0061] noise = new noise(seed = Math.random());

[0062] Then, the noise sampling process can be performed based on the noise function:

[0063] height' = noise.noise2D(x*step, y*step);

[0064] Wherein, x is used to represent the x coordinate of the voxel, y is used to represent the y coordinate of the voxel, noise2D is used to represent two-dimensional noise sampling, and step is used to represent the accuracy of noise sampling, which can be set according to the actual application scenario, for example, it can be set to 0.02, and the present disclosure is not limited thereto.

[0065] According to the maximum height and the minimum height corresponding to the basic type, the height corresponding to the noise information is determined as the basic height.

[0066] The maximum height and the minimum height corresponding to the terrain type can be set according to the terrain type. For example, the maximum height and the minimum height corresponding to the plain terrain can be represented as PmaxHeight and PminHeight respectively.

[0067] For example, by two-dimensional noise sampling, noise information corresponding to each voxel can be obtained. The noise information corresponds to a range of -1 to 1. The noise information can be further mapped to a range of the maximum height and the minimum height to obtain a target height. For example, the mapping can be based on the normalize() function:

[0068] height = normalize(height', -1, 1, minHeight, maxHeight);

[0069] The height represents the basic height corresponding to the voxel.

[0070] Correspondingly, if the terrain type is a basic type, the basic height corresponding to each voxel in the terrain tile under the basic type can be determined by the above process, and the basic height is directly used as the target height corresponding to the voxel. Details are not repeated here.

[0071] Thus, by the above technical solution, the preliminary generation of the basic height under the basic terrain can be realized by two-dimensional noise processing. The height of each voxel is determined to improve the accuracy and precision of the scene terrain rendering. Moreover, by noise processing and mapping to the height range corresponding to the maximum height and the minimum height, the effective height value can be ensured, and the smooth transition between adjacent voxels can be ensured to a certain extent.

[0072] In a possible embodiment, the superimposed type is a lake type.

[0073] An example implementation of the adjusting the basic height based on the height information corresponding to the superimposed type to obtain the target height corresponding to the voxel can include:

[0074] The basic grid and the lake grid corresponding to the target grid are determined, and the height of the voxel adjacent to the lake grid in the basic grid is updated to a preset height. The preset height can be set according to the actual scene, for example, the preset height can be set to 0.

[0075] For example, the grid of the voxel containing the boundary of the terrain tile in the target grid can be determined as the basic grid, and the remaining grid can be determined as the lake grid. For example, Figure 2aAs shown, A1-A20 in the grid can be determined as the base grid, and B1-B16 can be determined as the lake grid.

[0076] As an example, the height of each voxel adjacent to the lake grid in each base grid can be updated to 0, for example, the height of Q 22 in the figure is updated to 0. As another example, the height of the voxel other than the voxel on the boundary of the terrain tile can also be updated to 0, that is, the height of all the remaining voxels other than the voxel on the outer edge in the figure is updated to 0.

[0077] For each of the base grids, according to the position information of each of the voxels in the base grid and the height corresponding to the grid vertex of the base grid, interpolation processing is performed to obtain the target height corresponding to the voxel.

[0078] As an example, for each base grid, the distance degree between the voxel and the vertex of the base grid can be determined based on the position information of the voxel, and then interpolation processing is performed according to the distance degree and the height of the vertex. The following is a detailed description taken A1 in Figure 2a as an example. Wherein the vertex of the base grid A1 can be represented as Q 11 , Q 12 , Q 21 , Q 22 .

[0079] As an example, the way of performing interpolation processing according to the position information of each of the voxels in the base grid and the height corresponding to the grid vertex of the base grid to obtain the target height corresponding to the voxel can include:

[0080] For each of the voxels, according to the position information corresponding to the voxel, first interpolation information and second interpolation information are obtained.

[0081] As an example, taking any voxel inside A1 as an example, its position information is represented as (X0, Y0), then the distance degree D1 corresponding to the left boundary of the base grid and the distance degree D2 corresponding to the right boundary of the base grid can be determined respectively, then:

[0082] D1=(X0-xMin) / dx; D2=(xMax-X0) / dx

[0083] Wherein, dx is used to represent the distance of the base grid on the x-axis, that is, dx=xMax-xMin.

[0084] Further, interpolation processing can be performed based on D1 and D2 respectively, for example, the interpolation function can be represented as s(x)=-2x 3 +3x 2Thus, the first interpolation information and the second interpolation information can be determined.

[0085] According to the first interpolation information, the second interpolation information, and the vertex height of the base grid, a first height and a second height are determined.

[0086] Thus, the first height and the second height can be calculated by the following formula:

[0087]

[0088]

[0089] wherein height1 is used to represent the first height, and height2 is used to represent the second height;

[0090] f(Q 11 ), f(Q 12 ), f(Q 21 ), and f(Q 22 ) are respectively used to represent the height of Q 11 , Q 12 , Q 21 , and Q 22 ;

[0091] x1 is used to represent the minimum x coordinate of the base grid, and x2 is used to represent the maximum x coordinate of the base grid. Thus, interpolation in the x direction can be performed to determine the first height and the second height respectively.

[0092] Further, according to the first height and the second height and the position information corresponding to the voxel, the target height is determined.

[0093] As can be based on the first height and the second height, interpolation in the y direction can be performed to obtain the target height. As can be determined based on the following formula:

[0094]

[0095] wherein y1 is used to represent the minimum y coordinate of the base grid, and y2 is used to represent the maximum y coordinate of the base grid.

[0096] Thus, by the above technical solution, the smooth transition between the base grid and the lake grid can be realized by interpolation, the stability of the generated terrain structure is ensured, and the picture experience is improved.

[0097] For each of the lake grids, according to the position information corresponding to each voxel in the lake grid, two-dimensional noise sampling is performed to obtain noise information corresponding to the voxel, and according to the maximum height and the minimum height in the height information of the lake type, a height corresponding to the noise information is determined as the target height corresponding to the voxel.

[0098] For the composite terrain of the lake type, the corresponding maximum height and minimum height can be represented as LmaxHeight and LminHeight respectively. For example, the maximum height in the height information corresponding to the lake type can be set to be less than the maximum height under the plain terrain, and the minimum height in the height information corresponding to the lake type can be set to be less than the minimum height under the plain terrain, so as to fit the actual application scenario that the lake is usually lower than the plain.

[0099] The way of two-dimensional noise sampling in this step is similar to the above description. Then, the height range of the terrain under the lake type can be further mapped according to the noise information, so that the height in the rendered lake grid meets the rendering requirements of the lake terrain. The specific way has been described in detail above, and will not be described here. For example, the rendered scene terrain is as shown in FIG. 6. Figure 2b

[0100] Therefore, by using the above technical solutions, when rendering the composite type scene terrain, the terrain can be drawn on the basis type terrain, so as to ensure the continuity between the drawn terrain tiles and adjacent tiles, and the basis grid is interpolated, so as to realize the smooth transition between the basis grid and the lake grid, ensure the accuracy of the drawing content inside the terrain tile, and improve the style diversity of the generated scene terrain.

[0101] In a possible embodiment, the superimposition type is an island type.

[0102] Correspondingly, an example implementation manner of adjusting the basis height based on the height information corresponding to the superimposition type to obtain the target height corresponding to the voxel can include:

[0103] The corresponding basis grid, island grid and lake grid in the target grid are determined, and the height of the voxel adjacent to the lake grid in the basis grid and the height of the voxel adjacent to the lake grid in the island grid are updated to a preset height, and the height of the target vertex of the island grid is updated to the island height corresponding to the island type. The preset height can be set based on the actual application scenario, for example, the preset height can be set to 0, and the island height can be set based on the user demand.

[0104] The basis grid can be a grid containing the boundary of the terrain tile as described above, and the island grid can be determined by user specification or default generation. For example, if the user does not specify, the center point of the terrain tile can be taken as the target vertex of the island grid, and if the user specifies, the grid vertex specified by the user can be determined as the target vertex, and the four grids around the center point can be determined as the island grid, and the remaining grids can be taken as the lake grid. For example,​Figure 3a As shown, A1'-A20' can represent the base grid, B1'-B12' can represent the lake grid, C1-C4 can represent the island grid, and the c point can be used to represent the target vertex of the island grid.

[0105] As an example, the height of the voxels in each grid can be updated after the base grid, island grid, and lake grid are determined. As another example, the height of the voxels at the boundary of the terrain tile can be retained, and the height of the voxels of the target vertex can be updated to the island height, and the height of the remaining voxels can be updated to 0.

[0106] For each base grid, interpolation processing is performed according to the position information of each voxel in the base grid and the height corresponding to the grid vertex of the base grid, to obtain a target height corresponding to the voxel;

[0107] For each island grid, interpolation processing is performed according to the position information of each voxel in the island grid and the height corresponding to the grid vertex of the island grid, to obtain a target height corresponding to the voxel;

[0108] For each lake grid, two-dimensional noise sampling is performed according to the position information of each voxel in the lake grid, to obtain noise information corresponding to the voxel, and a height corresponding to the noise information is determined as the target height corresponding to the voxel according to the maximum height and the minimum height in the height information of the island type.

[0109] The processing method for the base grid and the lake grid is similar to the above, and will not be described again. For the island grid, as shown in FIG. 6, taking C1 as an example, the height of the target vertex is 10, and the heights of the four vertices abcd of C1 are 0, 0, 10, and 0, respectively. Further, the height of each voxel in the island grid can be interpolated based on the position and height of the four vertices based on the interpolation processing method of the base grid described above, to obtain the target height corresponding to each voxel in the island grid. The interpolation processing method has been described in detail above, and will not be described again. As an example, the rendered scene terrain is as shown in FIG. 7. Figure 3a Figure 3b

[0110] Therefore, by the above technical solution, the island type terrain can be rendered, and in the process, the type of each grid in the terrain tile can be distinguished, so that the target height of each voxel in the grid can be obtained based on the interpolation processing or noise sampling processing, the efficiency of determining the target height is improved, and the rendered scene terrain can match the actual terrain scene, and the reality of the scene terrain in the game is improved.

[0111] ​​In a possible embodiment, the exemplary implementation of rendering the scene terrain under the terrain type according to the target height corresponding to each voxel in the terrain tile and the terrain type is as follows. This step can include:

[0112] If the terrain type is a basic type, the terrain corresponding to each voxel is rendered according to the target height corresponding to the voxel, to obtain the scene terrain.

[0113] If the terrain type is a basic type, the terrain corresponding to each voxel is rendered according to the target height corresponding to the voxel, to obtain the scene terrain.

[0114] If the terrain type is a composite type, the terrain factor included in the terrain type is determined.

[0115] If the terrain type is a composite type, it usually needs to be adjusted based on the basic terrain to obtain a new terrain. Therefore, in this embodiment, the terrain factor included in the terrain type can be further determined, where the terrain factor can be used to represent terrain characteristics, such as a water flow factor to reflect that there can be a lake or a river in the current terrain, or a cave factor to reflect that there can be a cave in the current terrain.

[0116] The voxel is rendered according to the target height corresponding to each voxel and the terrain factor to obtain the scene terrain.

[0117] Accordingly, the characteristics corresponding to each voxel can be further adjusted based on the terrain factor to determine all characteristics corresponding to each voxel.

[0118] In a possible embodiment, the exemplary implementation of rendering the scene terrain according to the target height corresponding to each voxel and the terrain factor is as follows. This step can include:

[0119] The terrain corresponding to each voxel is rendered according to the target height corresponding to each voxel to obtain a basic scene terrain. The implementation of this step has been described in detail above, and will not be repeated here.

[0120] If the terrain factor includes a water flow factor, the voxel in the basic scene terrain whose target height is lower than the water flow height is filled with the water flow factor to obtain the scene terrain.

[0121] The water flow height can be pre-set according to an actual application scene, and the disclosure does not limit this. For example, the water flow height can be set to 5, and the water flow factor can be added to the voxel when the target height of the determined voxel is less than 5, so that the sum of the target height corresponding to the voxel after adding the water flow factor and the water flow height can reach the water flow height, the water flow feature is added to the low-lying terrain, and the scene terrain of the lake type is obtained.

[0122] If the terrain factor includes a cave factor, three-dimensional noise sampling is performed on each voxel in the terrain tile, and voxels with noise information less than or equal to zero after sampling are deleted to obtain the scene terrain.

[0123] In this case, the terrain can be further subjected to three-dimensional noise sampling to determine the part belonging to the cave in the three-dimensional perspective. For example, three-dimensional noise sampling can be performed on voxels, such as three-dimensional noise sampling based on Berlin noise. In the three-dimensional case, the reference point is the eight points constituting the unit cube surrounding the point, so that sampling is performed to determine the type corresponding to each voxel in the basic scene terrain. If the noise information obtained after three-dimensional noise sampling is less than or equal to zero, it indicates that the type corresponding to the voxel should be a cave, and the voxel can be deleted at this time, so that part of the voxels in the basic scene terrain can be deleted to obtain the cave scene terrain.

[0124] Therefore, by the above technical solution, the type corresponding to each voxel can be determined according to the target height corresponding to each voxel and the terrain factors included in the terrain of the terrain type, the scene terrain at the voxel level is realized, the scene terrain drawing precision is improved, the diversity of the scene terrain that can be drawn is further improved, the matching with the real terrain is realized, and the interface support of the scene in the game is provided.

[0125] The disclosure also provides a scene terrain generation device, as shown in Figure 4 The device 10 includes:

[0126] The first determination module 100 is configured to determine the terrain type corresponding to the terrain tile to be drawn.

[0127] The second determination module 200 is configured to, if the terrain type is a basic type, determine the height corresponding to each voxel in the terrain tile under the basic type as the target height corresponding to the voxel.

[0128] The segmentation module 300 is configured to, if the terrain type is a composite type, perform grid segmentation on the terrain tile to obtain a plurality of target grids corresponding to the terrain tile, wherein the terrain of the composite type is composed of a basic type terrain and a superimposed type terrain.

[0129] The third determining module 400 is configured to determine, for each target grid, a corresponding base height of each voxel in the target grid under the base type, and adjust the base height based on height information corresponding to the superimposed type, to obtain a corresponding target height of the voxel;

[0130] The rendering module 500 is configured to render each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type, to obtain a scene terrain under the terrain type.

[0131] Optionally, the third determining module comprises:

[0132] The sub-sampling module is configured to perform two-dimensional noise sampling on the voxel according to the position information corresponding to the voxel, to obtain noise information corresponding to the voxel.

[0133] The first determining sub-module is configured to determine a height corresponding to the noise information as the base height according to the maximum height and the minimum height under the base type.

[0134] Optionally, the superimposed type is a lake type; and the third determining module comprises:

[0135] The second determining sub-module is configured to determine a corresponding base grid and a lake grid in the target grid, and update a height of a voxel adjacent to the lake grid in the base grid to a preset height.

[0136] The first processing sub-module is configured to perform interpolation processing on each voxel in the base grid according to position information of the voxel and a height corresponding to a grid vertex of the base grid, to obtain a target height corresponding to the voxel.

[0137] The second processing sub-module is configured to perform two-dimensional noise sampling on each voxel in the lake grid according to position information corresponding to the voxel, to obtain noise information corresponding to the voxel, and determine a height corresponding to the noise information as the target height corresponding to the voxel according to a maximum height and a minimum height in the height information of the lake type.

[0138] Optionally, the superimposed type is an island type; and the third determining module comprises:

[0139] a second determining sub-module, configured to determine a corresponding base grid, an island grid and a lake grid in the target grid, and update a height of a voxel adjacent to the lake grid in the base grid and a height of a voxel adjacent to the lake grid in the island grid to a preset height, and update a height of a target vertex of the island grid to an island height corresponding to the island type;

[0140] a first processing sub-module, configured to, for each base grid, perform interpolation processing according to position information of each voxel in the base grid and a height corresponding to a grid vertex of the base grid, to obtain a target height corresponding to the voxel;

[0141] a third processing sub-module, configured to, for each island grid, perform interpolation processing according to position information of each voxel in the island grid and a height corresponding to a grid vertex of the island grid, to obtain a target height corresponding to the voxel;

[0142] a second processing sub-module, configured to, for each lake grid, perform two-dimensional noise sampling according to position information corresponding to each voxel in the lake grid, to obtain noise information corresponding to the voxel, and determine a height corresponding to the noise information as the target height corresponding to the voxel according to a maximum height and a minimum height in height information of the island type.

[0143] Optionally, the first processing sub-module comprises:

[0144] a first interpolation sub-module, configured to, for each voxel, obtain first interpolation information and second interpolation information according to position information corresponding to the voxel;

[0145] a second interpolation sub-module, configured to determine a first height and a second height according to the first interpolation information, the second interpolation information and a vertex height of the base grid;

[0146] a third interpolation sub-module, configured to determine the target height according to the first height and the second height and the position information corresponding to the voxel.

[0147] Optionally, the rendering module comprises:

[0148] a first rendering sub-module, configured to, if the terrain type is a base type, perform rendering on a terrain corresponding to each voxel according to a target height corresponding to the voxel, to obtain the scene terrain;

[0149] a fourth determining sub-module, configured to, if the terrain type is a composite type, determine a terrain factor included in the terrain type;

[0150] The second drawing sub-module is configured to draw each voxel according to the target height corresponding to the voxel and the terrain factor, to obtain the scene terrain.

[0151] Optionally, the second drawing sub-module comprises:

[0152] The third drawing sub-module is configured to draw the terrain corresponding to each voxel according to the target height corresponding to the voxel, to obtain a basic scene terrain.

[0153] The first processing sub-module is configured to, if the terrain factor comprises a water flow factor, fill the water flow factor in the voxel whose target height is lower than the water flow height in the basic scene terrain, to obtain the scene terrain.

[0154] The second processing sub-module is configured to, if the terrain factor comprises a cave factor, perform three-dimensional noise sampling on each voxel in the terrain tile, and delete the voxel whose noise information obtained after sampling is less than or equal to zero, to obtain the scene terrain.

[0155] Reference will be made to the following description Figure 5 , which shows a structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a vehicle terminal (such as a vehicle navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. Figure 5 The electronic device shown is only an example, and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.

[0156] As shown in Figure 5 , the electronic device 600 can include a processing device (such as a central processor, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or loaded into a random access memory (RAM) 603 from a storage device 608. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0157] In general, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; storage devices 608 including, for example, a magnetic tape, a hard disk, and the like; and communication devices 609. The communication devices 609 can allow the electronic device 600 to communicate wirelessly or wired with other devices to exchange data. Although Figure 5 The electronic device 600 is shown with various devices, but it is understood that all of the illustrated devices are not required to be implemented or present. More or fewer devices can alternatively be implemented or present.

[0158] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 609, or installed from the storage devices 608, or installed from the ROM 602. When the computer program is executed by the processing devices 601, the above-described functions defined in the methods of embodiments of the present disclosure are performed.

[0159] It should be noted that the computer-readable medium described above can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer-readable program code is contained. Such a propagated data signal can take many forms, including but not limited to, an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium that can send, propagate or transfer the program for use by or in connection with the instruction execution system, apparatus or device. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to, wire, cable, RF (radio frequency), etc., or any suitable combination of the above.

[0160] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.

[0161] The computer-readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device and can not be assembled into the electronic device.

[0162] The computer readable medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: determine a terrain type corresponding to a terrain tile to be drawn; if the terrain type is a base type, determine a height corresponding to each voxel in the terrain tile under the base type as a target height corresponding to the voxel; if the terrain type is a composite type, perform mesh cutting on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, wherein the terrain of the composite type is composed of a base type terrain and an overlay type terrain; for each target mesh, determine a base height corresponding to each voxel in the target mesh under the base type, and adjust the base height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel; and draw each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type, to obtain a scene terrain under the terrain type.

[0163] Computer program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can 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 the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0164] The computer program product of the first aspect can include one or more non-transitory computer-readable media storing instructions that, when executed, cause one or more processors to perform the operations of the first aspect. The one or more non-transitory computer-readable media can include, for example, magnetic media such as one or more magnetic disks, magnetic tapes or cassettes; optical media such as one or more compact discs, optical discs or Blu-ray discs; magneto-optical media such as one or more floptical discs; solid state media such as one or more solid state drives or other flash memory arrays; or any suitable combination of these. The one or more non-transitory computer-readable media can be encoded with instructions that, when executed, cause one or more processors to perform the operations of the first aspect.

[0165] The modules described in the embodiments of the present disclosure can be implemented by software, or by hardware. In some cases, the name of a module does not constitute a limitation on the module itself. For example, the first determining module can also be described as a module that determines the terrain type corresponding to the terrain tile to be drawn.

[0166] The functions described above can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip systems (SOCs), complex programmable logic devices (CPLDs), etc.

[0167] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0168] According to one or more embodiments of the present disclosure, example 1 provides a method for generating a scene terrain, wherein the method comprises:

[0169] determining a terrain type corresponding to a terrain tile to be drawn;

[0170] if the terrain type is a basic type, determining a height corresponding to each voxel in the terrain tile under the basic type as a target height corresponding to the voxel;

[0171] if the terrain type is a composite type, performing mesh segmentation on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, wherein the terrain of the composite type is composed of a basic type terrain and an overlay type terrain;

[0172] for each target mesh, determining a basic height corresponding to each voxel in the target mesh under the basic type, and adjusting the basic height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel;

[0173] drawing each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type to obtain a scene terrain under the terrain type.

[0174] According to one or more embodiments of the present disclosure, example 2 provides the method of example 1, wherein the determining, for each target mesh, a basic height corresponding to each voxel in the target mesh under the basic type comprises:

[0175] for each voxel, performing two-dimensional noise sampling according to position information corresponding to the voxel to obtain noise information corresponding to the voxel;

[0176] determining a height corresponding to the noise information as the basic height according to a maximum height and a minimum height corresponding to the basic type.

[0177] According to one or more embodiments of the present disclosure, example 3 provides the method of example 1, wherein the overlay type is a lake type; and the adjusting, based on height information corresponding to the overlay type, the basic height to obtain a target height corresponding to the voxel comprises:

[0178] determining a basic mesh and a lake mesh corresponding to the target mesh, and updating a height of a voxel adjacent to the lake mesh in the basic mesh to a preset height;

[0179] For each of the base grids, interpolation processing is performed according to position information of each of the voxels in the base grid and a height corresponding to a grid vertex of the base grid, to obtain a target height corresponding to the voxel;

[0180] For each of the lake grids, two-dimensional noise sampling is performed according to position information corresponding to each voxel in the lake grid, to obtain noise information corresponding to the voxel, and a height corresponding to the noise information is determined as the target height corresponding to the voxel according to a maximum height and a minimum height in the height information of the lake type.

[0181] According to one or more embodiments of the present disclosure, example 4 provides the method of example 1, wherein the overlay type is an island type; and the adjusting the base height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel comprises:

[0182] determining corresponding base grids, island grids and lake grids in the target grid, and updating a height of a voxel adjacent to the lake grid in the base grid and a height of a voxel adjacent to the lake grid in the island grid to a preset height, and updating a height of a voxel of a target vertex of the island grid to an island height corresponding to the island type;

[0183] For each of the base grids, interpolation processing is performed according to position information of each of the voxels in the base grid and a height corresponding to a grid vertex of the base grid, to obtain a target height corresponding to the voxel;

[0184] For each of the island grids, interpolation processing is performed according to position information of each of the voxels in the island grid and a height corresponding to a grid vertex of the island grid, to obtain a target height corresponding to the voxel;

[0185] For each of the lake grids, two-dimensional noise sampling is performed according to position information corresponding to each voxel in the lake grid, to obtain noise information corresponding to the voxel, and a height corresponding to the noise information is determined as the target height corresponding to the voxel according to a maximum height and a minimum height in the height information of the island type.

[0186] According to one or more embodiments of the present disclosure, example 5 provides the method of example 3 or 4, wherein the interpolation processing performed according to position information of each of the voxels in the base grid and a height corresponding to a grid vertex of the base grid to obtain a target height corresponding to the voxel comprises:

[0187] For each of the voxels, first interpolation information and second interpolation information are obtained according to position information corresponding to the voxel;

[0188] determine a first height and a second height according to the first interpolation information, the second interpolation information, and the vertex height of the base mesh;

[0189] determine the target height according to the first height and the second height and the position information corresponding to the voxel.

[0190] According to one or more embodiments of the present disclosure, example 6 provides the method of example 1, wherein the rendering the voxel according to the target height corresponding to each voxel in the terrain tile and the terrain type to obtain the scene terrain under the terrain type comprises:

[0191] if the terrain type is a base type, rendering the terrain corresponding to the voxel according to the target height corresponding to each voxel to obtain the scene terrain;

[0192] if the terrain type is a composite type, determining terrain factors contained in the terrain type;

[0193] rendering the voxel according to the target height corresponding to each voxel and the terrain factor to obtain the scene terrain.

[0194] According to one or more embodiments of the present disclosure, example 7 provides the method of example 6, wherein the rendering the voxel according to the target height corresponding to each voxel and the terrain factor to obtain the scene terrain comprises:

[0195] rendering the terrain corresponding to the voxel according to the target height corresponding to each voxel to obtain a base scene terrain;

[0196] if the terrain factor contains a water flow factor, filling the water flow factor at the voxel in the base scene terrain whose target height is lower than the water flow height to obtain the scene terrain;

[0197] if the terrain factor contains a cave factor, performing three-dimensional noise sampling on each voxel in the terrain tile, and deleting the voxel whose noise information obtained after sampling is less than or equal to zero to obtain the scene terrain.

[0198] According to one or more embodiments of the present disclosure, example 8 provides a scene terrain generation device, the device comprising:

[0199] a first determination module configured to determine the terrain type corresponding to the terrain tile to be rendered;

[0200] The second determining module is configured to determine, if the terrain type is a basic type, a corresponding height of each voxel in the terrain tile under the basic type as a corresponding target height of the voxel.

[0201] The cutting module is configured to perform mesh cutting on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, if the terrain type is a composite type.

[0202] The third determining module is configured to determine, for each target mesh, a corresponding basic height of each voxel in the target mesh under the basic type, and adjust the basic height based on height information corresponding to the superimposed type to obtain a corresponding target height of the voxel.

[0203] The drawing module is configured to draw each voxel in the terrain tile according to the corresponding target height of the voxel and the terrain type, to obtain a scene terrain under the terrain type.

[0204] According to one or more embodiments of the present disclosure, example 9 provides a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processing device, implements the steps of the method of any one of examples 1-7.

[0205] According to one or more embodiments of the present disclosure, example 10 provides an electronic device, comprising:

[0206] a storage device having a computer program stored thereon;

[0207] a processing device configured to execute the computer program in the storage device to implement the steps of the method of any one of examples 1-7.

[0208] The above description is merely preferred embodiments of the present disclosure and a description of the principles of the technology applied. It should be understood by those skilled in the art that the disclosed scope of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or their equivalent features without departing from the disclosed concept. For example, the above features are replaced with the technical features disclosed in the present disclosure (but not limited to) having similar functions to form technical solutions.

[0209] Moreover, while operations have been depicted in a particular order, this should not be understood as requiring such an order nor limiting it to only those operations shown and described. One of ordinary skill in the art will recognize that many of the operations can be performed in a differing order, or be performed concurrently, that some operations can be performed in any order or omitted, and that some operations can be performed in parallel. Similarly, while several specific implementation details have been discussed in the context of the above discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0210] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With respect to the devices in the above-described embodiments, in which various modules perform operations, the specific manner in which the various modules perform the operations has been described in detail in the embodiments relating to the method. Here, no detailed explanation will be given.

Claims

1. A method of generating a scene terrain, characterized by, The method comprises: determining a terrain type corresponding to a terrain tile to be drawn; if the terrain type is a basic type, determining a height corresponding to each voxel in the terrain tile under the basic type as a target height corresponding to the voxel; if the terrain type is a composite type, performing mesh segmentation on the terrain tile to obtain a plurality of target meshes corresponding to the terrain tile, wherein the composite type terrain is composed of a basic type terrain and an overlay type terrain; for each target mesh, determining a basic height corresponding to each voxel in the target mesh under the basic type, and adjusting the basic height based on height information corresponding to the overlay type to obtain a target height corresponding to the voxel; according to the target height corresponding to each voxel in the terrain tile and the terrain type, drawing the voxel to obtain a scene terrain under the terrain type.

2. The method of claim 1, wherein, The method comprises: for each target mesh, determining a basic height corresponding to each voxel in the target mesh under the basic type, comprises: for each voxel, performing two-dimensional noise sampling according to position information corresponding to the voxel to obtain noise information corresponding to the voxel; 3. The method of claim 1, wherein, determining a height corresponding to the noise information as the basic height according to a maximum height and a minimum height corresponding to the basic type. The overlay type is a lake type; The method comprises: determining a corresponding basic mesh and a lake mesh in the target mesh, and updating the height of a voxel adjacent to the lake mesh in the basic mesh to a preset height; for each basic mesh, performing interpolation processing according to position information of each voxel in the basic mesh and a height corresponding to a mesh vertex of the basic mesh to obtain a target height corresponding to the voxel; 4. The method of claim 1, wherein, for each lake mesh, performing two-dimensional noise sampling according to position information of each voxel in the lake mesh to obtain noise information corresponding to the voxel, and determining a height corresponding to the noise information as the target height corresponding to the voxel according to a maximum height and a minimum height in height information of the lake type. The overlay type is an island type; The method comprises: determining a corresponding basic mesh, an island mesh and a lake mesh in the target mesh, updating the height of a voxel adjacent to the lake mesh in the basic mesh and the height of a voxel adjacent to the lake mesh in the island mesh to a preset height, and updating the height of a voxel of a target vertex of the island mesh to an island height corresponding to the island type; for each basic mesh, performing interpolation processing according to position information of each voxel in the basic mesh and a height corresponding to a mesh vertex of the basic mesh to obtain a target height corresponding to the voxel; For each island grid, target heights of voxels in the island grid are obtained by interpolation according to position information of each voxel in the island grid and heights corresponding to grid vertices of the island grid; For each lake grid, noise information corresponding to each voxel in the lake grid is obtained by two-dimensional noise sampling according to position information of the voxel, and a height corresponding to the noise information is determined as the target height of the voxel according to a maximum height and a minimum height in the height information of the island type.

5. The method according to claim 3 or 4, characterized in that, The obtaining of the target height of each voxel in the base grid by interpolation according to position information of the voxel and heights corresponding to grid vertices of the base grid comprises: For each voxel, first interpolation information and second interpolation information are obtained according to position information of the voxel; A first height and a second height are determined according to the first interpolation information, the second interpolation information, and vertex heights of the base grid; The target height is determined according to the first height and the second height and the position information of the voxel.

6. The method of claim 1, wherein, The rendering of each voxel in the terrain tile according to the target height of the voxel and the terrain type to obtain a scene terrain under the terrain type comprises: If the terrain type is a base type, a terrain corresponding to each voxel is rendered according to the target height of the voxel to obtain the scene terrain; If the terrain type is a composite type, terrain factors included in the terrain type are determined; The voxel is rendered according to the target height of the voxel and the terrain factors to obtain the scene terrain.

7. The method of claim 6, wherein, The rendering of each voxel in the terrain tile according to the target height of the voxel and the terrain factors to obtain the scene terrain comprises: A base scene terrain is obtained by rendering a terrain corresponding to each voxel according to the target height of the voxel; If a water flow factor is included in the terrain factors, a water flow factor is filled in voxels with a target height lower than a water flow height in the base scene terrain to obtain the scene terrain; If a cave factor is included in the terrain factors, each voxel in the terrain tile is subjected to three-dimensional noise sampling, and voxels with noise information less than or equal to zero obtained after sampling are deleted to obtain the scene terrain.

8. A scene terrain generation apparatus characterized by comprising: The device comprises: A first determination module configured to determine a terrain type corresponding to a terrain tile to be rendered; A second determination module configured to, if the terrain type is a base type, determine a height corresponding to each voxel in the terrain tile under the base type as a target height of the voxel; A segmentation module configured to, if the terrain type is a composite type, segment the terrain tile to obtain a plurality of target grids corresponding to the terrain tile, wherein the composite type terrain is composed of a base type terrain and a superimposed type terrain. a third determining module, configured to determine, for each of the target grids, a corresponding base height of each voxel in the target grid under the base type, and adjust the base height based on height information corresponding to the superimposition type, to obtain a corresponding target height of the voxel; a rendering module, configured to render each voxel in the terrain tile according to the target height corresponding to the voxel and the terrain type, to obtain a scene terrain under the terrain type.

9. A computer readable medium having stored thereon a computer program, characterized in that The program, when executed by a processing apparatus, implements the steps of the method of any one of claims 1-7.

10. An electronic device, comprising: comprising: a storage device having stored thereon a computer program; a processing apparatus configured to execute the computer program in the storage device to implement the steps of the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Three-dimensional landform model generation method and device, processor and electronic device

    CN110738734A

  • Scene map generation method and device, storage medium and computer equipment

    CN115006842A