A three-dimensional terrain programmatic secondary editing optimization method, device and electronic equipment

Through the three-dimensional terrain programmed secondary editing and optimization method, users can adjust and integrate the terrain height map and vegetation community map generated by AI to generate a three-dimensional scene that meets personalized needs, solving the problem that terrain height maps in the existing technology are difficult to satisfy users. The problem of demand improves the flexibility and authenticity of the scene.

CN118052948BActive Publication Date: 2024-09-06LUNGFISH CULTURE TECH (DALIAN) CO LTD
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202410445320.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-15
Publication Date
2024-09-06
Estimated Expiration
2044-04-15

AI Technical Summary

Technical Problem

Existing AI-generated terrain height maps are difficult to meet users' personalized needs and lack flexibility and diversity.

Method used

Provides a 3D terrain programmed secondary editing and optimization method. By obtaining the terrain height map and vegetation community map, using user-specified brush tools to adjust the terrain and vegetation, and integrating the adjusted data to generate a 3D scene, supporting lighting , editing of materials and special effects.

Benefits of technology

The secondary editing of the terrain height map is realized, and the generated three-dimensional scene can better meet the personalized needs of users and improve the authenticity and diversity of terrain and vegetation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118052948B
    Figure CN118052948B
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, device and electronic device for programmatic secondary editing and optimization of three-dimensional terrain. Relating to the field of three-dimensional model technology, the above method includes: obtaining a terrain height map and a vegetation community map; receiving a user's instruction to use a first brush tool, and adjusting the height value of the area indicated by the first brush tool in the terrain height map; receiving a user's instruction to use a second brush tool, and adjusting the vegetation community in the area indicated by the second brush tool in the vegetation community map; generating a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map. The solution provided by the embodiments of the present invention can realize secondary editing of the terrain height map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of three-dimensional model technology, and in particular to a three-dimensional terrain programmatic secondary editing optimization method, device and electronic equipment. Background Art

[0002] In the application fields of virtual reality and simulated environments, AI (Artificial Intelligence) and procedural terrain generation technology have always played a vital role. AI can generate terrain height maps through algorithms and automatically provide users with virtual environments. Summary of the invention

[0003] The purpose of the embodiment of the present invention is to provide a method, device and electronic device for programmatic secondary editing optimization of three-dimensional terrain to achieve secondary editing of terrain height map. The specific technical solution is as follows:

[0004] In a first aspect of an embodiment of the present invention, a three-dimensional terrain programmatic secondary editing optimization method is first provided, the method comprising:

[0005] Get terrain height map and vegetation community map;

[0006] receiving a user's instruction to use a first brush tool, and adjusting the height value of the area indicated by the first brush tool in the terrain height map; wherein the first brush tool includes a height modification brush for modifying the height value, a smoothing brush for smoothing the terrain, and a terrain brush for adding terrain;

[0007] receiving a user instruction to use a second brush tool, and adjusting the vegetation community in the area indicated by the second brush tool in the vegetation community map; wherein the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types;

[0008] A three-dimensional scene is generated based on the adjusted terrain height map and the adjusted vegetation community map.

[0009] In a possible embodiment, after receiving the instruction from the user to use the first brush tool to adjust the height of the area indicated by the first brush tool in the terrain height map, the method further includes:

[0010] The external additional terrain height map is merged with the adjusted terrain height map to obtain a merged terrain height map; wherein the height value of each point in the merged terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map;

[0011] The generating of a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map includes:

[0012] A three-dimensional scene is generated based on the fused terrain height map and the adjusted vegetation community map.

[0013] In a possible embodiment, after receiving the instruction from the user to use the second brush tool to adjust the vegetation community in the area indicated by the second brush tool in the vegetation community map, the method further includes:

[0014] The external additional vegetation community map is merged with the adjusted vegetation community map to obtain a merged vegetation community map; wherein the vegetation community in each area of ​​the merged vegetation community map is obtained based on the combination of the external additional vegetation community map and the vegetation community in each area of ​​the adjusted vegetation community map;

[0015] The generating of a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map includes:

[0016] A three-dimensional scene is obtained based on the adjusted terrain height map and the fused vegetation community map.

[0017] In a possible embodiment, generating a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map includes:

[0018] Generate a basic terrain mesh white model based on the adjusted terrain height map;

[0019] Adding terrain material to the basic terrain mesh white model to obtain a basic terrain mesh;

[0020] A three-dimensional scene is generated based on the basic terrain grid and the adjusted vegetation community map.

[0021] In a possible embodiment, after generating the three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map, the method further includes:

[0022] The three-dimensional scene is edited by an editor to obtain an edited three-dimensional scene, wherein the editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

[0023] In a second aspect of the embodiment of the present invention, a three-dimensional terrain programmatic secondary editing and optimization device is also provided, the device comprising:

[0024] Acquisition module, used to obtain terrain height map and vegetation community map;

[0025] A first adjustment module, configured to receive an instruction from a user to use a first brush tool, and adjust the height value of the area indicated by the first brush tool in the terrain height map; wherein the first brush tool includes a height modification brush for modifying the height value, a smoothing brush for smoothing the terrain, and a terrain brush for adding terrain;

[0026] a second adjustment module, configured to receive an instruction from a user to use a second brush tool, and to adjust the vegetation community in the area indicated by the second brush tool in the vegetation community map; wherein the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types;

[0027] The scene generation module is used to generate a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map.

[0028] In a possible embodiment, the device further includes:

[0029] A first fusion module is used to fuse the external additional terrain height map with the adjusted terrain height map to obtain a fused terrain height map; wherein the height value of each point in the fused terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map;

[0030] The scene generation module is specifically used for:

[0031] A three-dimensional scene is generated based on the fused terrain height map and the adjusted vegetation community map.

[0032] In a possible embodiment, the device further includes:

[0033] The second fusion module is used to fuse the external additional vegetation community map with the adjusted vegetation community map to obtain a fused vegetation community map; wherein the vegetation community in each area in the fused vegetation community map is obtained based on the combination of the external additional vegetation community map and the vegetation community in each area in the adjusted vegetation community map;

[0034] The scene generation module is specifically used for:

[0035] A three-dimensional scene is obtained based on the adjusted terrain height map and the fused vegetation community map.

[0036] In a possible embodiment, the scene generation module is specifically used to:

[0037] Generate a basic terrain mesh white model based on the adjusted terrain height map;

[0038] Adding terrain material to the basic terrain mesh white model to obtain a basic terrain mesh;

[0039] A three-dimensional scene is generated based on the basic terrain grid and the adjusted vegetation community map.

[0040] In a possible embodiment, the device further includes:

[0041] The editing module is used to edit the three-dimensional scene through an editor to obtain an edited three-dimensional scene; wherein the editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

[0042] In a third aspect of an embodiment of the present invention, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0043] Memory, used to store computer programs;

[0044] The processor is used to implement any one of the method steps of the first aspect when executing the program stored in the memory.

[0045] In another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the method steps of the first aspect is implemented.

[0046] An embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any one of the method steps of the first aspect described above.

[0047] Beneficial effects of the embodiments of the present invention:

[0048] The programmatic secondary editing and optimization method for three-dimensional terrain provided by an embodiment of the present invention, when receiving an instruction from a user to use a first brush tool, adjusts the height value of the area indicated by the first brush tool in the terrain height map to obtain an adjusted terrain height map; when receiving an instruction from a user to use a second brush tool, adjusts the vegetation community of the area indicated by the second brush tool in the vegetation community map to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0049] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0050] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0052] Figure 1 A schematic diagram of the flow of a first three-dimensional terrain programmatic secondary editing and optimization method provided by an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of the flow of a second three-dimensional terrain programmatic secondary editing and optimization method provided by an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of a flow chart of a third three-dimensional terrain programmatic secondary editing and optimization method provided by an embodiment of the present invention;

[0055] Figure 4 A schematic diagram of the flow of a fourth three-dimensional terrain programmatic secondary editing and optimization method provided by an embodiment of the present invention;

[0056] Figure 5 A schematic diagram of a fifth three-dimensional terrain programmatic secondary editing and optimization method provided by an embodiment of the present invention;

[0057] Figure 6 A topological diagram of a three-dimensional terrain programmatic secondary editing optimization method provided by an embodiment of the present invention;

[0058] Figure 7 A schematic diagram of the structure of a three-dimensional terrain programmatic secondary editing and optimization device provided by an embodiment of the present invention;

[0059] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention belong to the scope of protection of the present invention.

[0061] In related technologies, AI can generate terrain height maps through algorithms to automatically provide users with a virtual environment. However, although the terrain height maps generated by AI have certain authenticity and diversity, they are difficult to meet the personalized needs of users.

[0062] Based on this, the embodiment of the present invention provides a three-dimensional terrain programmatic secondary editing optimization method, see Figure 1 , which is a flow chart of a first three-dimensional terrain programmatic secondary editing and optimization method provided in an embodiment of the present invention, wherein the method includes S101-S104.

[0063] S101, obtaining a terrain height map and a vegetation community map.

[0064] In S101, the terrain height map is a two-dimensional image composed of the height values ​​at each pixel position, which can be used to represent the outline of the map and the basic terrain trend. Among them, the height value is used to indicate the altitude of the terrain. The terrain height map can simulate plateaus, mountains, hills, plains, and basins, for example, plateau terrain with an altitude of more than 1,000 meters, little ground undulation, and steep edges, and mountain terrain with an altitude of more than 500 meters, steep slopes, deep valleys, and continuous mountains.

[0065] In a possible embodiment, the terrain height map is a grayscale map, wherein the grayscale value corresponding to each pixel in the grayscale map is also the height value, and the range of the height value corresponding to each pixel is 0 to 255, where a height value of 0 indicates the lowest point of the map, and a height value of 255 indicates the highest point of the map.

[0066] The vegetation community map is a two-dimensional image composed of the grayscale values ​​at each pixel position, which can be used to represent the geographical distribution of different vegetation communities. Among them, the grayscale value at each pixel position is used to indicate different vegetation types. For example, if the grayscale value at a certain pixel position is 100, it means that the vegetation at the pixel position is a pine tree; if the grayscale value at a certain pixel position is 200, it means that the vegetation at the pixel position is a lotus. The vegetation community map can simulate the geographical distribution of vegetation such as pine trees, sycamore trees, peach trees, ginkgo trees, and lotus, as well as various vegetation communities.

[0067] It should be noted that the terrain height map and the vegetation community map can be automatically generated by AI according to the prompt word. For example, if the prompt word is to generate a terrain height map with a lake, then the AI ​​automatically generates the corresponding terrain height map according to the prompt word; if the prompt word is to generate a vegetation community map with a sycamore tree, then the AI ​​automatically generates the corresponding vegetation community map according to the prompt word.

[0068] S102, receiving an instruction from a user to use a first brush tool, and adjusting a height value of an area indicated by the first brush tool in a terrain height map.

[0069] In S102 , the first brush tool includes a height modification brush for modifying a height value, a smoothing brush for smoothing a terrain, and a terrain brush for adding a terrain.

[0070] The height modification brush is used to modify the height value, and different height modification brushes correspond to different height change amplitudes. For example, if the user uses a height modification brush with a height change amplitude of +100 to pass through area 1 in the terrain height map, the height values ​​of all points in area 1 will all increase by 100. If the user uses a height modification brush with a height change amplitude of -50 to pass through area 2 in the terrain height map, the height values ​​of all points in area 2 will all decrease by 50.

[0071] The smoothing brush is used to smooth the terrain. Specifically, the height value of each point in the area where the smoothing brush passes is determined by calculating the average height value of all points in the area where the smoothing brush passes. For example, if the user uses the smoothing brush to pass through area 3 in the terrain height map, and the height values ​​of all points in area 3 are 50, 100, and 150 respectively, then the height value of each point in area 3 is 100.

[0072] The terrain brush is used to add terrain. Specifically, different terrains are created by adjusting the height values ​​of each point in the area where the terrain brush passes. For example, if the user uses the terrain brush representing plateau terrain to pass through area 4 in the terrain height map, the height values ​​of each point in area 4 will be adjusted, such as adjusting the height values ​​of each point in area 4 to 2000 meters, thereby creating a plateau terrain in the terrain height map.

[0073] The shape of the brush may be circular, square or triangular, and the thickness and size of the brush may also be adjusted. The embodiment of the present invention does not specifically limit the shape, thickness and size of the brush.

[0074] S103, receiving an instruction from a user to use a second brush tool, and adjusting the vegetation community in the area indicated by the second brush tool in the vegetation community map.

[0075] In S103, the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types. For example, vegetation brush 1 corresponds to pine trees, vegetation brush 2 corresponds to sycamore trees, vegetation brush 3 corresponds to peach trees, vegetation brush 4 corresponds to ginkgo trees, and vegetation brush 5 corresponds to lotus. The number of vegetation brushes can be one or more, and the embodiment of the present invention does not specifically limit the number of vegetation brushes and the type of vegetation corresponding to each vegetation brush.

[0076] According to the user's instruction to use the second brush tool, the vegetation community is adjusted for the area indicated by the second brush tool in the vegetation community map, and the vegetation type and vegetation density can be adjusted. For example, it is assumed that vegetation brush 1 corresponds to pine trees, and the corresponding grayscale value is 100, vegetation brush 2 corresponds to sycamore trees, and the corresponding grayscale value is 200, vegetation brush 3 corresponds to peach trees, and the corresponding grayscale value is 300, vegetation brush 4 corresponds to ginkgo trees, and the corresponding grayscale value is 400, and vegetation brush 5 corresponds to lotus flowers, and the corresponding grayscale value is 500. If the user uses vegetation brush 1 to pass over area 2 in the vegetation community map, the grayscale value of each point in area 2 is adjusted to 100, indicating that the vegetation type in area 2 in the vegetation community map is pine trees.

[0077] S104, generating a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map.

[0078] Specifically, based on the adjusted terrain height map and the adjusted vegetation community map, the process of generating a three-dimensional scene is as follows:

[0079] 1. Determine the height information of each pixel based on the height value of the adjusted terrain height map.

[0080] 2. Determine the vegetation information of each pixel based on the grayscale value of the adjusted vegetation community map.

[0081] 3. Based on the height information and vegetation information at each pixel point, computer graphics techniques such as triangular mesh generation and texture mapping are used to generate a real three-dimensional scene.

[0082] By selecting the above embodiment, when receiving an instruction from the user to use the first brush tool, the height value of the area indicated by the first brush tool in the terrain height map is adjusted to obtain an adjusted terrain height map; when receiving an instruction from the user to use the second brush tool, the vegetation community of the area indicated by the second brush tool in the vegetation community map is adjusted to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0083] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0084] In one possible embodiment, see Figure 2 , is a flow chart of a second method for programmatic secondary editing and optimization of three-dimensional terrain provided by an embodiment of the present invention, which is similar to the above Figure 1 Compared with the embodiment shown, after S102, the method further includes S201, and the S104 can be implemented through S104A.

[0085] S201, fusing the external additional terrain height map with the adjusted terrain height map to obtain a fused terrain height map.

[0086] In S201, the height value of each point in the fused terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map.

[0087] In one case, the height value of each point in the fused terrain height map is the sum of the height values ​​of each point in the externally attached terrain height map and the adjusted terrain height map. For example, if the height value of a point in the externally attached terrain height map is 150, and the height value of the point in the adjusted terrain height map is 100, then the height value of the point in the fused terrain height map is 250.

[0088] In another case, the height value of each point in the fused terrain height map is the average of the height values ​​of each point in the external additional terrain height map and the adjusted terrain height map. For example, assuming that the height value of a certain point in the external additional terrain height map is 150, and the height value of the point in the adjusted terrain height map is 100, then the height value of the point in the fused terrain height map is 125. The embodiment of the present invention does not specifically limit the calculation method of the height value of each point in the fused terrain height map.

[0089] It should be noted that the external additional terrain height map can be drawn by the user or automatically generated by AI according to the prompt word. The size of the external additional terrain height map can be the same as or different from the adjusted terrain height map.

[0090] S104A, generates a three-dimensional scene based on the fused terrain height map and the adjusted vegetation community map.

[0091] In S104A, the step of generating a three-dimensional scene based on the fused terrain height map and the adjusted vegetation community map is similar to the above S104 and will not be repeated here.

[0092] By selecting the above embodiment, the external additional terrain height map is merged with the adjusted terrain height map, so that the terrain details can be enriched and the merged terrain height map can be closer to the real world.

[0093] In one possible embodiment, see Figure 3 , is a flow chart of a third three-dimensional terrain programmatic secondary editing optimization method provided by an embodiment of the present invention, which is similar to the aforementioned Figure 1 Compared with the embodiment shown, after S103, the method further includes S301, and the S104 can be implemented through S104B.

[0094] S301, fusing the externally attached vegetation community map with the adjusted vegetation community map to obtain a fused vegetation community map.

[0095] In S301, the vegetation communities in each region of the fused vegetation community map are obtained by combining the vegetation communities in each region of the externally attached vegetation community map with the vegetation communities in the adjusted vegetation community map. For example, if the vegetation community in region 3 of the externally attached vegetation community map is a pine community, and the vegetation community in region 3 of the adjusted vegetation community map is a sycamore community, then region 3 of the fused vegetation community map includes both a pine community and a sycamore community.

[0096] It should be noted that the external additional vegetation community map can be drawn by the user or automatically generated by AI according to the prompt words. The size of the external additional vegetation community map can be the same as or different from the adjusted vegetation community map.

[0097] S104B, obtaining a three-dimensional scene based on the adjusted terrain height map and the fused vegetation community map.

[0098] In S104B, the step of obtaining a three-dimensional scene based on the adjusted terrain height map and the fused vegetation community map is similar to the above S104 and will not be repeated here.

[0099] By selecting the above embodiment and fusing the external additional vegetation community map with the adjusted vegetation community map, the vegetation types can be enriched, and a more natural vegetation distribution effect can be presented in the three-dimensional scene.

[0100] In one possible embodiment, see Figure 4 , is a flow chart of a fourth three-dimensional terrain programmatic secondary editing optimization method provided by an embodiment of the present invention, which is similar to the aforementioned Figure 1 Compared with the embodiment shown, the above S104 can be implemented through S104C-S104E.

[0101] S104C, generating a basic terrain mesh white model based on the adjusted terrain height map.

[0102] In S104C, the basic terrain grid white model refers to a three-dimensional image used to represent the terrain shape, which is usually composed of grids and contains the basic shape and height information of the terrain.

[0103] In a possible embodiment, the adjusted terrain height map is a grayscale image, and the grayscale value of each pixel represents the height of the position. The adjusted terrain height map is applied to the plane grid, and the vertex positions of the grid can be adjusted according to the grayscale values ​​of the pixels, thereby generating a basic terrain grid white model.

[0104] S104D, add terrain material to the basic terrain mesh white model to obtain the basic terrain mesh.

[0105] In S104D, the terrain material includes the following attributes: color, metalness, smoothness, transparency, and bump. Among them, color is used to describe the basic color of the terrain, metalness is used to describe whether the terrain is a metal material, smoothness is used to describe the surface smoothness of the terrain, transparency is used to describe the transparency of the terrain, and bump is used to describe whether the terrain surface has concave or convex details.

[0106] In a possible embodiment, first create a new material ball, adjust the properties of the material ball, such as color, metallicity, smoothness, transparency, bumps, etc., to achieve the desired terrain effect, and drag the material ball to a certain area in the basic terrain grid white mold to add terrain material to the basic terrain grid white mold.

[0107] After adding terrain materials to the basic terrain mesh white model, various landform information such as snow, grassland, desert, etc. can be reflected on the basic terrain mesh white model.

[0108] S104E, generate a three-dimensional scene based on the basic terrain grid and the adjusted vegetation community map.

[0109] In S104E, the basic terrain grid contains the basic shape and height information of the terrain. The position and height information of each pixel can be obtained through the basic terrain grid; the position information and vegetation information of each pixel can be obtained through the adjusted vegetation community map; based on the position information, height information and vegetation information, computer graphics techniques such as triangular mesh generation and texture mapping can be used to generate a real three-dimensional scene.

[0110] By selecting the above embodiment, a basic terrain grid white mold is generated based on the adjusted terrain height map, and terrain material is added to the basic terrain grid white mold, so that the material of the terrain surface can match the shape of the terrain, giving users a realistic visual effect.

[0111] In one possible embodiment, see Figure 5 , is a flow chart of a fifth three-dimensional terrain programmatic secondary editing optimization method provided by an embodiment of the present invention, which is similar to the above Figure 1 Compared with the embodiment shown, after S104, the method further includes S501.

[0112] S501, editing a three-dimensional scene through an editor to obtain an edited three-dimensional scene.

[0113] The editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

[0114] Specifically, lighting adjustment refers to adjusting the lighting effect in a 3D scene to change the brightness and direction of the 3D scene. Specific adjustment methods include adding a main light source, a point light source, etc., and setting parameters such as the color, intensity, and position of the light source to achieve the desired lighting effect.

[0115] Terrain material property adjustment refers to adjusting the material properties of the terrain surface to change the appearance and texture of the terrain. Specific adjustment methods include adding material balls and adjusting the parameters of material balls, such as basic color, metalness, roughness, self-illumination, etc., to achieve different terrain effects.

[0116] Special effect adjustment refers to adjusting the appearance and behavior of special effects to achieve the desired effect. Specific adjustment methods include setting the particle emission position, initial state, and properties during the life cycle of the special effect, such as adjusting the particle size, color, transparency, and movement direction to achieve different special effects.

[0117] By using the above embodiment, the lighting, terrain material properties or special effects of the three-dimensional scene can be adjusted through the editor, so that the edited three-dimensional scene can be made more realistic and the fidelity of the three-dimensional scene can be improved.

[0118] In order to more clearly explain the above three-dimensional terrain programmatic secondary editing optimization method, Figure 6 For a detailed description of the above three-dimensional terrain programmatic secondary editing optimization method, see Figure 6 , which is a topological diagram of a three-dimensional terrain programmatic secondary editing optimization method provided by an embodiment of the present invention, and the above method includes steps 1 to 10.

[0119] Step 1: Pre-train the AI ​​terrain model.

[0120] Step 2: Generate a terrain height map and vegetation community map based on the pre-trained AI terrain model and prompt words.

[0121] Step 3: receiving a user's instruction to use a first brush tool, adjusting the height value of the area indicated by the first brush tool in the terrain height map, and obtaining an adjusted terrain height map.

[0122] Step 4, merging the external additional terrain height map with the adjusted terrain height map to obtain a fused terrain height map.

[0123] Step 5: Generate a basic terrain mesh white model based on the fused terrain height map.

[0124] Step 6, add terrain material to the basic terrain mesh white template to obtain the basic terrain mesh.

[0125] Step 7, receiving a user's instruction to use a second brush tool, and adjusting the vegetation community in the area indicated by the second brush tool in the vegetation community map to obtain an adjusted vegetation community map.

[0126] Step 8, fusing the externally attached vegetation community map with the adjusted vegetation community map to obtain a fused vegetation community map.

[0127] Step 9: Generate a three-dimensional scene based on the basic terrain grid and the fused vegetation community map.

[0128] Step 10: Edit the three-dimensional scene through an editor to obtain an edited three-dimensional scene.

[0129] The editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

[0130] It should be noted that Figure 6 The ⊕ in step 2, step 3, step 7, step 9, and step 10 indicates combination, in step 4 and step 8 it indicates fusion, and in step 6 it indicates addition.

[0131] Corresponding to the aforementioned three-dimensional terrain programmatic secondary editing and optimization method, the embodiment of the present invention also provides a three-dimensional terrain programmatic secondary editing and optimization device, see Figure 7 , is a schematic diagram of the structure of a three-dimensional terrain programmatic secondary editing and optimization device provided by an embodiment of the present invention, wherein the device further comprises:

[0132] The acquisition module 701 is used to acquire a terrain height map and a vegetation community map;

[0133] The first adjustment module 702 is used to receive an instruction from a user to use a first brush tool to adjust the height value of the area indicated by the first brush tool in the terrain height map; wherein the first brush tool includes a height modification brush for modifying the height value, a smoothing brush for smoothing the terrain, and a terrain brush for adding terrain;

[0134] The second adjustment module 703 is used to receive an instruction from a user to use a second brush tool, and adjust the vegetation community in the area indicated by the second brush tool in the vegetation community map; wherein the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types;

[0135] The scene generation module 704 is used to generate a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map.

[0136] By selecting the above embodiment, when receiving an instruction from the user to use the first brush tool, the height value of the area indicated by the first brush tool in the terrain height map is adjusted to obtain an adjusted terrain height map; when receiving an instruction from the user to use the second brush tool, the vegetation community of the area indicated by the second brush tool in the vegetation community map is adjusted to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0137] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0138] In a possible embodiment, the above device further includes:

[0139] The first fusion module is used to fuse the external additional terrain height map with the adjusted terrain height map to obtain a fused terrain height map; wherein the height value of each point in the fused terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map;

[0140] The above-mentioned scene generation module 704 is specifically used for:

[0141] A three-dimensional scene is generated based on the fused terrain height map and the adjusted vegetation community map.

[0142] By selecting the above embodiment, the external additional terrain height map is merged with the adjusted terrain height map, so that the terrain details can be enriched and the merged terrain height map can be closer to the real world.

[0143] In a possible embodiment, the above device further includes:

[0144] The second fusion module is used to fuse the externally attached vegetation community map with the adjusted vegetation community map to obtain a fused vegetation community map; wherein the vegetation community in each area in the fused vegetation community map is obtained by combining the externally attached vegetation community map with the vegetation community in each area in the adjusted vegetation community map;

[0145] The above-mentioned scene generation module 704 is specifically used for:

[0146] Based on the adjusted terrain height map and the fused vegetation community map, a three-dimensional scene is obtained.

[0147] By selecting the above embodiment and fusing the external additional vegetation community map with the adjusted vegetation community map, the vegetation types can be enriched, and a more natural vegetation distribution effect can be presented in the three-dimensional scene.

[0148] In a possible embodiment, the scene generation module 704 is specifically used to:

[0149] Generate a basic terrain mesh white model based on the adjusted terrain height map;

[0150] Add terrain material to the basic terrain mesh white model to obtain the basic terrain mesh;

[0151] Generate a three-dimensional scene based on the basic terrain grid and the adjusted vegetation community map.

[0152] By selecting the above embodiment, a basic terrain grid white mold is generated based on the adjusted terrain height map, and terrain material is added to the basic terrain grid white mold, so that the material of the terrain surface can match the shape of the terrain, giving users a realistic visual effect.

[0153] In a possible embodiment, the above device further includes:

[0154] The editing module is used to edit the three-dimensional scene through an editor to obtain an edited three-dimensional scene; wherein the editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

[0155] By using the above embodiment, the lighting, terrain material properties or special effects of the three-dimensional scene can be adjusted through the editor, so that the edited three-dimensional scene can be made more realistic and the fidelity of the three-dimensional scene can be improved.

[0156] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.

[0157] Memory 803, used for storing computer programs;

[0158] The processor 801 is used to implement any method step of the above-mentioned three-dimensional terrain programmatic secondary editing and optimization method when executing the program stored in the memory 803.

[0159] By selecting the above embodiment, when receiving an instruction from the user to use the first brush tool, the height value of the area indicated by the first brush tool in the terrain height map is adjusted to obtain an adjusted terrain height map; when receiving an instruction from the user to use the second brush tool, the vegetation community of the area indicated by the second brush tool in the vegetation community map is adjusted to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0160] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0161] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0162] The communication interface is used for communication between the above electronic device and other devices.

[0163] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0164] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0165] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any method step of the above-mentioned three-dimensional terrain programmatic secondary editing and optimization method is implemented.

[0166] By selecting the above embodiment, when receiving an instruction from the user to use the first brush tool, the height value of the area indicated by the first brush tool in the terrain height map is adjusted to obtain an adjusted terrain height map; when receiving an instruction from the user to use the second brush tool, the vegetation community of the area indicated by the second brush tool in the vegetation community map is adjusted to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0167] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0168] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the three-dimensional terrain programmatic secondary editing and optimization methods in the above embodiments.

[0169] By selecting the above embodiment, when receiving an instruction from the user to use the first brush tool, the height value of the area indicated by the first brush tool in the terrain height map is adjusted to obtain an adjusted terrain height map; when receiving an instruction from the user to use the second brush tool, the vegetation community of the area indicated by the second brush tool in the vegetation community map is adjusted to obtain an adjusted vegetation community map; based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, thereby realizing secondary editing of the terrain height map.

[0170] Moreover, since the adjusted terrain height map is obtained based on the user's instructions using the first brush tool, and the adjusted vegetation community maps are obtained based on the user's instructions using the second brush tool, the three-dimensional scene generated based on the adjusted terrain height map and the adjusted vegetation community map can better meet the user's personalized needs.

[0171] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0172] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0173] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0174] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A three-dimensional terrain programmatic secondary editing and optimization method, characterized in that: The method comprises: Obtain a terrain height map and a vegetation community map; wherein the terrain height map is a two-dimensional image composed of the height values ​​at each pixel point; and the vegetation community map is a two-dimensional image composed of the grayscale values ​​at each pixel point; receiving a user's instruction to use a first brush tool, and adjusting the height value of the area indicated by the first brush tool in the terrain height map; wherein the first brush tool includes a height modification brush for modifying the height value, a smoothing brush for smoothing the terrain, and a terrain brush for adding terrain; the height modification brush is used to modify the height value of the indicated area in the terrain height map, and different height modification brushes correspond to different height change amplitudes; the height value of each point in the area of ​​the terrain height map passed by the smoothing brush is determined by calculating the average value of the height values ​​of all points in the area passed by the smoothing brush, and the terrain brush shapes different terrains by adjusting the height value of each point in the area of ​​the terrain height map passed by the smoothing brush; receiving a user instruction to use a second brush tool, and adjusting the vegetation community in the area indicated by the second brush tool in the vegetation community map; wherein the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types; A three-dimensional scene is generated based on the adjusted terrain height map and the adjusted vegetation community map.

2. The method according to claim 1, characterized in that After receiving the instruction from the user to use the first brush tool to adjust the height of the area indicated by the first brush tool in the terrain height map, the method further includes: The external additional terrain height map is merged with the adjusted terrain height map to obtain a merged terrain height map; wherein the height value of each point in the merged terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map; The generating of a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map includes: A three-dimensional scene is generated based on the fused terrain height map and the adjusted vegetation community map.

3. The method according to claim 1, characterized in that After receiving the instruction from the user to use the second brush tool to adjust the vegetation community in the area indicated by the second brush tool in the vegetation community map, the method further includes: The external additional vegetation community map is merged with the adjusted vegetation community map to obtain a merged vegetation community map; wherein the vegetation community in each area of ​​the merged vegetation community map is obtained based on the combination of the external additional vegetation community map and the vegetation community in each area of ​​the adjusted vegetation community map; The generating of a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map includes: A three-dimensional scene is obtained based on the adjusted terrain height map and the fused vegetation community map.

4. The method according to claim 1, characterized in that: Based on the adjusted terrain height map and the adjusted vegetation community map, a three-dimensional scene is generated, including: Generate a basic terrain mesh white model based on the adjusted terrain height map; Adding terrain material to the basic terrain mesh white model to obtain a basic terrain mesh; A three-dimensional scene is generated based on the basic terrain grid and the adjusted vegetation community map.

5. The method according to claim 1, characterized in that After generating the three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map, the method further includes: The three-dimensional scene is edited by an editor to obtain an edited three-dimensional scene; wherein the editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

6. A three-dimensional terrain programmatic secondary editing and optimization device, characterized in that: The device comprises: The acquisition module is used to acquire a terrain height map and a vegetation community map; wherein the terrain height map is a two-dimensional image composed of the height values ​​at each pixel point; and the vegetation community map is a two-dimensional image composed of the grayscale values ​​at each pixel point; a first adjustment module, for receiving an instruction from a user to use a first brush tool to adjust a height value of an area indicated by the first brush tool in the terrain height map; wherein the first brush tool includes a height modification brush for modifying a height value, a smoothing brush for smoothing a terrain, and a terrain brush for adding a terrain; the height modification brush is used to modify a height value of an indicated area in the terrain height map, and different height modification brushes correspond to different height change amplitudes; the height value of each point in the area of ​​the terrain height map passed by the smoothing brush is determined by calculating an average value of the height values ​​of all points in the area passed by the smoothing brush, and the terrain brush shapes different terrains by adjusting the height values ​​of each point in the area of ​​the terrain height map passed by the smoothing brush; a second adjustment module, configured to receive an instruction from a user to use a second brush tool, and to adjust the vegetation community in the area indicated by the second brush tool in the vegetation community map; wherein the second brush tool includes at least one vegetation brush for adding vegetation, and different vegetation brushes correspond to different vegetation types; The scene generation module is used to generate a three-dimensional scene based on the adjusted terrain height map and the adjusted vegetation community map.

7. The device according to claim 6, characterized in that The device also includes: A first fusion module is used to fuse the external additional terrain height map with the adjusted terrain height map to obtain a fused terrain height map; wherein the height value of each point in the fused terrain height map is calculated based on the height value of each point in the external additional terrain height map and the adjusted terrain height map; The scene generation module is specifically used for: A three-dimensional scene is generated based on the fused terrain height map and the adjusted vegetation community map.

8. The device according to claim 6, characterized in that The device also includes: The second fusion module is used to fuse the external additional vegetation community map with the adjusted vegetation community map to obtain a fused vegetation community map; wherein the vegetation community in each area in the fused vegetation community map is obtained based on the combination of the external additional vegetation community map and the vegetation community in each area in the adjusted vegetation community map; The scene generation module is specifically used for: A three-dimensional scene is obtained based on the adjusted terrain height map and the fused vegetation community map.

9. The device according to claim 6, characterized in that The scene generation module is specifically used for: Generate a basic terrain mesh white model based on the adjusted terrain height map; Adding terrain material to the basic terrain mesh white model to obtain a basic terrain mesh; A three-dimensional scene is generated based on the basic terrain grid and the adjusted vegetation community map.

10. The device according to claim 6, characterized in that The device also includes: The editing module is used to edit the three-dimensional scene through an editor to obtain an edited three-dimensional scene; wherein the editor includes at least one of the following functions: lighting adjustment, terrain material property adjustment, and special effect adjustment.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor is used to implement any method step of claims 1-5 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Image editing system, method and device

    CN109448078A

  • Terrain editing method and device

    CN109671162A

  • Game scene generation method and device in game, electronic equipment and storage medium

    CN111318022A

  • Height map generation method, device and equipment, and storage medium

    CN111870953A

  • Method and device for rendering mountain in three-dimensional virtual scene of application program

    CN112927365A