Method and device for generating three-dimensional terrain scene, equipment and medium
By aligning the GIS data and three-dimensional image tools in the geographic information system software, the identification data of three-dimensional scenes is generated, and the complexity and inefficiency of manually adjusting and placing terrain and scene elements in the existing technology is solved, and efficient and natural three-dimensional scene generation is achieved, enhancing the sense of reality.
Patent Information
- Application Number
- CN202510246451.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-06-20
AI Technical Summary
When creating a simulated driving three-dimensional scene, the existing technology relies on manual adjustment of terrain information and placement of scene elements. The operation is complex and inefficient, making it difficult to achieve a natural and reasonable layout, resulting in a general sense of reality in the three-dimensional scene.
After importing the downloaded GIS data and target three-dimensional image tools into the geographic information system software according to the drawn line data map for origin alignment, and layer division of the resource map and data layering of the GIS data, the target terrain corresponding to scene information is generated in the three-dimensional engine based on the hierarchical identification data.
It improves the production efficiency of three-dimensional scenes, realizes a natural and reasonable layout, enhances the realism of three-dimensional scenes, and reduces the need for manual adjustment and placement.
Smart Images

Figure CN120182525A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of image data processing. Specifically, it relates to a method, device, equipment, and medium for generating a three-dimensional terrain scene. Background Art
[0002] When making a simulated driving three-dimensional scene, it is necessary to brush the terrain and place models such as turf, vegetation, buildings, bridges, and roads into the three-dimensional engine to simulate various three-dimensional scenes.
[0003] Currently, a line description file is mainly made according to railway maintenance data, an import tool is made in the scene, and the line data is automatically imported. Then, based on the line real-shot video and the generated line, models of various scene elements such as manually brushing the terrain, turf, vegetation, placing buildings, bridges, and roads are put into the three-dimensional engine.
[0004] However, in the three-dimensional engine, relying on manual adjustment of terrain information, the operation is relatively complex, and the accuracy of the operation is difficult to guarantee. At the same time, since it is necessary to manually place models of various scene elements, the efficiency is low, and it is difficult to achieve a natural and reasonable layout, making the realism of the three-dimensional scene average. Summary of the Invention
[0005] In view of this, the purpose of this application is to provide a method, device, equipment, and medium for generating a three-dimensional terrain scene. By aligning the downloaded GIS data and the target three-dimensional image tool with the origin according to the drawn line data map and dividing the resource map into layers and the GIS data into data layers, based on the identification data generated by layering, the target terrain corresponding to the scene information is generated in the three-dimensional engine, no longer relying on manual adjustment of terrain information, nor manually placing models of various scene elements, improving the production efficiency of the three-dimensional scene, and being more likely to achieve a natural and reasonable layout, thereby improving the realism of the three-dimensional scene.
[0006] In a first aspect, an embodiment of this application provides a method for generating a three-dimensional terrain scene, and the generation method includes:
[0007] Determine the scene information for which a three-dimensional scene needs to be constructed, draw the line data corresponding to the scene information based on a preset line drawing tool, and import the line data into the target three-dimensional image tool to draw a line data map of the line data; wherein, the line data map at least includes the trend data, curve data, and slope data of the line data;
[0008] Obtain GIS data of multiple dimensions under the described scenario information, and import the GIS data and the line data map into geographic information system software for origin alignment; wherein, the GIS data of multiple dimensions at least includes data of elevation maps, railway maps, road network maps, building maps, urban road networks, resource maps, and satellite maps; the elevation map includes height data of the terrain.
[0009] Based on the resource types of the resource map, layer and mark the resources in the resource map to obtain a resource map divided into multiple layers, and import the resource map with divided layers into the target 3D image tool. Based on the curve data, slope data of the line data and the height data of the terrain in the elevation map, perform repeated fitting to make the curve data, slope data fully match the height data; wherein, resources in different layers correspond to different colors.
[0010] Import the GIS data into the target 3D image tool for layering, determine the corresponding data identifiers respectively to generate corresponding different types of identification data, and generate the target terrain corresponding to the scenario information in the 3D engine based on the identification data; wherein, the dimensions of the identification data and the GIS data correspond.
[0011] In a possible implementation manner, the importing the GIS data and the drawn line data map into geographic information system software for origin alignment includes:
[0012] Import the GIS data and the drawn line data map into geographic information system software, and arbitrarily select three target points on the satellite map that are not on a straight line; wherein, the target point is the central position of the area where the target point is located.
[0013] Based on the three target points arbitrarily selected on the satellite map, determine the three target points in all the corresponding maps in the GIS data and the line data map, and overlap and align the three target points of all the maps.
[0014] In a possible implementation manner, the method for generating the 3D terrain scene further includes:
[0015] Determine the fixed area of the target layer for sampling the resource map, use the fixed area as sampling points to sample the target layer of the resource map, determine the color depth of each sampling point in the target layer to obtain the sampled target layer.
[0016] Mark the target layer based on the color depth of each sampling point in the target layer to add corresponding target attributes to obtain the sampled target layer.
[0017] In a possible implementation, the route data map includes route location information; and the repeatedly fitting based on the curve data, slope data of the route data and the height data of the terrain in the elevation map includes:
[0018] Importing the elevation map and the line data map into the target three-dimensional image tool, generating a corresponding elevation map terrain based on the height data of the elevation map, and calculating the orthographic projection of the line of the line data map in the elevation map terrain while keeping the line position information of the line data map unchanged; wherein the orthographic projection corresponds to a projection point;
[0019] Acquire multiple sampling points on the line based on a preset sampling distance, and calculate a first distance between each sampling point and a projection point corresponding to the orthographic projection;
[0020] A plurality of groups of adjacent sampling points corresponding to all the sampling points are determined, an average distance between the adjacent sampling points is calculated based on a first distance between two of the adjacent sampling points, and the elevation map terrain is lifted or lowered based on the average distance of all the adjacent sampling points.
[0021] In a possible implementation, generating the target terrain corresponding to the scene information in the three-dimensional engine based on the identification data includes:
[0022] Based on a preset target 3D image tool and a data sharing plug-in of the 3D engine, the identification data is dynamically transferred to the 3D engine, and the identification data is replaced with corresponding scene resources in the 3D engine to generate an internal scene terrain of the 3D engine;
[0023] Determine the location information of the scene resource in the resource map, and select the map resource or model resource corresponding to the scene resource in the resource library of the three-dimensional engine based on the scene resource location information and the data identifier to replace the resource, so as to obtain the target terrain corresponding to the scene information.
[0024] In a possible implementation, the method for generating a three-dimensional terrain scene further includes:
[0025] Based on the preset level segmentation plug-in, the target terrain is segmented into multiple small levels of target area size, and index information of all small levels is generated; wherein the small levels are stored in the target storage area;
[0026] Based on the position information of the target character in the small level, the target small level to be loaded is determined, and based on the index information of the target small level, the target small level is found in the target storage area to load the scene corresponding to the target small level.
[0027] In a possible implementation manner, the method for generating the three-dimensional terrain scene further includes:
[0028] Converting the line data into a common CSV format through a format conversion plug-in of a preset three-dimensional engine to obtain a line data file in the CSV format recognizable by a target three-dimensional image tool; wherein, the format conversion plug-in is a plug-in of the preset three-dimensional engine;
[0029] Importing the line data file in the CSV format into the target three-dimensional image tool, and reading the line data file through the target three-dimensional image tool to draw a line data graph of the line data.
[0030] In a second aspect, an embodiment of the present application further provides a device for generating a three-dimensional terrain scene, and the generating device includes:
[0031] A first drawing module, configured to determine scene information for constructing a three-dimensional scene, draw and generate line data corresponding to the scene information based on a preset line drawing tool, and import the line data into a target three-dimensional image tool to draw a line data graph of the line data; wherein, the line data graph at least includes trend data, curve data, and slope data of the line data;
[0032] An acquisition module, configured to acquire GIS data in multiple dimensions under the scene information, and import the GIS data and the line data graph into a geographic information system software for origin alignment; wherein, the GIS data in multiple dimensions at least includes data of an elevation map, a railway map, a road network map, a building map, an urban road network, a resource map, and a satellite map; the elevation map includes height data of the terrain;
[0033] A layering module, configured to perform data layering and marking on the resources in the resource map based on the resource types in the resource map to obtain a resource map divided into multiple layers, and import the resource map with layers divided into the target three-dimensional image tool, and perform repeated fitting based on the curve data, slope data of the line data, and height data of the terrain in the elevation map, so that the curve data and slope data are completely matched with the height data; wherein, resources in different layers correspond to different colors;
[0034] A generation module, configured to import the GIS data into the target three-dimensional image tool for layering, determine corresponding data identifiers respectively to generate corresponding different types of identifier data, and generate a target terrain corresponding to the scene information in a three-dimensional engine based on the identifier data; wherein, the identifier data corresponds to the dimension of the GIS data.
[0035] In a possible implementation manner, the acquisition module is specifically configured to:
[0036] Import the GIS data and the drawn route data map into geographic information system software, and arbitrarily select three target points on the satellite map that are not on a straight line; wherein the target point is the center position of the area where the target point is located;
[0037] Based on three target points randomly selected on the satellite image, three target points in all the images corresponding to the GIS data and the route data image are determined, and the three target points in all the images are overlapped and aligned.
[0038] In a possible implementation manner, the device for generating a three-dimensional terrain scene further includes:
[0039] A sampling module, used to determine a fixed area for sampling a target layer of the resource map, use the fixed area as a sampling point to sample the target layer of the resource map, determine the color depth of each sampling point in the target layer, and obtain the sampled target layer;
[0040] The marking module is used to mark the target layer based on the color depth of each sampling point in the target layer to add corresponding target attributes to obtain the sampled target layer.
[0041] In a possible implementation manner, the route data graph includes route location information; and the hierarchical module is specifically configured to:
[0042] Importing the elevation map and the line data map into the target three-dimensional image tool, generating a corresponding elevation map terrain based on the height data of the elevation map, and calculating the orthographic projection of the line of the line data map in the elevation map terrain while keeping the line position information of the line data map unchanged; wherein the orthographic projection corresponds to a projection point;
[0043] Acquire multiple sampling points on the line based on a preset sampling distance, and calculate a first distance between each sampling point and a projection point corresponding to the orthographic projection;
[0044] A plurality of groups of adjacent sampling points corresponding to all the sampling points are determined, an average distance between the adjacent sampling points is calculated based on a first distance between two of the adjacent sampling points, and the elevation map terrain is lifted or lowered based on the average distance of all the adjacent sampling points.
[0045] In a possible implementation manner, the generating module is specifically used to:
[0046] Based on a preset target three-dimensional image tool and a data sharing plug-in of the three-dimensional engine, the identification data is dynamically transmitted into the three-dimensional engine, and in the three-dimensional engine, the identification data is replaced with corresponding scene resources to generate an internal scene terrain of the three-dimensional engine;
[0047] Determine the position information of the scene resource in the resource map, and based on the scene resource position information and the data identifier, select the corresponding texture resource or model resource of the scene resource in the resource library of the three-dimensional engine for resource replacement to obtain the target terrain corresponding to the scene information.
[0048] In a possible implementation manner, the generating device of the three-dimensional terrain scene further includes:
[0049] A splitting module, configured to split the target terrain into multiple small levels with a target area size based on a preset level splitting plug-in, and generate index information of all the small levels; wherein, the small levels are stored in a target storage area;
[0050] A loading module, configured to determine a target small level to be loaded based on the position information of the target character in the small level, and find the target small level in the target storage area based on the index information of the target small level, so as to load the scene corresponding to the target small level.
[0051] In a possible implementation manner, the generating device of the three-dimensional terrain scene further includes:
[0052] A conversion module, configured to convert the line data into a general CSV format through a format conversion plug-in of a preset three-dimensional engine to obtain a line data file in the CSV format recognizable by the target three-dimensional image tool; wherein, the format conversion plug-in is a plug-in of the preset three-dimensional engine;
[0053] A second drawing module, configured to import the line data file in the CSV format into the target three-dimensional image tool, and read the line data file through the target three-dimensional image tool to draw a line data graph of the line data.
[0054] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a storage medium, and a bus, where the storage medium stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for generating a three-dimensional terrain scene according to any one of the first aspects.
[0055] Fourthly, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the method for generating a three-dimensional terrain scene according to any one of the first aspects.
[0056] A method, device, equipment and medium for generating a three-dimensional terrain scene provided by an embodiment of the present application determine scene information for constructing a three-dimensional scene, draw line data corresponding to the scene information based on a preset line drawing tool, and import the line data into a target three-dimensional image tool to draw a line data diagram of the line data. Obtain GIS data in multiple dimensions under the scene information, and import the GIS data and the line data diagram into a geographic information system software for origin alignment. Layer and mark the resources in the resource map based on the resource types of the resource map to obtain a resource map divided into multiple layers, and import the resource map divided into layers into the target three-dimensional image tool. Repeatedly fit based on the curve data, slope data of the line data and the height data of the terrain in the elevation map, so that the curve data and slope data are completely matched with the height data. Import the GIS data into the target three-dimensional image tool for layering, determine their corresponding data identifiers to generate corresponding different types of identification data, and generate a target terrain corresponding to the scene information in a three-dimensional engine based on the identification data. In this application, by importing the downloaded GIS data and the target three-dimensional image tool according to the drawn line data diagram into the geographic information system software for origin alignment, and after layer division of the resource map and data layering of the GIS data, based on the identification data generated by layering, a target terrain corresponding to the scene information is generated in the three-dimensional engine, without relying on manual adjustment of terrain information, nor manually placing models of various scene elements, improving the production efficiency of the three-dimensional scene, and making it easier to achieve a natural and reasonable layout, thereby improving the realism of the three-dimensional scene.
[0057] To make the above objects, features and advantages of the present application more obvious and understandable, the following specific preferred embodiments are given in conjunction with the accompanying drawings and described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0059] Figure 1 is a flowchart of the method for generating a three-dimensional terrain scene according to an embodiment of the present application;
[0060] Figure 2 It is a schematic flowchart of the three-dimensional terrain scene generation process;
[0061] Figure 3 It is a schematic structural diagram of a three-dimensional terrain scene generation device provided according to an embodiment of the present application;
[0062] Figure 4 It is a schematic structural diagram of an electronic device provided according to an embodiment of the present application. Detailed implementation manners
[0063] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only for the purposes of illustration and description, and are not used to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to actual scale. The flowcharts used in the present application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without a logical context relationship may be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the present application.
[0064] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but only represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts fall within the protection scope of the present application.
[0065] It should be noted that the term "including" will be used in the embodiments of the present application to indicate the existence of the features stated thereafter, but does not exclude the addition of other features.
[0066] Considering that when making a simulated driving three-dimensional scene, it is necessary to brush the terrain and place models such as turf, vegetation, buildings, bridges, and roads into the three-dimensional engine to simulate various three-dimensional scenes.
[0067] Currently, the line description file is mainly made according to the railway track maintenance data, an import tool is made in the scene, and the line data is automatically imported. Then, according to the actual video of the line and the generated line, various scene elements such as terrain, turf, vegetation, buildings, bridges, and roads are manually brushed into the 3D engine. However, in the 3D engine, relying on manual adjustment of terrain information is complex and it is difficult to ensure the accuracy of the operation. At the same time, since it is necessary to manually place the models of various scene elements, the efficiency is low and it is difficult to achieve a natural and reasonable layout, making the realism of the 3D scene average.
[0068] To solve this problem, the present application provides a method, device, equipment and medium for generating a 3D terrain scene. By aligning the downloaded GIS data and the target 3D image tool with the origin according to the drawn line data map and dividing the resource map into layers and the GIS data into data layers, based on the identification data generated by the layering, the target terrain corresponding to the scene information is generated in the 3D engine, no longer relying on manual adjustment of terrain information, nor manually placing the models of various scene elements, improving the production efficiency of the 3D scene and making it easier to achieve a natural and reasonable layout, thereby improving the realism of the 3D scene.
[0069] Figure 1 It is a flowchart of the method for generating a 3D terrain scene according to an embodiment of the present application.
[0070] As Figure 1 shown, the method for generating a 3D terrain scene according to an embodiment of the present application may specifically include:
[0071] S101. Determine the scene information for which a 3D scene needs to be constructed, draw the line data corresponding to the scene information based on a preset line drawing tool, and import the line data into the target 3D image tool to draw a line data map of the line data.
[0072] S102. Obtain GIS data in multiple dimensions under the scene information, and import the GIS data and the line data map into the geographic information system software for origin alignment.
[0073] S103. Based on the resource types of the resource map, layer and mark the resources in the resource map to obtain a resource map divided into multiple layers, and import the resource map with divided layers into the target 3D image tool, and repeatedly fit based on the curve data, slope data of the line data and the height data of the terrain in the elevation map, so that the curve data, slope data and height data are completely matched.
[0074] S104. Import the GIS data into the target 3D image tool for layering, determine the corresponding data identifiers respectively, generate the corresponding identifier data of different types, and generate the target terrain corresponding to the scene information in the 3D engine based on the identifier data.
[0075] In the above method for generating the 3D terrain scene, after aligning the downloaded GIS data and the target 3D image tool with the origin according to the drawn line data map and dividing the resource map into layers and the GIS data into data layers, the target terrain corresponding to the scene information is generated in the 3D engine based on the identifier data generated by layering. It no longer depends on manual adjustment of terrain information, nor does it require manual placement of models of various scene elements, improving the production efficiency of the 3D scene and making it easier to achieve a natural and reasonable layout, thereby enhancing the realism of the 3D scene.
[0076] The following describes the above exemplary steps of the embodiments of the present application with specific examples:
[0077] S101. Determine the scene information of the 3D scene to be constructed, draw the line data corresponding to the scene information based on a preset line drawing tool, and import the line data into the target 3D image tool to draw the line data map of the line data.
[0078] In the embodiments of the present application, the scene information is the scene information of the 3D scene to be constructed. For example, the track scene from Zhengzhou to Xi'an, and further refined, it can be tracks of types such as high-speed rail and regular speed. The line drawing tool is a pre-developed line drawing tool. The line data is the data line of the line corresponding to the scene information. For example, the data of the high-speed rail track line from Zhengzhou to Xi'an. The data map includes at least the trend data, curve data, and slope data of the line data. The target 3D image tool can be houdini. The present application describes it by taking this as an example, but it does not constitute a limitation thereto. Determine the scene information of the 3D scene to be constructed, draw the line data corresponding to the scene information through the line drawing tool, import the line data into the target 3D image tool houdini, and draw the line data map of the line data for subsequent processing.
[0079] Optionally, after drawing the line data corresponding to the scene information, the line data can be converted into a common CSV format through a preset format conversion plugin of the 3D engine to obtain a line data file in the CSV format recognizable by the target 3D image tool; import the line data file in the CSV format into the target 3D image tool, and read the line data file through the target 3D image tool to draw the line data map of the line data. Among them, the format conversion plugin is a preset plugin of the 3D engine, that is, a pre-developed format conversion plugin of the 3D engine.
[0080] It should be noted that the line data generated by the line drawing tool is in the company's internal format. Therefore, a corresponding format conversion plugin needs to be developed to identify and perform format conversion. The format conversion plugin exists in the form of a plugin for the 3D engine. The line data file (internal format) drawn by the line drawing tool is converted into a common CSV format through the format conversion plugin of the 3D engine. The Houdini software draws a line containing information such as line trend, curve, and slope in the Houdini software by reading the data in the CSV format.
[0081] S102. Obtain GIS data in multiple dimensions under the scenario information, and import the GIS data and the line data map into the geographic information system software for origin alignment.
[0082] Optionally, obtain GIS data in multiple dimensions under the scenario information through a preset GIS network interface. For example, obtain GIS data in multiple dimensions under the scenario information through the GIS network interface provided by the purchased software provider on the corresponding GIS network, that is, download elevation maps, railway maps, road network maps, building maps, urban road networks, resource maps, satellite maps, etc.
[0083] In the embodiment of the present application, the GIS data in multiple dimensions at least includes data of elevation maps, railway maps, road network maps, building maps, urban road networks, resource maps, satellite maps. It can also be understood that the downloaded GIS data includes elevation maps, railway maps, road network maps, building maps, urban road networks, resource maps, satellite maps, etc. The elevation map includes the height data of the terrain. The geographic information system software can be ArcGIS. The present application describes it by taking this as an example; download the GIS data in multiple dimensions under the scenario information, and import the downloaded GIS data and the line data map obtained in step S101 into the geographic information system software for origin alignment for subsequent processing. For example, as Figure 2 shown, download the GIS data and perform origin alignment.
[0084] Optionally, when importing the GIS data and the drawn line data map into the geographic information system software for origin alignment, import the GIS data and the drawn line data map into the geographic information system software, and arbitrarily select three target points on the satellite map that are not on a straight line; based on the three target points arbitrarily selected on the satellite map, determine the three target points in all the corresponding maps in the GIS data and the line data map, and overlap and align the three target points of all the maps. Among them, the target point is the central position of the area where the target point is located.
[0085] Specifically, import the downloaded GIS data and line data into the ArcGIS software. Arbitrarily select three points on the satellite map that are not on a straight line. For example, in the line of the Zhengzhou-Xi'an railway track, select three stations that are not on a straight line: Zhengzhou, Kaifeng, and Xuchang. These three stations actually represent a region. Therefore, the central position of each region, that is, the center position of the station, can be used to represent each station, namely the target points. After selecting these three target points, align the center positions of the three stations in all layers. Thus, the origin alignment is completed. In short, align all layers through three points on the line that are not on a straight line. As long as these three points are aligned, then the whole is aligned.
[0086] Furthermore, determine the fixed area of the target layer for sampling the resource map. Use the fixed area as the sampling points to sample the target layer of the resource map, determine the color depth of each sampling point in the target layer, and obtain the sampled target layer; mark the target layer based on the color depth of each sampling point in the target layer to add the corresponding target attributes, and obtain the sampled target layer. Among them, the target layer is a certain layer among the numerous layers of the resource map. Here, taking the forest layer as an example, the target attribute corresponds to the vegetation density attribute as an example.
[0087] It can be understood that for a forest layer like this, there are differences in the density of the forest layer. Therefore, after the preliminary data stratification marking (color marking, for example, using green as the marking for the forest), the marking of the vegetation density attribute can be further added.
[0088] Specifically, use a fixed area (for example, 10m × 10m) as the sampling points to sample the forest layer, that is, divide it into blocks with 10m × 10m. According to the color depth of the sampled area, add the vegetation density attribute to the marked data obtained after stratification, that is, the data of the forest layer. Thus, through the color depth of the sampled area, a further refined forest layer is obtained.
[0089] S103, stratify and mark the resources in the resource map based on the resource types in the resource map to obtain the resource map divided into multiple layers, and import the resource map with divided layers into the target 3D image tool. Repeatedly fit based on the curve data, slope data of the line data and the height data of the terrain in the elevation map to make the curve data, slope data and height data fully match.
[0090] In the embodiments of the present application, the resource types at least include forests, cultivated lands, towns, rivers, grasslands, and farmlands. The layers divided in the resource map correspondingly include a forest layer, a cultivated land layer, a town layer, a river layer, a grassland layer, and a farmland layer. Resources in different layers correspond to different colors (color blocks), that is, different layers are marked by colors. The resources in the resource map are stratified according to the resource types of the resource map to obtain a forest layer, a cultivated land layer, a town layer, a river layer, a grassland layer, a farmland layer, etc., and each layer is marked with a different color. Then, the resource map with divided layers is imported into the target 3D image tool houdini, and the curve data and slope data of the line data in step S101 and the height data of the terrain in the elevation map in step S102 are repeatedly fitted to make the curve data, slope data, and height data completely match.
[0091] Optionally, the line data map includes line position information. When repeatedly fitting based on the curve data, slope data of the line data, and the height data of the terrain in the elevation map, the elevation map and the line data map are imported into the target 3D image tool. Based on the height data of the elevation map, the corresponding elevation map terrain is generated, and while keeping the line position information of the line data map unchanged, the orthographic projection of the line in the line data map on the elevation map terrain is calculated. Based on a preset sampling distance, multiple sampling points are obtained on the line, and the first distance between each sampling point and the corresponding projection point of the orthographic projection is calculated. All groups of adjacent sampling points corresponding to all sampling points are determined, the average distance between adjacent sampling points is calculated based on the first distance between two sampling points in the adjacent sampling points, and the elevation map terrain is lifted or sunk based on the average distance of all adjacent sampling points. Among them, the orthographic projection corresponds to one projection point; the elevation map terrain is the terrain generated based on the height data of the elevation map; the sampling distance is the distance of each sampling on the line, such as 500m, that is, sampling is performed every 500m on the line.
[0092] Specifically, the elevation map with the origin aligned and the line data are imported into houdini. First, the terrain is generated based on the height data of the elevation map, and while keeping the line position information of the previously drawn line data unchanged, the orthographic projection of the line in the line data on this terrain is calculated. The sampling distance is 500m, and one sampling point is picked every 500m on the line to obtain multiple sampling points. The distance between each sampling point and the projection point is calculated, and the terrain is lifted or sunk based on the average of the distances between adjacent sampling points and the projection point.
[0093] It can be supplemented that the average distance of all adjacent sampling points can be compared with the height of the corresponding points in the elevation map. If it is relatively high, the terrain is sunk, otherwise it is lifted.
[0094] S104. Import the GIS data into the target 3D image tool for layering, determine the corresponding data identifiers respectively, generate the corresponding identifier data of different types, and generate the target terrain corresponding to the scene information in the 3D engine based on the identifier data.
[0095] In the embodiments of the present application, the data identifier is the identifier of different types in the GIS data, the identifier data is the data after identification, and the dimensions of the identifier data and the GIS data correspond. For example, the data identifier corresponding to the building map in the GIS data is the building layer, the data identifier corresponding to the road network map in the GIS data is the road network layer, and the data identifiers corresponding to the resource map in the GIS data are the forest layer, the cultivated land layer, the town layer, the river layer, the grassland layer, the farmland layer, etc. The target terrain is the 3D terrain scene to be constructed. Import the GIS data into the target 3D image tool for layering, generate the corresponding identifier data of different types, and generate the target terrain corresponding to the scene information in the 3D engine based on the identifier data, thus completing the generation of the 3D terrain scene.
[0096] Optionally, when generating the target terrain corresponding to the scene information in the 3D engine based on the identifier data, based on the preset data sharing plug-in of the target 3D image tool and the 3D engine, dynamically transmit the identifier data into the 3D engine, replace the identifier data with the corresponding scene resources in the 3D engine, and generate the internal scene terrain of the 3D engine; determine the position information of the scene resources in the resource map, and select the corresponding texture resources or model resources of the scene resources for resource replacement in the resource library of the 3D engine based on the scene resource position information and the data identifier, to obtain the target terrain corresponding to the scene information. Among them, the scene resources at least include buildings, trees, vegetation, turf, farmland, rivers, and roads.
[0097] Specifically, use houdini and the pre-developed 3D engine data sharing plug-in to dynamically transmit the identifier data output from the above process into the 3D engine. The 3D engine replaces the data with the corresponding scene resources according to the transmitted data, and automatically generates the internal scene terrain of the engine. Then, according to the position information of the scene resources in the resource map and the above data identifier, automatically select the corresponding texture resources or model resources in the resource library of the 3D engine for resource replacement, to obtain the target terrain corresponding to the scene information.
[0098] Optionally, it is also possible to determine the target model or target texture corresponding to the target layer in the target terrain; adjust the target model or target texture based on the target attributes to obtain the adjusted target terrain.
[0099] Specifically, after automatically selecting the corresponding texture resources or model resources in the resource library of the 3D engine for resource replacement, the model interval, that is, the interval of the models corresponding to the forest layer, can be automatically adjusted according to the vegetation density attribute of the forest layer. It can be understood that dense means adjusting to a closer interval, and sparse means adjusting to a farther interval.
[0100] The method for generating a 3D terrain scene provided by the embodiments of the present application includes: determining the scene information of the 3D scene to be constructed, drawing the line data corresponding to the scene information based on a preset line drawing tool, and importing the line data into a target 3D image tool to draw a line data diagram of the line data; obtaining various dimensions of GIS data under the scene information, and importing the GIS data and the line data diagram into a geographic information system software for origin alignment; performing data layering and marking on the resources in the resource map based on the resource types of the resource map to obtain a resource map divided into multiple layers, and importing the resource map divided into layers into the target 3D image tool; performing repeated fitting based on the curve data, slope data of the line data, and the height data of the terrain in the elevation map to make the curve data and slope data fully match the height data; importing the GIS data into the target 3D image tool for layering, determining the corresponding data identifiers respectively to generate corresponding different types of identifier data, and generating the target terrain corresponding to the scene information in the 3D engine based on the identifier data. In the method for generating a 3D terrain scene of the present application, after aligning the downloaded GIS data and the target 3D image tool according to the drawn line data diagram into the geographic information system software for origin alignment, performing layer division on the resource map and data layering on the GIS data, and then generating the target terrain corresponding to the scene information in the 3D engine based on the identifier data generated by layering, it no longer depends on manual adjustment of terrain information, nor is it necessary to manually place models of various scene elements, improving the production efficiency of the 3D scene and making it easier to achieve a natural and reasonable layout, thereby improving the realism of the 3D scene.
[0101] Further, based on a preset level splitting plugin, the target terrain is split into multiple small levels with a target area size, and index information for all small levels is generated; based on the position information of the target character in the small level, the target small level to be loaded is determined, and the target small level is found in the target storage area based on the index information of the target small level to load the scene corresponding to the target small level. Among them, the small levels are stored in the target storage area.
[0102] Specifically, the self-developed automatic level splitting plug-in is used to split the above-mentioned constructed target terrain (equivalent to a large level) into small levels of the target area size (500m * 500m), and each level is saved separately. For example, the terrain scene of the railway line from Zhengzhou to Xi'an generates 20,000 small levels, and the index information of all small levels is generated. Subsequently, the required small level to be loaded can be found according to the index information for loading. For example, when the character moves forward, the small level corresponding to the front scene is loaded, and the small levels at the back can be unloaded to reduce the resource occupation required for loading.
[0103] Thus, according to the self-developed automatic level splitting plug-in, the scene corresponding to the small level can be dynamically loaded in the way of level streaming, and the scene can be loaded quickly and efficiently.
[0104] In summary, the present application proposes a way to procedurally generate terrain scenes, which does not require manual terrain brushing and manual model placement into the 3D engine, reduces human errors, improves efficiency, and reduces the requirements of scene production personnel for professional knowledge. It can quickly create diverse scenes, significantly improving the production efficiency and scale. Through automated tools, even non-professionals can easily produce high-quality scene content, reducing the professional threshold for production.
[0105] It should be noted that a method for generating a three-dimensional terrain scene in the present application is also a method for generating a three-dimensional scene.
[0106] Figure 3 It is a schematic structural diagram of a device for generating a three-dimensional terrain scene according to an embodiment of the present application. As Figure 3 shown, the device 300 for generating a three-dimensional terrain scene according to an embodiment of the present application may specifically include:
[0107] The first drawing module 301 is used to determine the scene information required to construct a three-dimensional scene, draw the line data corresponding to the scene information based on a preset line drawing tool, and import the line data into a target three-dimensional image tool to draw a line data diagram of the line data; wherein, the line data diagram at least includes the trend data, curve data, and slope data of the line data.
[0108] The acquisition module 302 is used to acquire GIS data of multiple dimensions under the scene information, and import the GIS data and the line data diagram into the geographic information system software for origin alignment; wherein, the GIS data of multiple dimensions at least includes data of elevation maps, railway maps, road network maps, building maps, urban road networks, resource maps, and satellite maps; the elevation map includes the height data of the terrain.
[0109] The layering module 303 is used to perform data layering and marking on the resources in the resource graph based on the resource types of the resource graph, obtain a resource graph divided into multiple layers, and import the resource graph with divided layers into the target 3D image tool. It performs repeated fitting based on the curve data, slope data of the line data, and the height data of the terrain in the elevation map, so that the curve data, slope data, and height data are completely matched; among them, the resources in different layers correspond to different colors;
[0110] The generation module 304 is used to import the GIS data into the target 3D image tool for layering, determine the corresponding data identifiers respectively, generate corresponding different types of identification data, and generate the target terrain corresponding to the scene information in the 3D engine based on the identification data; among them, the dimensions of the identification data and the GIS data correspond.
[0111] In a possible implementation manner, the acquisition module is specifically used for:
[0112] Import the GIS data and the drawn line data map into the geographic information system software, and arbitrarily select three target points on the satellite map that are not on a straight line; among them, the target point is the central position of the area where the target point is located;
[0113] Based on the three target points arbitrarily selected on the satellite map, determine the three target points in all the corresponding maps in the GIS data and the line data map, and overlap and align the three target points of all the maps.
[0114] In a possible implementation manner, the generation device of the 3D terrain scene further includes:
[0115] The sampling module is used to determine the fixed area of the target layer for sampling the resource graph, use the fixed area as the sampling point to sample the target layer of the resource graph, determine the color depth of each sampling point in the target layer, and obtain the sampled target layer;
[0116] The marking module is used to mark the target layer based on the color depth of each sampling point in the target layer to add the corresponding target attributes, and obtain the sampled target layer.
[0117] In a possible implementation manner, the line data map includes line position information. The layering module is specifically used for:
[0118] Import the elevation map and the line data map into the target 3D image tool, generate the corresponding elevation map terrain based on the height data of the elevation map, and calculate the orthographic projection of the line in the line data map on the elevation map terrain while keeping the line position information of the line data map unchanged; among them, the orthographic projection corresponds to a projection point;
[0119] Acquire multiple sampling points on the line based on a preset sampling distance, and calculate a first distance between each sampling point and a projection point corresponding to the orthographic projection;
[0120] A plurality of groups of adjacent sampling points corresponding to all the sampling points are determined, an average distance between the adjacent sampling points is calculated based on a first distance between two of the adjacent sampling points, and the elevation map terrain is lifted or lowered based on the average distance of all the adjacent sampling points.
[0121] In a possible implementation, the generating module is specifically used for:
[0122] Based on the preset target 3D image tool and the data sharing plug-in of the 3D engine, the identification data is dynamically transferred to the 3D engine, and the identification data is replaced with the corresponding scene resources in the 3D engine to generate the internal scene terrain of the 3D engine;
[0123] Determine the location information of the scene resource in the resource map, and select the map resource or model resource corresponding to the scene resource in the resource library of the 3D engine for resource replacement based on the scene resource location information and data identifier to obtain the target terrain corresponding to the scene information.
[0124] In a possible implementation manner, the device for generating a three-dimensional terrain scene further includes:
[0125] A segmentation module is used to segment the target terrain into multiple small levels of target area size based on the preset level segmentation plug-in, and generate index information of all small levels; wherein the small levels are stored in the target storage area;
[0126] The loading module is used to determine the target small level to be loaded based on the position information of the target character in the small level, and to find the target small level in the target storage area based on the index information of the target small level to load the scene corresponding to the target small level.
[0127] In a possible implementation manner, the device for generating a three-dimensional terrain scene further includes:
[0128] A conversion module, used to convert the line data into a common CSV format through a preset format conversion plug-in of a 3D engine, so as to obtain a line data file in a CSV format recognizable by a target 3D image tool; wherein the format conversion plug-in is a preset 3D engine plug-in;
[0129] The second drawing module is used to import the line data file in CSV format into the target three-dimensional image tool, read the line data file through the target three-dimensional image tool, and draw a line data diagram of the line data.
[0130] The generation device for a three-dimensional terrain scene provided by an embodiment of the present application determines the scene information for which a three-dimensional scene needs to be constructed, draws the line data corresponding to the scene information based on a preset line drawing tool, and imports the line data into a target three-dimensional image tool to draw a line data graph of the line data. It obtains GIS data in multiple dimensions under the scene information, and imports the GIS data and the line data graph into a geographic information system software for origin alignment. It performs data layering and marking on the resources in the resource graph based on the resource types of the resource graph to obtain a resource graph divided into multiple layers, and imports the resource graph with divided layers into the target three-dimensional image tool. It repeatedly fits based on the curve data, slope data of the line data, and the height data of the terrain in the elevation map so that the curve data and slope data are completely matched with the height data. It imports the GIS data into the target three-dimensional image tool for layering, determines the corresponding data identifiers respectively to generate corresponding different types of identification data, and generates a target terrain corresponding to the scene information in a three-dimensional engine based on the identification data. The generation device for a three-dimensional terrain scene of the present application, by aligning the downloaded GIS data and the target three-dimensional image tool according to the drawn line data graph into a geographic information system software for origin alignment, performing layer division on the resource graph and data layering on the GIS data, and then generating a target terrain corresponding to the scene information in a three-dimensional engine based on the identification data generated by layering, no longer relies on manual adjustment of terrain information, nor does it require manual placement of models of various scene elements, improving the production efficiency of the three-dimensional scene and making it easier to achieve a natural and reasonable layout, thereby improving the realism of the three-dimensional scene.
[0131] As Figure 4 shown, an electronic device 400 provided by an embodiment of the present application includes: a processor 401, a memory 402, and a bus. The memory 402 stores machine-readable instructions executable by the processor 401. When the electronic device runs, communication between the processor 401 and the memory 402 is carried out through the bus. The processor 401 executes the machine-readable instructions to perform the steps of the method for generating a three-dimensional terrain scene as described above.
[0132] Specifically, the above-mentioned memory 402 and processor 401 can be general-purpose memory and processor, which are not specifically limited here. When the processor 401 runs the computer program stored in the memory 402, it can execute the method for generating a three-dimensional terrain scene as described above.
[0133] Corresponding to the method for generating a three-dimensional terrain scene as described above, an embodiment of the present application also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, it executes the steps of the method for generating a three-dimensional terrain scene as described above.
[0134] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the method embodiments, and will not be elaborated herein. In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the modules is only a logical functional division, and there may be other division methods in actual implementation. For another example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings, direct couplings, or communication connections shown or discussed among each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.
[0135] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, in each embodiment of the present application, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0137] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the deployment method described in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0138] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and all of them should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for generating a three-dimensional terrain scene, characterized in that: The generation method comprises: Determine scene information for which a three-dimensional scene needs to be constructed, generate line data corresponding to the scene information by drawing based on a preset line drawing tool, and import the line data into a target three-dimensional image tool to draw a line data graph of the line data; wherein the line data graph at least includes trend data, curve data, and slope data of the line data; Acquire GIS data of multiple dimensions under the scene information, and import the GIS data and the line data map into geographic information system software for origin alignment; wherein the GIS data of multiple dimensions at least includes data of elevation map, railway map, road network map, building map, urban road network, resource map, and satellite map; the elevation map includes terrain height data; Data stratification and labeling of resources in the resource map are performed based on resource types of the resource map to obtain a resource map divided into multiple layers, and the resource map divided into multiple layers is imported into the target three-dimensional image tool, and repeated fitting is performed based on the curve data, slope data of the line data and the height data of the terrain in the elevation map, so that the curve data, slope data and the height data are completely matched; wherein resources in different layers correspond to different colors; The GIS data is imported into the target three-dimensional image tool for layering, and the corresponding data identifiers are determined to generate corresponding identification data of different types, and the target terrain corresponding to the scene information is generated in the three-dimensional engine based on the identification data; wherein the dimensions of the identification data and the GIS data correspond.
2. The method according to claim 1, characterized in that The step of importing the GIS data and the drawn route data map into geographic information system software for origin alignment includes: Import the GIS data and the drawn route data map into geographic information system software, and arbitrarily select three target points on the satellite map that are not on a straight line; wherein the target point is the center position of the area where the target point is located; Based on three target points randomly selected on the satellite image, three target points in all the images corresponding to the GIS data and the route data image are determined, and the three target points in all the images are overlapped and aligned.
3. The method according to claim 2, characterized in that The method further comprises: Determine a fixed area for sampling the target layer of the resource map, use the fixed area as a sampling point to sample the target layer of the resource map, determine the color depth of each sampling point in the target layer, and obtain the sampled target layer; The target layer is marked based on the color depth of each sampling point in the target layer to add corresponding target attributes to obtain the sampled target layer.
4. The method according to claim 3, characterized in that The line data map includes line location information; the repeated fitting based on the curve data, slope data of the line data and the height data of the terrain in the elevation map includes: Importing the elevation map and the line data map into the target three-dimensional image tool, generating a corresponding elevation map terrain based on the height data of the elevation map, and calculating the orthographic projection of the line of the line data map in the elevation map terrain while keeping the line position information of the line data map unchanged; wherein the orthographic projection corresponds to a projection point; Acquire multiple sampling points on the line based on a preset sampling distance, and calculate a first distance between each sampling point and a projection point corresponding to the orthographic projection; A plurality of groups of adjacent sampling points corresponding to all the sampling points are determined, an average distance between the adjacent sampling points is calculated based on a first distance between two of the adjacent sampling points, and the elevation map terrain is lifted or lowered based on the average distance of all the adjacent sampling points.
5. The method according to claim 4, characterized in that The generating the target terrain corresponding to the scene information in the three-dimensional engine based on the identification data includes: Based on a preset target 3D image tool and a data sharing plug-in of the 3D engine, the identification data is dynamically transferred to the 3D engine, and the identification data is replaced with corresponding scene resources in the 3D engine to generate an internal scene terrain of the 3D engine; Determine the location information of the scene resource in the resource map, and select the map resource or model resource corresponding to the scene resource in the resource library of the three-dimensional engine based on the scene resource location information and the data identifier to replace the resource, so as to obtain the target terrain corresponding to the scene information.
6. The method according to claim 5, characterized in that The method further comprises: Based on the preset level segmentation plug-in, the target terrain is segmented into multiple small levels of target area size, and index information of all small levels is generated; wherein the small levels are stored in the target storage area; Based on the position information of the target character in the small level, the target small level to be loaded is determined, and based on the index information of the target small level, the target small level is found in the target storage area to load the scene corresponding to the target small level.
7. The method according to claim 6, characterized in that The method further comprises: The line data is converted into a common CSV format by a preset format conversion plug-in of the 3D engine, so as to obtain a line data file in a CSV format recognizable by a target 3D image tool; wherein the format conversion plug-in is a preset 3D engine plug-in; The line data file in the CSV format is imported into the target three-dimensional image tool, and the line data file is read by the target three-dimensional image tool to draw a line data diagram of the line data.
8. A device for generating a three-dimensional terrain scene, characterized in that: The generating device comprises: A first drawing module is used to determine scene information for which a three-dimensional scene needs to be constructed, draw and generate line data corresponding to the scene information based on a preset line drawing tool, and import the line data into a target three-dimensional image tool to draw a line data graph of the line data; wherein the line data graph at least includes trend data, curve data, and slope data of the line data; An acquisition module is used to acquire GIS data of multiple dimensions under the scene information, and import the GIS data and the line data map into the geographic information system software for origin alignment; wherein the GIS data of multiple dimensions at least includes data of elevation map, railway map, road network map, building map, urban road network, resource map, and satellite map; the elevation map includes terrain height data; A layering module is used to perform data layering and labeling on the resources in the resource map based on the resource types of the resource map, obtain a resource map divided into multiple layers, import the resource map divided into multiple layers into the target three-dimensional image tool, and repeatedly fit the curve data, slope data of the line data and the height data of the terrain in the elevation map so that the curve data, slope data and the height data are completely matched; wherein resources in different layers correspond to different colors; A generation module is used to import the GIS data into the target three-dimensional image tool for layering, determine the corresponding data identifiers to generate corresponding different types of identification data, and generate a target terrain corresponding to the scene information in a three-dimensional engine based on the identification data; wherein the dimensions of the identification data and the GIS data correspond.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for generating a three-dimensional terrain scene as described in any one of claims 1 to 7 are performed.
10. 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 steps of the method for generating a three-dimensional terrain scene as described in any one of claims 1 to 7 are executed.