A virtual scene generation method, device, computer equipment and storage medium

By using noise data and preset thresholds to determine the sub-regions of hilly terrain when generating virtual scenes, and building virtual scenes based on these height information, the problem of insufficient expression and diversity of virtual scenes in the prior art is solved, and efficient and diverse virtual scene generation is achieved.

CN115359202BActive Publication Date: 2025-02-28DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211065041.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-01
Publication Date
2025-02-28
Estimated Expiration
2042-09-01

AI Technical Summary

Technical Problem

When generating open virtual scenes, the prior art has poor expression and diversity, making it difficult to create virtual scenes with rich terrain characteristics.

Method used

By obtaining target maps and scene parameters, the sub-regions of hilly terrain are determined using noise data and preset thresholds, and a virtual scene is constructed based on these height information. The method includes determining noise data, aligning noise values ​​and thresholds to identify sub-regions of hilly terrain, and generating a virtual scene through grid and height interpolation processing.

Benefits of technology

It realizes the generation of virtual scenes with different characteristics, improves the expressiveness and diversity of the scene, and ensures that virtual scenes with high efficiency and low repetition are generated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115359202B_ABST
    Figure CN115359202B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, computer equipment and storage medium for generating a virtual scene. The method includes: obtaining a target map and obtaining a first scene parameter for generating a hilly terrain; the target map includes multiple sub-areas belonging to land; the first scene parameter includes at least one of the following: the terrain undulation degree, maximum height, and number of hills of the target map; based on the first scene parameter, determining noise data for multiple sub-areas belonging to land in the target map; the noise data is used to characterize the height information corresponding to the multiple sub-areas belonging to land; based on the noise data and a preset noise threshold, determining a first sub-area belonging to the hilly terrain from the multiple sub-areas belonging to land; determining corresponding first height information for each of the multiple first sub-areas, and using the first height information to construct a first virtual scene corresponding to the hilly terrain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of game technology, and in particular to a virtual scene generation method, device, computer equipment and storage medium. Background Art

[0002] Open world is a type of video game level design where players can freely roam in the virtual world and freely choose the time and method to complete game tasks. Currently, there are problems with the expressiveness and diversity of open virtual scenes generated by computers. Summary of the invention

[0003] The embodiments of the present disclosure at least provide a virtual scene generation method, apparatus, computer equipment and storage medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating a virtual scene, comprising:

[0005] Acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: a terrain undulation degree, a maximum height, and a number of hills of the target map;

[0006] Based on the first scene parameter, determining noise data for a plurality of sub-areas belonging to land in the target map; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land;

[0007] Based on the noise data and a preset noise threshold, determining a first sub-region belonging to the hilly terrain from the plurality of sub-regions belonging to the land;

[0008] Corresponding first height information is determined for each of the plurality of first sub-areas, and a first virtual scene corresponding to the hilly terrain is constructed using the first height information.

[0009] In an optional implementation manner, the noise data includes: noise values ​​corresponding to a plurality of sub-regions respectively;

[0010] The determining, based on the noise data and a preset noise threshold, a first sub-region belonging to the hilly terrain from the plurality of sub-regions belonging to the land, comprises:

[0011] For each sub-region among the multiple sub-regions belonging to the land, comparing the noise value corresponding to the sub-region with the noise threshold;

[0012] In response to the noise data being greater than the noise threshold, the sub-region is determined as the first sub-region.

[0013] In an optional implementation manner, a plurality of the first sub-regions constitute a first region;

[0014] The determining corresponding first height information for each of the plurality of first sub-areas includes:

[0015] Determine a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determine second height information for first grid vertices in the grids located in the first region; each of the grids includes at least one of the first sub-regions;

[0016] Based on the second height information of the first mesh vertices, first height information respectively corresponding to the plurality of first sub-regions is determined.

[0017] In an optional implementation manner, determining a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determining height information for first grid vertices in the grids located in the first region, includes:

[0018] Determine a circumscribed rectangle of the first area based on positions of the plurality of first sub-areas in the first area in the target map;

[0019] The circumscribed rectangle is divided into a plurality of grids, and first grid vertices in the plurality of grids that are located in the first region are randomly sampled in height to obtain second height information corresponding to each of the first grid vertices.

[0020] In an optional implementation manner, determining first height information respectively corresponding to a plurality of first sub-regions based on the second height information of the first mesh vertices includes:

[0021] For each mesh, based on the second height information corresponding to the first mesh vertices of the mesh, height interpolation processing is performed on each first sub-region in the mesh to obtain first height information corresponding to each first sub-region of the mesh.

[0022] In an optional implementation manner, after determining the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land, the method further includes:

[0023] Based on the first height information respectively corresponding to the first sub-areas, determining a target first sub-area corresponding to a first target object in the first area;

[0024] The first target object is constructed in the first area based on the position information of the target first sub-area in the first area.

[0025] In an optional implementation manner, determining the target first sub-region corresponding to the first target object in the first region based on the first height information respectively corresponding to the first sub-regions includes:

[0026] Based on the first height information respectively corresponding to the first sub-regions, determining a first seed region belonging to the first target object from the first sub-regions;

[0027] Perform multiple iterations of the following:

[0028] Determine a current target first sub-region of a current iteration cycle; the current target first sub-region includes: the first seed region, or a new target first sub-region determined in a previous iteration cycle;

[0029] Based on the position of the current target first sub-region in the first region, determining, from the first region, a candidate sub-region adjacent to the current target first sub-region;

[0030] In response to the first height information of any candidate subregion being smaller than the first height information of the current target first subregion, and the first height information of any candidate subregion being the minimum value among the first height information respectively corresponding to all first candidate subregions, determining the any candidate subregion as a new target first subregion;

[0031] In response to the first height information of all candidate sub-regions being greater than the first height information of the current target first sub-region, ending the iteration;

[0032] The first seed region and new first target sub-regions determined respectively in a plurality of iteration cycles are both used as target first sub-regions corresponding to the first target object.

[0033] In an optional implementation manner, the method further includes:

[0034] Based on the noise data and a preset noise threshold, a second sub-region belonging to a plain terrain is determined from the multiple sub-regions belonging to the land:

[0035] The position information of the second target object in the second area formed by the plurality of second sub-areas is determined, and based on the position information, the second target object is constructed in the second sub-area to generate a second virtual scene corresponding to the plain terrain.

[0036] In an optional implementation manner, determining the position information of the second target object in the second area formed by the plurality of second sub-areas includes:

[0037] Acquire a second scene parameter for generating a town area; wherein the second scene parameter includes at least one of the following: an area of ​​the second target object, and a number of the second target objects;

[0038] Based on the second scene parameter, Poisson distribution sampling is performed on the second area to obtain position information of a second sub-area corresponding to the second target object in the second area.

[0039] In an optional implementation manner, the determining the position information of the second sub-region corresponding to the second target object in the second region includes:

[0040] Among the multiple second sub-regions of the second region, a second seed region is determined, and based on the position information of the second seed region in the second region, the second seed region is grown and expanded to obtain the position information of the second sub-region corresponding to the second target object in the second region.

[0041] In an optional implementation manner, the second target object includes a town; there are buildings in the town;

[0042] The constructing the second target object in the second area based on the location information includes:

[0043] Acquire a second scene parameter for generating a building; the second scene parameter includes at least one of the following: shape information corresponding to the building, quantity information corresponding to the building, and density information corresponding to the building;

[0044] Based on the second scene parameter and the position information, determining, from the second sub-region corresponding to the second target object, first position information of a first target sub-region belonging to the building in the second region and a position of an entrance of the building;

[0045] The building is constructed based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building.

[0046] In an optional implementation manner, the town further includes: a first road connecting the buildings;

[0047] The constructing the second target object in the second area based on the location information further includes:

[0048] Determine the interconnection relationship between the entrances of the buildings based on the locations of the entrances of the buildings; determine the second location information of the second target sub-area belonging to the first road in the second area by using the interconnection relationship and the first location information of the first target sub-area belonging to the buildings in the second area;

[0049] The first road is constructed based on second position information of the second target sub-area in the second area.

[0050] In an optional implementation manner, there are multiple towns; the second target object further includes: a second road connecting different towns;

[0051] The constructing the second target object in the second area based on the location information further includes:

[0052] Based on the second position information of the second target sub-area corresponding to the first road in the second area, a breadth-first search of the second sub-area is performed until the third target area belonging to the second road determined during the search process can connect all towns, and based on the third position information of the third target area in the second area determined during the search process, the second road is constructed.

[0053] In an optional implementation, the constructed building includes: a building model, and a room model of each of a plurality of rooms divided in the building; the room model includes a plurality of furniture models;

[0054] The step of constructing the building based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building includes:

[0055] Based on the first position information, shape information of the building is determined; the shape information includes: a plurality of top view contour lines of the building, and size information corresponding to each of the top view contour lines; a space surrounded by the plurality of top view contour lines includes an indoor space of the building;

[0056] Based on the location of the entrance of the building, the space surrounded by the plurality of overhead contour lines is divided into a plurality of rooms, and for each room, according to the room type of the corresponding room of the room, a furniture placement method corresponding to the room is generated;

[0057] A building model is generated based on the shape information corresponding to the building and the positions of each room in the space; and a room model is generated for each room in the building according to the furniture placement method corresponding to the room.

[0058] In an optional implementation, the dividing of the space surrounded by the plurality of top-view contour lines into a plurality of rooms based on the location of the entrance of the building includes:

[0059] Based on the location of the entrance, determine a first sub-contour line belonging to the entrance in the top-view contour line, and based on the size information of each top-view contour line, determine a second sub-contour line belonging to the window;

[0060] Based on the position of the first sub-contour line and the position of the second sub-contour line, dividing the space surrounded by the plurality of top-view contour lines into a plurality of sub-spaces;

[0061] From the multiple subspaces, multiple seed spaces are determined, and the room types corresponding to the rooms to which each seed space belongs are calculated using the heat map score;

[0062] Perform room expansion processing on multiple seed spaces respectively to determine first subspaces corresponding to the multiple rooms respectively; the space size formed by the first subspace belonging to any room is greater than the minimum size threshold corresponding to any room;

[0063] Based on the location of the entrance and the locations of the first subspaces corresponding to the rooms in the space, determining a second subspace where a corridor connecting the entrance and the multiple rooms is located;

[0064] Based on the positions of the other subspaces except the first subspace and the second subspace among the multiple subspaces and the positions of the first subspaces corresponding to the rooms, determining the third subspaces corresponding to the rooms respectively from the other subspaces;

[0065] Based on the first subspace and the third subspace corresponding to each room and the corresponding room type, a corresponding room is constructed.

[0066] In an optional implementation manner, obtaining the target map includes:

[0067] Acquire a third scene parameter for generating an initial map and a fourth scene parameter for generating a land area; the third scene parameter includes at least one of the following: size information of the initial map and a preset scale; the fourth scene parameter includes at least one of the following: the number of land and the area of ​​land;

[0068] Based on the third scene parameter, create an initial map;

[0069] Based on the fourth scenario parameter, a target area belonging to land is determined in the initial map to obtain the target map.

[0070] In an optional implementation manner, determining the target area belonging to land in the initial map based on the fourth scene parameter includes:

[0071] Based on the fourth scene parameter, determining a third seed area from a plurality of sub-areas included in the initial map;

[0072] Based on the position information of the third seed region in the initial map, the third seed region is subjected to growth and expansion processing to obtain a plurality of sub-regions belonging to the land; the plurality of sub-regions belonging to the land constitute the target region.

[0073] In an optional implementation, the growth and expansion processing is performed on the third seed region based on the position information of the third seed region in the initial map to obtain a plurality of sub-regions belonging to the land, including:

[0074] In each of the multiple iterations, execute:

[0075] Determine a candidate seed region for the current iteration period based on the position information of the sub-region that has been determined to belong to the land in the current iteration period in the initial map; wherein the candidate seed region is adjacent to any sub-region that belongs to the land; wherein the sub-region includes the third seed region;

[0076] Randomly determine a preset number of selected seed areas from the candidate seed areas, and determine the selected seed areas as sub-areas belonging to land;

[0077] In response to the preset iteration stop condition not being met, entering the next iteration cycle.

[0078] In an optional implementation manner, the preset iteration stop condition includes at least one of the following:

[0079] The number of iteration cycles reaches a preset iteration cycle number threshold;

[0080] Failed to determine the candidate seed region for the current iteration cycle.

[0081] In a second aspect, an embodiment of the present disclosure further provides a virtual scene generation device, the device comprising:

[0082] An acquisition module, used to acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: a terrain undulation degree, a maximum height, and a number of hills of the target map;

[0083] A height determination module, configured to determine noise data for a plurality of sub-areas belonging to land in the target map based on the first scene parameter; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land;

[0084] A first region determining module, which determines, based on the noise data and a preset noise threshold, a first sub-region belonging to the hilly terrain from among the plurality of sub-regions belonging to the land;

[0085] The first scene construction module is used to determine the corresponding first height information for each of the plurality of the first sub-areas, and to construct a first virtual scene corresponding to the hilly terrain using the first height information.

[0086] In an optional implementation manner, when the first region determination module determines the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land based on the noise data and the preset noise threshold, it is configured to:

[0087] For each sub-region among the multiple sub-regions belonging to the land, comparing the noise value corresponding to the sub-region with the noise threshold;

[0088] In response to the noise data being greater than the noise threshold, the sub-region is determined as the first sub-region.

[0089] In an optional implementation manner, when the first scene construction module determines the corresponding first height information for each of the plurality of first sub-areas, the first scene construction module is configured to:

[0090] Determine a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determine second height information for first grid vertices in the grids located in the first region; each of the grids includes at least one of the first sub-regions;

[0091] Based on the second height information of the first mesh vertices, first height information respectively corresponding to the plurality of first sub-regions is determined.

[0092] In an optional implementation manner, when the first scene construction module determines a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determines height information for a first grid vertex in the grid located in the first region, the first scene construction module is further configured to:

[0093] Determine a circumscribed rectangle of the first area based on positions of the plurality of first sub-areas in the first area in the target map;

[0094] The circumscribed rectangle is divided into a plurality of grids, and first grid vertices in the plurality of grids that are located in the first region are randomly sampled in height to obtain second height information corresponding to each of the first grid vertices.

[0095] In an optional implementation manner, when the first scene construction module determines the first height information respectively corresponding to the plurality of first sub-areas based on the second height information of the first mesh vertices, it is further configured to:

[0096] For each mesh, based on the second height information corresponding to the first mesh vertices of the mesh, height interpolation processing is performed on each first sub-region in the mesh to obtain first height information corresponding to each first sub-region of the mesh.

[0097] In an optional implementation manner, after the first region determining module determines the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land, the device further includes a first model building module, which is used to:

[0098] Based on the first height information respectively corresponding to the first sub-areas, determining a target first sub-area corresponding to a first target object in the first area;

[0099] The first target object is constructed in the first area based on the position information of the target first sub-area in the first area.

[0100] In an optional implementation manner, when determining the target first sub-region corresponding to the first target object in the first region based on the first height information respectively corresponding to the first sub-regions, the first model building module is used to:

[0101] Based on the first height information respectively corresponding to the first sub-regions, determining a first seed region belonging to the first target object from the first sub-regions;

[0102] Perform multiple iterations of the following:

[0103] Determine a current target first sub-region of a current iteration cycle; the current target first sub-region includes: the first seed region, or a new target first sub-region determined in a previous iteration cycle;

[0104] Based on the position of the current target first sub-region in the first region, determining, from the first region, a candidate sub-region adjacent to the current target first sub-region;

[0105] In response to the first height information of any candidate subregion being smaller than the first height information of the current target first subregion, and the first height information of any candidate subregion being the minimum value among the first height information respectively corresponding to all first candidate subregions, determining the any candidate subregion as a new target first subregion;

[0106] In response to the first height information of all candidate sub-regions being greater than the first height information of the current target first sub-region, ending the iteration;

[0107] The first seed region and new first target sub-regions determined respectively in a plurality of iteration cycles are both used as target first sub-regions corresponding to the first target object.

[0108] In an optional implementation manner, the device further includes a second scene construction module, configured to:

[0109] Based on the noise data and a preset noise threshold, a second sub-region belonging to a plain terrain is determined from the multiple sub-regions belonging to the land:

[0110] The position information of the second target object in the second area formed by the plurality of second sub-areas is determined, and based on the position information, the second target object is constructed in the second sub-area to generate a second virtual scene corresponding to the plain terrain.

[0111] In an optional implementation manner, when determining the position information of the second target object in the second area formed by the plurality of second sub-areas, the second scene construction module is used to:

[0112] Acquire a second scene parameter for generating a town area; wherein the second scene parameter includes at least one of the following: an area of ​​the second target object, and a number of the second target objects;

[0113] Based on the second scene parameter, Poisson distribution sampling is performed on the second area to obtain position information of a second sub-area corresponding to the second target object in the second area.

[0114] In an optional implementation manner, when determining the position information of the second sub-region corresponding to the second target object in the second region, the second scene construction module is further configured to:

[0115] Among the multiple second sub-regions of the second region, a second seed region is determined, and based on the position information of the second seed region in the second region, the second seed region is grown and expanded to obtain the position information of the second sub-region corresponding to the second target object in the second region.

[0116] In an optional implementation manner, when the second scene construction module constructs the second target object in the second area based on the location information, the device further includes a second model construction module, which is used to:

[0117] Acquire a second scene parameter for generating a building; the second scene parameter includes at least one of the following: shape information corresponding to the building, quantity information corresponding to the building, and density information corresponding to the building;

[0118] Based on the second scene parameter and the position information, determining, from the second sub-region corresponding to the second target object, first position information of a first target sub-region belonging to the building in the second region and a position of an entrance of the building;

[0119] The building is constructed based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building.

[0120] In an optional implementation manner, when the second scene construction module constructs the second target object in the second area based on the location information, the second model construction module is configured to:

[0121] Determine the interconnection relationship between the entrances of the buildings based on the locations of the entrances of the buildings; determine the second location information of the second target sub-area belonging to the first road in the second area by using the interconnection relationship and the first location information of the first target sub-area belonging to the buildings in the second area;

[0122] The first road is constructed based on second position information of the second target sub-area in the second area.

[0123] In an optional implementation manner, when the second scene construction module constructs the second target object in the second area based on the location information, the second model construction module is further used to:

[0124] Based on the second position information of the second target sub-area corresponding to the first road in the second area, a breadth-first search of the second sub-area is performed until the third target area belonging to the second road determined during the search process can connect all towns, and based on the third position information of the third target area in the second area determined during the search process, the second road is constructed.

[0125] In an optional implementation manner, when constructing the building based on the first location information, the location of the entrance of the building, and the shape information corresponding to the building, the second model construction module is further used to:

[0126] Based on the first position information, shape information of the building is determined; the shape information includes: a plurality of top view contour lines of the building, and size information corresponding to each of the top view contour lines; a space surrounded by the plurality of top view contour lines includes an indoor space of the building;

[0127] Based on the location of the entrance of the building, the space surrounded by the plurality of overhead contour lines is divided into a plurality of rooms, and for each room, according to the room type of the corresponding room of the room, a furniture placement method corresponding to the room is generated;

[0128] A building model is generated based on the shape information corresponding to the building and the positions of each room in the space; and a room model is generated for each room in the building according to the furniture placement method corresponding to the room.

[0129] In an optional implementation manner, when the second model building module divides the space surrounded by the plurality of top-view contour lines into a plurality of rooms based on the location of the entrance of the building, it is further configured to:

[0130] Based on the location of the entrance, determine a first sub-contour line belonging to the entrance in the top-view contour line, and based on the size information of each top-view contour line, determine a second sub-contour line belonging to the window;

[0131] Based on the position of the first sub-contour line and the position of the second sub-contour line, dividing the space surrounded by the plurality of top-view contour lines into a plurality of sub-spaces;

[0132] From the multiple subspaces, multiple seed spaces are determined, and the room types corresponding to the rooms to which each seed space belongs are calculated using the heat map score;

[0133] Perform room expansion processing on multiple seed spaces respectively to determine first subspaces corresponding to the multiple rooms respectively; the space size formed by the first subspace belonging to any room is greater than the minimum size threshold corresponding to any room;

[0134] Based on the location of the entrance and the locations of the first subspaces corresponding to the rooms in the space, determining a second subspace where a corridor connecting the entrance and the multiple rooms is located;

[0135] Based on the positions of the other subspaces except the first subspace and the second subspace among the multiple subspaces and the positions of the first subspaces corresponding to the rooms, determining the third subspaces corresponding to the rooms respectively from the other subspaces;

[0136] Based on the first subspace and the third subspace corresponding to each room and the corresponding room type, a corresponding room is constructed.

[0137] In an optional implementation manner, the device further includes a map construction module, which is used to:

[0138] Acquire a third scene parameter for generating an initial map and a fourth scene parameter for generating a land area; the third scene parameter includes at least one of the following: size information of the initial map and a preset scale; the fourth scene parameter includes at least one of the following: the number of land and the area of ​​land;

[0139] Based on the third scene parameter, create an initial map;

[0140] Based on the fourth scenario parameter, a target area belonging to land is determined in the initial map to obtain the target map.

[0141] In an optional implementation manner, when the map construction module determines the target area belonging to land in the initial map based on the fourth scene parameter, the device further includes: a second area determination module, which is used to:

[0142] Based on the fourth scene parameter, determining a third seed area from a plurality of sub-areas included in the initial map;

[0143] Based on the position information of the third seed region in the initial map, the third seed region is subjected to growth and expansion processing to obtain a plurality of sub-regions belonging to the land; the plurality of sub-regions belonging to the land constitute the target region.

[0144] In an optional implementation manner, when the second region determination module performs growth and expansion processing on the third seed region based on the position information of the third seed region in the initial map to obtain multiple sub-regions belonging to the land, it is specifically used to:

[0145] In each of the multiple iterations, execute:

[0146] Determine a candidate seed region for the current iteration period based on the position information of the sub-region that has been determined to belong to the land in the current iteration period in the initial map; wherein the candidate seed region is adjacent to any sub-region that belongs to the land; wherein the sub-region includes the third seed region;

[0147] Randomly determine a preset number of selected seed areas from the candidate seed areas, and determine the selected seed areas as sub-areas belonging to land;

[0148] In response to the preset iteration stop condition not being met, entering the next iteration cycle.

[0149] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.

[0150] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.

[0151] The virtual scene generation method provided by the embodiment of the present disclosure determines the noise data of multiple sub-areas belonging to the land according to the first scene parameter input by the user, determines the first sub-area belonging to the hilly terrain according to the noise data corresponding to each sub-area, and determines the first height information of the first sub-area belonging to the hilly terrain, and renders the first height information of each first sub-area to obtain the first virtual scene corresponding to the hilly terrain. In this process, the user only needs to input limited scene parameters to randomly generate the first virtual scene matching the first scene parameters, and the generation efficiency is high.

[0152] In addition, when generating the first virtual scene, since when constructing the first virtual scene corresponding to the hilly area, the process of determining noise data for multiple sub-areas belonging to the land and determining the first sub-area based on the noise data, and the process of determining the first height information for multiple first sub-areas belonging to the hilly terrain are both random, even if the same parameters are input, a first virtual scene with low repeatability and diverse expressions can be generated.

[0153] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0154] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0155] Figure 1 A flowchart of a virtual scene generation method provided by an embodiment of the present disclosure is shown;

[0156] Figure 2 A flow chart of generating a target map according to a region growing algorithm provided by an embodiment of the present disclosure is shown;

[0157] Figure 3 An example diagram of generating a target map based on noise data provided by an embodiment of the present disclosure is shown;

[0158] Figure 4 A specific example diagram of determining first height information of a first sub-region provided by an embodiment of the present disclosure is shown;

[0159] Figure 5 A specific example diagram of river model generation provided by an embodiment of the present disclosure is shown;

[0160] Figure 6 A specific example diagram of dividing a space surrounded by a plurality of top-view contour lines into a plurality of subspaces provided by an embodiment of the present disclosure is shown;

[0161] Figure 7a A specific example diagram of determining a seed space in multiple subspaces provided by an embodiment of the present disclosure is shown;

[0162] Figure 7b A specific example diagram of a room obtained by expanding a seed space provided by an embodiment of the present disclosure is shown;

[0163] Figure 8a One of the specific example diagrams for generating a first road provided by an embodiment of the present disclosure is shown;

[0164] Figure 8b A second specific example diagram of generating a first road provided by an embodiment of the present disclosure is shown;

[0165] Fig. 9 A specific example diagram of generating a second road provided by an embodiment of the present disclosure is shown;

[0166] Fig.10 A schematic diagram of a virtual scene generating device provided by an embodiment of the present disclosure is shown;

[0167] Fig.11 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0168] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0169] According to research, procedural content generation (PCG) can be used to quickly generate three-dimensional virtual scenes or assist designers in designing open virtual scenes. The generation quality evaluation of PCG has the following five dimensions: Reliability: The generated content can always meet the expected needs, and there are no unsolvable or defects (bugs). Controllability: The main parameters of the scene style should be exposed to the user, so that the user can generate scenes with different characteristics by adjusting the parameters, such as vegetation coverage, water coverage, and flatness of the terrain. Expressiveness and diversity: Even if the same parameters are given, it should be possible to generate maps with low repetitiveness, diverse expressions, and differences. Creativity and credibility: People cannot tell at a glance that it is program-generated. Speed ​​and efficiency: Different application scenarios (offline / online) have different efficiency requirements. In the current open virtual scene algorithm generated by computers, role-playing game maps such as fields, castles, and dungeons can be generated according to the protagonist's adventure story environment, and they are inlaid on a large two-dimensional plane to form a virtual game scene. When generating, it is achieved by splicing preset materials. This method of generating virtual scenes has the disadvantages of poor expressiveness and diversity.

[0170] Based on the above research, the present disclosure provides a virtual scene generation method, in which users can generate virtual scenes with different characteristics by inputting limited scene parameters, and the generation efficiency is high. Moreover, since the generation algorithm is random, even if the same parameters are input, a target virtual scene with low repetitiveness and diverse performance can be generated.

[0171] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.

[0172] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0173] To facilitate understanding of the present embodiment, a virtual scene generation method disclosed in the embodiment of the present disclosure is first introduced in detail. The executor of the virtual scene generation method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities. In some possible implementation methods, the virtual scene generation method can be implemented by a processor calling computer-readable instructions stored in a memory.

[0174] It should be noted that the virtual scene generation method provided in the embodiments of the present disclosure can be applied to various types of games, such as third-person perspective shooting games, first-person perspective shooting games, role-playing games, action games, strategy games, fighting games, sports games, adventure games, etc., without specific limitation. In addition, the virtual scene generation method can also be used in other scenarios, such as augmented reality scenarios, metaverse scenarios, etc., which are not limited in the embodiments of the present disclosure.

[0175] Taking the application of the virtual scene in the embodiment of the present disclosure to the game scene as an example, the constructed virtual scene is the environment of the game world, which may include virtual buildings, virtual plants, virtual props, etc.

[0176] The virtual scene generation method provided by the embodiment of the present disclosure is described below.

[0177] See also Figure 1 A flowchart of a virtual scene generation method is shown, the method comprising steps S101 to S104, wherein:

[0178] S101: Acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: a terrain undulation degree, a maximum height, and the number of hills of the target map;

[0179] S102: Based on the first scene parameter, determine noise data for multiple sub-areas belonging to land in the target map; the noise data is used to characterize height information corresponding to the multiple sub-areas belonging to land.

[0180] S103: Based on the noise data and a preset noise threshold, determine a first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land.

[0181] S104: Determine corresponding first height information for each of the plurality of first sub-areas, and construct a first virtual scene corresponding to the hilly terrain by using the first height information.

[0182] The disclosed embodiment determines the noise data of multiple sub-areas belonging to the land according to the first scene parameter input by the user after obtaining the target map, determines the first sub-area belonging to the hilly terrain according to the noise data corresponding to each sub-area, and determines the first height information of the first sub-area belonging to the hilly terrain, and renders the first height information of each first sub-area to obtain the first virtual scene corresponding to the hilly terrain. In this process, the user only needs to input limited scene parameters to randomly generate the first virtual scene matching the first scene parameters, and the generation efficiency is high.

[0183] In addition, when generating the first virtual scene, since when constructing the first virtual scene corresponding to the hilly area, the process of determining noise data for multiple sub-areas belonging to the land and determining the first sub-area based on the noise data, and the process of determining the first height information for multiple first sub-areas belonging to the hilly terrain are both random, even if the same parameters are input, a first virtual scene with low repeatability and diverse expressions can be generated.

[0184] The above S101 to S104 are described in detail below.

[0185] In view of the above S101, in an embodiment of the present disclosure, a specific method for obtaining a target map is provided, including:

[0186] Acquire a third scenario parameter for generating an initial map and a fourth scenario parameter for generating a land area; the third scenario parameter includes at least one of the following: size information of the initial map and a preset scale; the fourth scenario parameter includes at least one of the following: the number of land and the area of ​​land; create an initial map based on the third scenario parameter; determine a target area belonging to the land in the initial map based on the fourth scenario parameter, and obtain the target map.

[0187] Exemplarily, the third scene parameter and the fourth scene parameter may be input by a user through a preset input device when generating a target map.

[0188] The initial map includes multiple sub-areas, each of which has initial feature information, and the initial feature information is used to characterize the initial terrain features of the sub-area, wherein the initial terrain features include ocean and land. The initial terrain features of each sub-area can be changed between ocean and land.

[0189] Exemplarily, the initial map may be composed of 200×200 sub-regions, each of which has the same area. In the initial map generated according to the size information of the initial map included in the third scenario parameter and the preset scale, the initial terrain feature of each sub-region is set to the ocean, and then according to the number of land and the area of ​​land indicated by the fourth scenario parameter, in the sub-region, the sub-region belonging to the land is determined, and the initial terrain feature of the sub-region determined to belong to the land is changed to land.

[0190] Specifically, based on the fourth scene parameter, a third seed area is determined from multiple sub-areas included in the initial map; based on the position information of the third seed area in the initial map, the third seed area is grown and expanded to obtain multiple sub-areas belonging to the land; and the multiple sub-areas belonging to the land constitute the target area.

[0191] Exemplarily, the user may input the fourth scenario parameter; for example, the number of lands generated is N, and the terminal device responds to receiving the fourth scenario parameter input by the user and reads the number of lands N therefrom; then randomly selects N sub-regions belonging to the ocean in the initial map as the third seed region (determined according to the number of lands), and changes its initial terrain features to belong to the land; then adopts the regional growing algorithm, starts growing and expanding from the third seed region, and each time the growth and expansion occurs, randomly selects one of the sub-regions belonging to the ocean adjacent to the sub-region belonging to the land, and changes it to the sub-region belonging to the land. According to the information of the land area in the fourth scenario parameter, when the area of ​​the multiple sub-regions belonging to the land reaches the land area included in the fourth scenario parameter, or when there is no adjacent sub-region belonging to the ocean around the sub-region belonging to the land, the growth and expansion is stopped, and a target region consisting of multiple sub-regions belonging to the land is generated.

[0192] See also Figure 2 A flowchart of generating a target map according to a region growing algorithm is shown, comprising:

[0193] S201: Based on the position information of the third seed region in the initial map, perform growth and expansion processing on the third seed region.

[0194] S202: In each of the multiple iteration cycles, execute:

[0195] S2021: determining a candidate seed region for the current iteration period based on the position information of the sub-region that has been determined to belong to the land in the current iteration period in the initial map; wherein the candidate seed region is adjacent to any sub-region that belongs to the land; wherein the sub-region includes the third seed region;

[0196] S2022: Randomly determine a preset number of selected seed areas from the candidate seed areas, and determine the selected seed areas as sub-areas belonging to land;

[0197] S2023: Determine whether the current iteration cycle meets the preset iteration stop condition. If not, jump to S2021; if yes, jump to S203.

[0198] The preset iteration stop condition includes at least one of the following conditions a to b:

[0199] Condition a: The number of iteration cycles reaches a preset iteration cycle number threshold.

[0200] Exemplarily, the preset threshold of the number of iteration cycles can be determined based on the information of the area of ​​the target region belonging to the land obtained from the fourth scenario parameter. For example, the number of sub-regions that the target region belonging to the land is composed of can be determined based on the size of the area of ​​the sub-region belonging to the land, thereby determining the preset threshold of the number of iteration cycles. When the iteration cycle reaches the preset threshold of the number of iteration cycles, the iteration stops.

[0201] Condition b: Failure to determine the candidate seed region for the current iteration cycle.

[0202] Exemplarily, the candidate seed region may be a sub-region belonging to the ocean. When there is no sub-region belonging to the ocean around the sub-region belonging to the land, it is determined that the candidate seed region of the current iteration cycle fails, and the iteration stops.

[0203] S203: Determine multiple sub-areas belonging to the land generated in the current iteration cycle as target areas, and obtain a target map.

[0204] Exemplarily, the target map may include multiple target areas belonging to land, and each target area belonging to land may be separated by a sub-area belonging to the ocean, that is, multiple islands are generated; it may also include one target area belonging to land, and the target area belonging to land fills the entire initial map, that is, a continent is generated, or the target area belonging to land is surrounded or semi-surrounded by the sub-area belonging to the ocean. The specific random generation is based on the regional growing algorithm and is not limited here.

[0205] After the target map is generated, the initial terrain features of each sub-region in the target map are also determined. At this time, the target map includes multiple sub-regions belonging to the land and / or multiple sub-regions belonging to the ocean.

[0206] With respect to the above S102, in the multiple sub-areas belonging to the land in the target map, the terrain of the land area can be further divided so as to have terrain features similar to those in the real world.

[0207] Here, a first region for generating a hilly terrain and a second region for generating a flat terrain may be determined in the land region based on the height information of a plurality of sub-regions belonging to the land.

[0208] Exemplarily, random noise data may be used to characterize the height information of multiple sub-regions belonging to the land. For example, the noise data may be Perlin Noise. When determining noise data for multiple sub-regions belonging to the land, for example, a set of Perlin noise data may be randomly determined, and a set of Perlin noise data may include multiple noise values ​​between 0 and 1; then a noise value is applied to each sub-region. The noise value corresponding to each sub-region is used to characterize the height information corresponding to the sub-region.

[0209] In addition, in addition to using Perlin noise, noise data can also be generated using other noises, such as value noise, simplex noise, etc., to generate noise data with a relatively gentle change range, thereby avoiding a sudden change in height in a sub-region among multiple sub-regions, resulting in failure in generating terrain. The selected noise data can be selected according to actual needs and is not limited here.

[0210] With respect to the above S103, a preset noise threshold is determined, and the preset noise threshold can be used to determine whether the height information of the plurality of sub-areas belonging to the land conforms to the terrain characteristics of the first area.

[0211] In one embodiment provided in the present disclosure, for each sub-region among multiple sub-regions belonging to the land, the noise value corresponding to the sub-region is compared with the noise threshold; in response to the noise data being greater than the noise threshold, the sub-region is determined as the first sub-region.

[0212] Exemplarily, the noise values ​​corresponding to each sub-region belonging to the land are compared with the preset noise threshold; if the noise value corresponding to a sub-region is greater than the preset noise threshold, it indicates that the sub-region belongs to a first sub-region with a certain height feature, that is, a hilly terrain.

[0213] In addition, when comparing the noise value corresponding to each sub-region with the noise threshold, it may also be that when the noise value is greater than or equal to the noise threshold, it is characterized that the sub-region belongs to the first sub-region with a certain height feature.

[0214] The plurality of first sub-areas constitute a first area for generating a hilly terrain.

[0215] Exemplarily, the preset noise threshold can select any value between 0 and 1. The area ratio between the generated first region and the second region can be controlled by the size of the noise threshold. When the noise data has been determined, the larger the noise threshold, the smaller the area ratio between the first region and the second region; the smaller the noise threshold, the larger the area ratio between the first region and the second region.

[0216] For example, if the preset noise threshold is selected as 0.5, the height information corresponding to all sub-areas belonging to the land is judged, and the sub-areas belonging to the land corresponding to the height information higher than 0.5 are determined as the first sub-areas; the sub-areas belonging to the land corresponding to the height information less than 0.5 are determined as the second sub-areas.

[0217] See also Figure 3 An example diagram of generating a target map based on noise data is shown; taking the preset noise threshold of 0.5 as an example, in this example, the noise data corresponding to sub-areas of different depths are different. Among them, areas a1 to a6 are hilly terrains with obvious height features, and their noise thresholds can be, for example, between 0.7 and 0.9. Areas b1 to b6 can also be represented as hilly terrains, and their noise thresholds can be, for example, between 0.5 and 0.7. The remaining areas can be represented as plain terrains with unclear height features, and their noise thresholds can be, for example, between 0.1 and 0.4. The range of noise thresholds given here is just an example to characterize the height features of different areas.

[0218] With respect to the above S104, after respectively determining the first height information of the plurality of first sub-areas belonging to the hilly terrain, the first sub-areas can be rendered according to the different first height information of the first sub-areas, so as to construct a first virtual scene with ups and downs and hilly terrain characteristics in the plurality of sub-areas belonging to the land in the target map.

[0219] In a specific embodiment provided by the present disclosure, multiple grids are determined based on the positions of multiple first sub-regions in the first region in the target map, and second height information is determined for first grid vertices in the grids located in the first region; each of the grids includes at least one first sub-region; based on the second height information of the first grid vertices, first height information corresponding to the multiple first sub-regions is determined.

[0220] Exemplarily, the second height information of the first mesh vertex located in the first area in the mesh is randomly determined within a certain range of height values ​​using a random sampling algorithm.

[0221] In a specific implementation, the circumscribed rectangle of the first area is determined based on the positions of the multiple first sub-areas in the first area in the target map; the circumscribed rectangle is divided into multiple grids, and the first grid vertices in the multiple grids located in the first area are randomly sampled in height to obtain the second height information corresponding to each of the first grid vertices.

[0222] For example, see Figure 4 A specific example diagram of determining the first height information of the first sub-region is shown, setting a maximum side length threshold of a grid, using the minimum circumscribed rectangle to frame the irregular first region, and dividing it into half according to the long side or the wide side of the circumscribed rectangle until both the long side and the wide side are less than the maximum side length threshold, thereby obtaining multiple unit rectangles, i.e., multiple grids. Wherein, each grid includes multiple first sub-regions; in addition, if the grid is located adjacent to the second region, the grid may also include multiple second sub-regions. Then, the height of the first grid vertex located in the first region among the four vertices of the grid can be randomly sampled. For example, if the vertex d1 is not in the first region m1 (i.e., the second grid vertex), the height is considered to be 0, and the vertex d2 is in the first region m1 (i.e., the first grid vertex), then the height value of the grid vertex is randomly determined between the height value corresponding to the maximum terrain height and the height value corresponding to the minimum terrain height contained in the second scene parameter, wherein the maximum terrain height and the minimum terrain height can be set in advance according to the actual application.

[0223] In one embodiment of the present disclosure, for each mesh, based on the second height information corresponding to the first mesh vertices belonging to the mesh, height interpolation processing is performed on each first sub-region belonging to the mesh to obtain the first height information corresponding to each first sub-region belonging to the mesh.

[0224] Among them, for each grid, based on the second height information corresponding to the first grid vertices belonging to the grid, height interpolation processing is performed on each first sub-region belonging to the grid to obtain the first height information corresponding to each first sub-region belonging to the grid.

[0225] For example, the first sub-area may be subjected to bicubic interpolation processing, so that the terrain obtained is smoother and closer to the terrain of the real scene. For example, if you want to obtain terrain with a relatively gentle slope, you can only perform one height interpolation processing between two adjacent first mesh vertices, so that a terrain with a relatively gentle slope will be generated; if you want to obtain terrain with a relatively steep slope, you can perform multiple height interpolation processing between two adjacent first mesh vertices, so that a terrain with a relatively steep slope will be generated.

[0226] In addition, since some grids include both the first sub-region and the second sub-region, that is, the grid includes a second grid vertex located in the second region, the height of the second grid vertex can be regarded as a preset value (for example, 0, indicating that the height corresponding to the second grid vertex is 0), therefore, when using the second height information corresponding to the first grid vertices to perform height interpolation processing on each first sub-region belonging to the grid, for example, height interpolation processing can be performed based on the preset height value of the second grid vertex and the second height information determined for the first grid vertex to obtain the first height information corresponding to each first sub-region belonging to the grid.

[0227] After the first height information is determined, a first virtual scene corresponding to the hilly terrain can be constructed according to the first height information.

[0228] In another embodiment, based on the first height information corresponding to the first sub-areas respectively, the target first sub-area corresponding to the first target object can be determined in the first area; based on the position information of the target first sub-area in the first area, the first target object can be constructed in the first area.

[0229] Here, if the first target object is constructed in the first area, the first scene parameter at least further includes: the number and width of the first target objects.

[0230] Exemplarily, one or more target first sub-regions corresponding to the first target object are randomly selected from multiple first sub-regions belonging to the hilly terrain as the starting point of the river, and the position information of the target first sub-region in the first virtual scene and the position information of the first sub-region adjacent to the target first sub-region are obtained, wherein the position information includes the height values ​​of the target first sub-region and the first sub-region; each search randomly selects a first sub-region with a height value lower than the target first sub-region from multiple first sub-regions adjacent to the target sub-region, and changes it to a new target first sub-region as the area where the river flows. If there is a second sub-region around the new target first sub-region, the second sub-region can be selected as the new target first sub-region, that is, the river area flows from the hills to the plains. When there are no first sub-regions and second sub-regions with a lower height value than the new target first sub-region around it, or when there is a sub-region belonging to the ocean around it, the search is stopped.

[0231] For example, when there is a sub-region belonging to the ocean around the river region, the sub-region belonging to the ocean is selected as the end point of the river.

[0232] See also Figure 5 A specific example diagram generated by a river model is shown, including:

[0233] S501: determining a first seed region belonging to the first target object from the first sub-regions based on first height information respectively corresponding to the first sub-regions;

[0234] S502: Execute the following multiple iteration cycles:

[0235] S5021: Determine a current target first sub-region of a current iteration cycle; the current target first sub-region includes: the first seed region, or a new target first sub-region determined in a previous iteration cycle;

[0236] S5022: Determine, from the first region, a candidate subregion adjacent to the current target first subregion based on the position of the current target first subregion in the first region;

[0237] S5023: In response to the first height information of any candidate sub-region being smaller than the first height information of the current target first sub-region, and the first height information of any candidate sub-region being the minimum value among the first height information respectively corresponding to all first candidate sub-regions, determining the any candidate sub-region as a new target first sub-region;

[0238] S5024: Determine whether the first height information of all candidate sub-regions is greater than the first height information of the current target first sub-region. If not, jump to S5021; if yes, jump to S503;

[0239] S503: taking the first seed region and the new first target sub-regions determined in a plurality of iteration cycles as the target first sub-region corresponding to the first target object.

[0240] In addition, the stopping condition of the iteration may also be: at least one of the determined candidate sub-regions belongs to other water systems, such as other rivers, or sub-regions where the ocean is located.

[0241] After the target first sub-region belonging to the river is determined, the target first sub-region is rendered, and a river model corresponding to the target first sub-region belonging to the river is generated in the target map.

[0242] In addition, after generating the first virtual scene corresponding to the hilly terrain, the embodiment of the present disclosure further provides a specific method for generating a second virtual scene corresponding to the plain terrain, which at least includes the following steps S11 to S12:

[0243] S11: Based on the noise data and a preset noise threshold, determine a second sub-region belonging to a plain terrain from among the multiple sub-regions belonging to the land.

[0244] Exemplarily, the noise values ​​corresponding to each sub-region belonging to the land are compared with the preset noise threshold; if the noise value corresponding to a sub-region is smaller than the preset noise threshold, it indicates that the height feature of the sub-region is not obvious, that is, it is the second sub-region belonging to the plain terrain.

[0245] In addition, when comparing the noise value corresponding to each sub-region with the noise threshold, it may also be that when the noise value is less than or equal to the noise threshold, it is characterized that the sub-region belongs to the second sub-region of the plain terrain.

[0246] The plurality of second sub-areas constitute a second area for generating a plain terrain.

[0247] S12: Determine the position information of the second target object in the second area formed by the plurality of second sub-areas, and based on the position information, construct the second target object in the second sub-area to generate a second virtual scene corresponding to the plain terrain.

[0248] Specifically, the embodiments of the present disclosure provide any one of the following methods M1 or M2 to determine the position information of the second sub-region corresponding to the second target object in the second region.

[0249] M1: Obtain second scene parameters for generating a town area; wherein the second scene parameters include at least one of the following: the area of ​​the second target object, and the number of the second target objects; based on the second scene parameters, perform Poisson distribution sampling on the second area to obtain the position information of the second sub-area corresponding to the second target object in the second area.

[0250] Exemplarily, the second target object may be a town on a plain terrain. The area of ​​the second target object is obtained according to the second scene parameter, and a town area equal to the area of ​​the second target object is generated. The number of second target objects generated is obtained according to the second scene parameter, and the position information of each second target object in the second area is determined using Poisson distribution.

[0251] For example, the town area can be in a circular or rectangular shape, and the number of towns corresponding to the second target object in the second scene parameter is sampled in the second area through Poisson distribution. In a specific embodiment provided by the present disclosure, the location of the town area in the second area that meets the preset conditions is determined, and the preset conditions include: the two town areas cannot overlap; the town area cannot exceed the range of the second area. For example, a town area with a size of 20×20 second sub-areas is randomly determined in the second area, and it is necessary to ensure that the town area cannot exceed the second area and cannot overlap with the town area that has been determined. If there is no town area with a size of 20×20 second sub-areas in the second area that can accommodate, and the number of towns corresponding to the second target object required in the second scene parameter is not reached, the area of ​​the town area can be reduced, such as determining a town area with a size of 10×15 second sub-areas, which also needs to meet the preset conditions until the number of towns corresponding to the second target object required in the second scene parameter is met, or there is no position in the second area that can meet the minimum town area.

[0252] M2: Determine a second seed region among multiple second sub-regions of the second region, and based on the position information of the second seed region in the second region, perform growth and expansion processing on the second seed region to obtain the position information of the second sub-region corresponding to the second target object in the second region.

[0253] Exemplarily, information on the number of second target objects can be obtained in the second scene parameters, and second seed regions corresponding to the number of second target objects can be randomly generated in the second region using Poisson distribution. A regional growing algorithm is used to start growing and expanding from the second seed region, and each time the growth and expansion randomly selects a second sub-region determined to belong to the second target object from the second sub-region adjacent to the second seed region. Based on information on the area of ​​the second target object included in the second scene parameters, when the areas of multiple second sub-regions belonging to the second target object reach the area of ​​the second target object included in the second scene parameters, the growth and expansion is stopped to obtain the position information of the second sub-region corresponding to the second target object in the second region.

[0254] The second target object comprises, for example, a town, in which there are buildings.

[0255] In a specific embodiment provided in the present disclosure, a second scene parameter for generating a building is obtained; the second scene parameter includes at least one of the following: shape information corresponding to the building, quantity information corresponding to the building, and density information corresponding to the building; based on the second scene parameter and the position information, from a second sub-area corresponding to the second target object, first position information of a first target sub-area belonging to the building in the second area and a position of the entrance of the building are determined; based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building, the building is constructed.

[0256] Exemplarily, the number of floors and types of buildings can be determined according to the size of the town area. For example, in a large town with a size of 30×40 second sub-areas, the number of floors of the corresponding generated buildings can be more than 6 floors, and the town can include supermarkets, stadiums, residential areas and other types of buildings. If in a small town with a size of 20×15 second sub-areas, the number of floors of the corresponding generated buildings can be less than 6 floors, and the town can have residential areas, supermarkets, bungalows and other types of buildings; if in a mini town with a size of 5×5 second sub-areas, the corresponding generated buildings are generally around 1 floor, and can be single gas stations, cabins, sentry boxes and other types of buildings.

[0257] In addition, the entrance location information of the buildings must be determined, and the entrance location of each building cannot be blocked by other buildings.

[0258] The constructed building includes: a building model and a room model of each of a plurality of rooms divided in the building; the room model includes a plurality of furniture models.

[0259] Based on the first position information, shape information of the building is determined; the shape information includes: multiple top-view contour lines of the building, and size information corresponding to each top-view contour line; the space surrounded by the multiple top-view contour lines includes the indoor space of the building.

[0260] Constructing the internal structure of a building includes at least the following steps S21 to S23:

[0261] S21: Based on the first position information, determine the shape information of the building; the shape information includes: multiple top-view contour lines of the building, and size information corresponding to each top-view contour line; the space enclosed by the multiple top-view contour lines includes the indoor space of the building.

[0262] Exemplarily, taking an L-shaped building as an example, based on the location of the entrance, a first sub-contour line belonging to the entrance is determined in the overhead contour line, and based on the size information of each overhead contour line, a second sub-contour line belonging to the window is determined.

[0263] Based on the position of the first sub-contour line and the position of the second sub-contour line, the space surrounded by the plurality of top-view contour lines is divided into a plurality of sub-spaces.

[0264] Specifically, based on the entrance position of the building, dividing the space surrounded by the plurality of top-view contour lines into a plurality of subspaces at least includes the following steps S211 to S212:

[0265] S211: Based on the location of the entrance, determine a first sub-contour line belonging to the entrance in the top-view contour line, and based on the size information of each top-view contour line, determine a second sub-contour line belonging to the window.

[0266] S212: Based on the position of the first sub-contour line and the position of the second sub-contour line, divide the space surrounded by the plurality of top-view contour lines into a plurality of sub-spaces.

[0267] For example, see Figure 6 A specific example diagram showing how to divide a space surrounded by a plurality of top-view contour lines into a plurality of subspaces is shown, wherein the maximum side length of a subspace is determined, and the first subcontour line L1 is used to vertically divide the room according to the positions of the window f1 and the door f2, so that the window is located in the middle of the two first subcontour lines, and the second subcontour line L2 is used to vertically divide the first subcontour line in half, and the room is divided horizontally, and the division is stopped until the length of each side of the subspace divided by the first subcontour line and the second subcontour line is less than the maximum side length.

[0268] The areas of the multiple subspaces obtained by division can be the same or different.

[0269] S22: Based on the location of the entrance of the building, the space surrounded by the plurality of overhead contour lines is divided into a plurality of rooms, and for each room, a furniture placement method corresponding to the room is generated according to the room type of the room corresponding to the room.

[0270] The step of dividing the space surrounded by the plurality of top-view contour lines into a plurality of rooms includes at least the following steps S221 to S225:

[0271] S221: Determine multiple seed spaces from the multiple subspaces, and use the heat map score to calculate the room type corresponding to the room to which each seed space belongs.

[0272] S222: Perform room expansion processing on the multiple seed spaces respectively to determine the first subspaces corresponding to the multiple rooms respectively; the space size formed by the first subspace belonging to any room is greater than the minimum size threshold corresponding to the any room.

[0273] S223: Based on the location of the entrance and the locations of the first subspaces corresponding to the rooms in the space, determine the second subspace where the corridor connecting the entrance and the multiple rooms is located.

[0274] S224: Based on the positions of other subspaces except the first subspace and the second subspace among the multiple subspaces and the positions of the first subspaces corresponding to the rooms, determine the third subspaces corresponding to the rooms from the other subspaces.

[0275] S225: Constructing corresponding rooms based on the first subspace and the third subspace corresponding to each room and the corresponding room type.

[0276] For example, see Figure 7a The figure shows a specific example of determining a seed space in multiple subspaces. K subspaces are sampled as seed spaces corresponding to K room types. The seed spaces are scored using a heat map to obtain the probability that the seed spaces belong to different room types. For example, rooms with windows in subspaces k1 to k4 are more suitable to be kitchens, living rooms, or bedrooms; rooms close to doors are more suitable for socializing and more suitable to be living rooms or dining rooms; rooms far from doors are more suitable to be bedrooms, etc. Using the above scoring method, Figure 7a The room types are divided by using the subspaces in , and the results are: subspace k1 is used as the seed space of the living room, subspace k2 is used as the seed space of the kitchen, subspace k3 is used as the seed space of the master bedroom, subspace k4 is used as the seed space of the second bedroom, and subspace k5 is used as the seed space of the bathroom. Figure 7a It also includes windows f1, doors f2, and attribute identifiers s1 of each room type. The attribute identifiers distinguish the room types of each seed space by color.

[0277] See also Figure 7bThe figure shows a specific example of a room obtained by expanding the seed space. After the seed spaces corresponding to all the different types of rooms are determined, the subspaces around the seed space that have not been set with room attributes are expanded. The first step is to expand each subspace to the minimum size required by its room type. Each iteration will select a direction for expansion based on probability until the required minimum size is reached or there is no direction for expansion. If there are rooms that do not meet the minimum size requirements in the previous step, an attempt will be made to shrink the rooms around it and expand them in other directions. Until all rooms meet their minimum size. Generate a corridor connecting the door and each room. When the corridor is generated, the subspace that does not belong to any room will be merged into the nearest room. Using the above expansion method, Figure 7b The k1~k5 seed spaces in the image are expanded, and the results are: living room k1, kitchen k2, master bedroom k3, second bedroom k4, bathroom k5.

[0278] After the room is generated, different types of furniture that match the room type are placed in different rooms. For example, the kitchen is placed with ovens, microwave ovens, stoves and other furniture, the living room is placed with sofas, coffee tables and other furniture, and the bedroom is placed with beds, wardrobes and other furniture.

[0279] S23: Generate a building model based on the shape information corresponding to the building and the positions of each room in the space; and generate a room model for each room in the building according to the furniture placement method corresponding to the room.

[0280] In this way, the internal structure of the building can be generated in the above manner.

[0281] In another embodiment of the present disclosure, the town further includes: a first road connecting the buildings;

[0282] Among them, constructing the first road includes: determining the connectivity relationship between the entrances of the buildings based on the locations of the entrances of the buildings; determining the second location information of the second target sub-area belonging to the first road in the second area by using the connectivity relationship and the first location information of the first target sub-area belonging to the buildings in the second area; and constructing the first road based on the second location information of the second target sub-area in the second area.

[0283] Here, according to the location of the entrance of the building, each intersection of the building is connected by at least one line segment.

[0284] Exemplarily, the minimum spanning tree algorithm can be used to connect the entrances of the buildings. If there are n entrances to a building, at least n-1 paths are required to connect them, where the length of the path between two building entrances corresponds to the weight of the path, and the longer the length, the greater the weight. Referring to one of the specific example diagrams for generating a first road shown in FIG8 , at least the paths connected between building g1 and building g2 exist: a combination of path l1, path l2 and path l3, where the distance of path l1 is less than the distance of path l2 plus path l3, and therefore, the weight of path l1 is smaller than the weight of path l2 plus path l3. After generating the path, a breadth-first algorithm can be used to ensure that the generated path avoids the building while minimizing the total weight of the path connecting all building entrances. Based on the generated path, a first road connecting all building entrances in the town is constructed. See. Figure 8b As shown in Figure 2, a specific example of generating a first road, buildings g1, g2, and g3 can be connected to each other using paths l1 and l2.

[0285] In addition, there are multiple towns, and the second target object also includes: a second road connecting different towns;

[0286] Among them, constructing the second road includes: based on the second position information of the second target sub-area corresponding to the first road in the second area, performing a breadth-first search of the second sub-area until the third target area belonging to the second road determined during the search process can connect all towns, and based on the third position information of the third target area in the second area determined during the search process, constructing the second road.

[0287] For example, see Fig. 9 In the specific example diagram of generating the second road, different road signs are set for road nodes in different towns, such as town A, town B, town C, etc., and a breadth-first algorithm is used to start from a road node in town A, such as A11, and search outward. When a road sign that does not belong to town A is found, such as B23 or C15, the search returns to the starting road node A11 to form a second road connecting the two towns.

[0288] In addition, when constructing the first virtual scene and the second virtual scene, for example, a decoration model may be selected from the material library to fill the first virtual scene and the second virtual scene to obtain a target virtual scene;

[0289] For example, according to the probability of each model appearing on the map, trees, rocks, flowers, plants, and other decorations are generated on both sides of the road, around buildings, or on both sides of the river.

[0290] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0291] Based on the same inventive concept, a virtual scene generation device corresponding to the virtual scene generation method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned virtual scene generation method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0292] Reference Fig.10 As shown, a virtual scene generation device provided by an embodiment of the present disclosure includes:

[0293] The acquisition module 101 is used to acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: the terrain undulation degree, the maximum height, and the number of hills of the target map;

[0294] A height determination module 102 is used to determine noise data for a plurality of sub-areas belonging to land in the target map based on the first scene parameter; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land;

[0295] A first region determining module 103, based on the noise data and a preset noise threshold, determines a first sub-region belonging to the hilly terrain from the plurality of sub-regions belonging to the land;

[0296] The first scene construction module 104 is used to determine corresponding first height information for each of the plurality of the first sub-areas, and construct a first virtual scene corresponding to the hilly terrain using the first height information.

[0297] In an optional implementation manner, when the first region determining module 103 determines the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land based on the noise data and the preset noise threshold, it is configured to:

[0298] For each sub-region among the multiple sub-regions belonging to the land, comparing the noise value corresponding to the sub-region with the noise threshold;

[0299] In response to the noise data being greater than the noise threshold, the sub-region is determined as the first sub-region.

[0300] In an optional implementation manner, when the first scene construction module 104 determines the corresponding first height information for each of the plurality of first sub-areas, the first scene construction module 104 is configured to:

[0301] Determine a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determine second height information for first grid vertices in the grids located in the first region; each of the grids includes at least one of the first sub-regions;

[0302] Based on the second height information of the first mesh vertices, first height information respectively corresponding to the plurality of first sub-regions is determined.

[0303] In an optional implementation manner, when the first scene construction module 104 determines a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determines height information for a first grid vertex in the grid located in the first region, the first scene construction module 104 is further configured to:

[0304] Determine a circumscribed rectangle of the first area based on positions of the plurality of first sub-areas in the first area in the target map;

[0305] The circumscribed rectangle is divided into a plurality of grids, and first grid vertices in the plurality of grids that are located in the first region are randomly sampled in height to obtain second height information corresponding to each of the first grid vertices.

[0306] In an optional implementation manner, when determining the first height information respectively corresponding to the plurality of first sub-regions based on the second height information of the first mesh vertices, the first scene construction module 104 is further configured to:

[0307] For each mesh, based on the second height information corresponding to the first mesh vertices of the mesh, height interpolation processing is performed on each first sub-region in the mesh to obtain first height information corresponding to each first sub-region of the mesh.

[0308] In an optional implementation manner, after the first region determining module 103 determines the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land, the device further includes a first model building module 106, which is used to:

[0309] Based on the first height information respectively corresponding to the first sub-areas, determining a target first sub-area corresponding to a first target object in the first area;

[0310] The first target object is constructed in the first area based on the position information of the target first sub-area in the first area.

[0311] In an optional implementation manner, when determining the target first sub-region corresponding to the first target object in the first region based on the first height information respectively corresponding to the first sub-regions, the first model building module 106 is configured to:

[0312] Based on the first height information respectively corresponding to the first sub-regions, determining a first seed region belonging to the first target object from the first sub-regions;

[0313] Perform multiple iterations of the following:

[0314] Determine a current target first sub-region of a current iteration cycle; the current target first sub-region includes: the first seed region, or a new target first sub-region determined in a previous iteration cycle;

[0315] Based on the position of the current target first sub-region in the first region, determining, from the first region, a candidate sub-region adjacent to the current target first sub-region;

[0316] In response to the first height information of any candidate subregion being smaller than the first height information of the current target first subregion, and the first height information of any candidate subregion being the minimum value among the first height information respectively corresponding to all first candidate subregions, determining the any candidate subregion as a new target first subregion;

[0317] In response to the first height information of all candidate sub-regions being greater than the first height information of the current target first sub-region, ending the iteration;

[0318] The first seed region and new first target sub-regions determined respectively in a plurality of iteration cycles are both used as target first sub-regions corresponding to the first target object.

[0319] In an optional implementation manner, the device further includes a second scene construction module 109, which is used to:

[0320] Based on the noise data and a preset noise threshold, a second sub-region belonging to a plain terrain is determined from the multiple sub-regions belonging to the land:

[0321] The position information of the second target object in the second area formed by the plurality of second sub-areas is determined, and based on the position information, the second target object is constructed in the second sub-area to generate a second virtual scene corresponding to the plain terrain.

[0322] In an optional implementation manner, when determining the position information of the second target object in the second area formed by the plurality of second sub-areas, the second scene construction module 109 is configured to:

[0323] Acquire a second scene parameter for generating a town area; wherein the second scene parameter includes at least one of the following: an area of ​​the second target object, and a number of the second target objects;

[0324] Based on the second scene parameter, Poisson distribution sampling is performed on the second area to obtain position information of a second sub-area corresponding to the second target object in the second area.

[0325] In an optional implementation manner, when determining the position information of the second sub-region corresponding to the second target object in the second region, the second scene construction module is further configured to:

[0326] Among the multiple second sub-regions of the second region, a second seed region is determined, and based on the position information of the second seed region in the second region, the second seed region is grown and expanded to obtain the position information of the second sub-region corresponding to the second target object in the second region.

[0327] In an optional implementation manner, when the second scene construction module 109 constructs the second target object in the second area based on the location information, the device further includes a second model construction module 108, which is used to:

[0328] Acquire a second scene parameter for generating a building; the second scene parameter includes at least one of the following: shape information corresponding to the building, quantity information corresponding to the building, and density information corresponding to the building;

[0329] Based on the second scene parameter and the position information, determining, from the second sub-region corresponding to the second target object, first position information of a first target sub-region belonging to the building in the second region and a position of an entrance of the building;

[0330] The building is constructed based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building.

[0331] In an optional implementation manner, when the second scene construction module 109 constructs the second target object in the second area based on the location information, the second model construction module 108 is configured to:

[0332] Determine the interconnection relationship between the entrances of the buildings based on the locations of the entrances of the buildings; determine the second location information of the second target sub-area belonging to the first road in the second area by using the interconnection relationship and the first location information of the first target sub-area belonging to the buildings in the second area;

[0333] The first road is constructed based on second position information of the second target sub-area in the second area.

[0334] In an optional implementation manner, when the second scene construction module 109 constructs the second target object in the second area based on the location information, the second model construction module 108 is further configured to:

[0335] Based on the second position information of the second target sub-area corresponding to the first road in the second area, a breadth-first search of the second sub-area is performed until the third target area belonging to the second road determined during the search process can connect all towns, and based on the third position information of the third target area in the second area determined during the search process, the second road is constructed.

[0336] In an optional implementation manner, when constructing the building based on the first location information, the location of the entrance of the building, and the shape information corresponding to the building, the second model construction module 108 is further configured to:

[0337] Based on the first position information, shape information of the building is determined; the shape information includes: a plurality of top view contour lines of the building, and size information corresponding to each top view contour line; a space surrounded by the plurality of top view contour lines includes an indoor space of the building;

[0338] Based on the location of the entrance of the building, the space surrounded by the plurality of overhead contour lines is divided into a plurality of rooms, and for each room, according to the room type of the corresponding room of the room, a furniture placement method corresponding to the room is generated;

[0339] A building model is generated based on the shape information corresponding to the building and the positions of each room in the space; and a room model is generated for each room in the building according to the furniture placement method corresponding to the room.

[0340] In an optional implementation, when the second model building module 108 divides the space surrounded by the plurality of top-view contour lines into a plurality of rooms based on the locations of the entrances of the building, it is further configured to:

[0341] Based on the location of the entrance, determine a first sub-contour line belonging to the entrance in the top-view contour line, and based on the size information of each top-view contour line, determine a second sub-contour line belonging to the window;

[0342] Based on the position of the first sub-contour line and the position of the second sub-contour line, dividing the space surrounded by the plurality of top-view contour lines into a plurality of sub-spaces;

[0343] From the multiple subspaces, multiple seed spaces are determined, and the room types corresponding to the rooms to which each seed space belongs are calculated using the heat map score;

[0344] Perform room expansion processing on multiple seed spaces respectively to determine first subspaces corresponding to the multiple rooms respectively; the space size formed by the first subspace belonging to any room is greater than the minimum size threshold corresponding to any room;

[0345] Based on the location of the entrance and the locations of the first subspaces corresponding to the rooms in the space, determining a second subspace where a corridor connecting the entrance and the multiple rooms is located;

[0346] Based on the positions of the other subspaces except the first subspace and the second subspace among the multiple subspaces and the positions of the first subspaces corresponding to the rooms, determining the third subspaces corresponding to the rooms respectively from the other subspaces;

[0347] Based on the first subspace and the third subspace corresponding to each room and the corresponding room type, a corresponding room is constructed.

[0348] In an optional implementation, the device further includes a map construction module 105, which is used to:

[0349] Acquire a third scene parameter for generating an initial map and a fourth scene parameter for generating a land area; the third scene parameter includes at least one of the following: size information of the initial map and a preset scale; the fourth scene parameter includes at least one of the following: the number of land and the area of ​​land;

[0350] Based on the third scene parameter, create an initial map;

[0351] Based on the fourth scenario parameter, a target area belonging to land is determined in the initial map to obtain the target map.

[0352] In an optional implementation manner, when the map construction module 105 determines the target area belonging to land in the initial map based on the fourth scene parameter, the device further includes: a second area determination module 107, which is used to:

[0353] Based on the fourth scene parameter, determining a third seed area from a plurality of sub-areas included in the initial map;

[0354] Based on the position information of the third seed region in the initial map, the third seed region is subjected to growth and expansion processing to obtain a plurality of sub-regions belonging to the land; the plurality of sub-regions belonging to the land constitute the target region.

[0355] In an optional implementation manner, when the second region determination module performs growth and expansion processing on the third seed region based on the position information of the third seed region in the initial map to obtain multiple sub-regions belonging to the land, it is specifically used to:

[0356] In each of the multiple iterations, execute:

[0357] Determine a candidate seed region for the current iteration period based on the position information of the sub-region that has been determined to belong to the land in the current iteration period in the initial map; wherein the candidate seed region is adjacent to any sub-region that belongs to the land; wherein the sub-region includes the third seed region;

[0358] Randomly determine a preset number of selected seed areas from the candidate seed areas, and determine the selected seed areas as sub-areas belonging to land;

[0359] In response to the preset iteration stop condition not being met, entering the next iteration cycle.

[0360] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0361] The present disclosure also provides a computer device, such as Fig.11 FIG. 1 is a schematic diagram of a computer device structure provided in an embodiment of the present disclosure, including:

[0362] A processor 111 and a memory 112; the memory 112 stores machine-readable instructions executable by the processor 111, and the processor 111 is used to execute the machine-readable instructions stored in the memory 112. When the machine-readable instructions are executed by the processor 111, the processor 111 performs the following steps:

[0363] Acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: a terrain undulation degree, a maximum height, and a number of hills of the target map;

[0364] Based on the first scene parameter, determining noise data for a plurality of sub-areas belonging to land in the target map; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land;

[0365] Based on the noise data and a preset noise threshold, determining a first sub-region belonging to a hilly terrain from among the multiple sub-regions belonging to the land;

[0366] Corresponding first height information is determined for each of the plurality of first sub-areas, and a first virtual scene corresponding to the hilly terrain is constructed using the first height information.

[0367] The above-mentioned memory 112 includes internal memory 1121 and external memory 1122; the memory 1121 here is also called internal memory, which is used to temporarily store the calculation data in the processor 111, as well as the data exchanged with the external memory 1122 such as the hard disk. The processor 111 exchanges data with the external memory 1122 through the internal memory 1121.

[0368] The specific execution process of the above instructions can refer to the steps of the virtual scene generation method described in the embodiment of the present disclosure, which will not be repeated here.

[0369] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the virtual scene generation method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0370] The present disclosure also provides a computer program product that carries a program code. The program code includes instructions that can be used to execute the steps of the virtual scene generation method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0371] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0372] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0373] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0374] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0375] 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 that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0376] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A virtual scene generation method, characterized in that: include: Obtain a target map and obtain first scene parameters for generating a hilly terrain; The target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: the terrain undulation degree, the maximum height, and the number of hills of the target map; Based on the first scene parameter, determining noise data for a plurality of sub-areas belonging to land in the target map; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land; Based on the noise data and a preset noise threshold, determining a first sub-region belonging to a hilly terrain from among the multiple sub-regions belonging to the land; Determine corresponding first height information for each of the plurality of first sub-areas, and construct a first virtual scene corresponding to the hilly terrain by using the first height information, The noise data includes: noise values ​​corresponding to multiple sub-areas respectively, and The step of determining the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land based on the noise data and the preset noise threshold comprises: for each sub-region among the multiple sub-regions belonging to the land, comparing the noise value corresponding to the sub-region with the noise threshold; After determining the first sub-region belonging to the hilly terrain, the method further includes: An iterative process is performed until an iteration stop condition is met, wherein the iterative process includes: Determine a target first sub-region corresponding to the first target object from among the multiple first sub-regions; select a first sub-region whose height value is lower than that of the target first sub-region from among the first sub-regions adjacent to the target first sub-region, and change it to a new target first sub-region; Based on the position information of the target first sub-region in the first region, the first target object is constructed in the first region.

2. The generation method according to claim 1, characterized in that: The determining, based on the noise data and a preset noise threshold, a first sub-region belonging to the hilly terrain from the plurality of sub-regions belonging to the land, further comprises: In response to the noise data being greater than the noise threshold, the sub-region is determined as the first sub-region.

3. The generation method according to claim 1, characterized in that: A plurality of the first sub-regions constitute the first region; The determining corresponding first height information for each of the plurality of first sub-areas includes: Determine a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determine second height information for first grid vertices in the grids located in the first region; each of the grids includes at least one of the first sub-regions; Based on the second height information of the first mesh vertices, first height information respectively corresponding to the plurality of first sub-regions is determined.

4. The generation method according to claim 3, characterized in that: The step of determining a plurality of grids based on the positions of the plurality of first sub-regions in the first region in the target map, and determining height information for first grid vertices in the grids located in the first region, comprises: Determine a circumscribed rectangle of the first area based on positions of the plurality of first sub-areas in the first area in the target map; The circumscribed rectangle is divided into a plurality of grids, and first grid vertices in the plurality of grids that are located in the first region are randomly sampled in height to obtain second height information corresponding to each of the first grid vertices.

5. The generation method according to claim 4, characterized in that: The determining, based on the second height information of the first mesh vertices, first height information respectively corresponding to the plurality of first sub-regions includes: For each mesh, based on the second height information respectively corresponding to the first mesh vertices belonging to the mesh, height interpolation processing is performed on each first sub-region belonging to the mesh to obtain first height information respectively corresponding to each first sub-region belonging to the mesh.

6. The generation method according to claim 1, characterized in that: The iterative process includes: Based on the first height information respectively corresponding to the first sub-regions, determining a first seed region belonging to the first target object from the first sub-regions; Perform multiple iterations of the following: Determine a current target first sub-region of a current iteration cycle; the current target first sub-region includes: the first seed region, or a new target first sub-region determined in a previous iteration cycle; Based on the position of the current target first sub-region in the first region, determining, from the first region, a candidate sub-region adjacent to the current target first sub-region; In response to the first height information of any candidate subregion being smaller than the first height information of the current target first subregion, and the first height information of any candidate subregion being the minimum value among the first height information respectively corresponding to all first candidate subregions, determining the any candidate subregion as a new target first subregion; In response to the first height information of all candidate sub-regions being greater than the first height information of the current target first sub-region, ending the iteration; The first seed region and new first target sub-regions determined respectively in a plurality of iteration cycles are both used as target first sub-regions corresponding to the first target object.

7. The generation method according to any one of claims 1 to 6, characterized in that: The method further comprises: Based on the noise data and a preset noise threshold, a second sub-region belonging to the plain terrain is determined from the multiple sub-regions belonging to the land: The position information of the second target object in the second area formed by the plurality of second sub-areas is determined, and based on the position information, the second target object is constructed in the second sub-area to generate a second virtual scene corresponding to the plain terrain.

8. The generation method according to claim 7, characterized in that: The determining the position information of the second target object in the second area formed by the plurality of second sub-areas includes: Acquire a second scene parameter for generating a town area; wherein the second scene parameter includes at least one of the following: an area of ​​the second target object, and a number of the second target objects; Based on the second scene parameter, Poisson distribution sampling is performed on the second area to obtain position information of a second sub-area corresponding to the second target object in the second area.

9. The generation method according to claim 7, characterized in that: The determining the position information of the second sub-region corresponding to the second target object in the second region includes: Among the multiple second sub-regions of the second region, a second seed region is determined, and based on the position information of the second seed region in the second region, the second seed region is grown and expanded to obtain the position information of the second sub-region corresponding to the second target object in the second region.

10. The generation method according to claim 7, characterized in that: The second target object includes a town; there are buildings in the town; The constructing the second target object in the second area based on the location information includes: Acquire a second scene parameter for generating a building; the second scene parameter includes at least one of the following: shape information corresponding to the building, quantity information corresponding to the building, and density information corresponding to the building; Based on the second scene parameter and the position information, determining, from the second sub-region corresponding to the second target object, first position information of a first target sub-region belonging to the building in the second region and a position of an entrance of the building; The building is constructed based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building.

11. The generation method according to claim 10, characterized in that: The town also includes: a first road connecting the buildings; The constructing the second target object in the second area based on the location information further includes: Determine the interconnection relationship between the entrances of the buildings based on the locations of the entrances of the buildings; determine the second location information of the second target sub-area belonging to the first road in the second area by using the interconnection relationship and the first location information of the first target sub-area belonging to the buildings in the second area; The first road is constructed based on second position information of the second target sub-area in the second area.

12. The generation method according to claim 11, characterized in that: There are multiple towns; the second target object also includes: a second road connecting different towns; The constructing the second target object in the second area based on the location information further includes: Based on the second position information of the second target sub-area corresponding to the first road in the second area, a breadth-first search of the second sub-area is performed until the third target area belonging to the second road determined during the search process can connect all towns, and based on the third position information of the third target area in the second area determined during the search process, the second road is constructed.

13. The generation method according to any one of claims 10 to 12, characterized in that: The constructed building includes: a building model and a room model of each of a plurality of rooms divided in the building; the room model includes a plurality of furniture models; The step of constructing the building based on the first position information, the position of the entrance of the building, and the shape information corresponding to the building includes: Based on the first position information, shape information of the building is determined; the shape information includes: a plurality of top view contour lines of the building, and size information corresponding to each of the top view contour lines; a space surrounded by the plurality of top view contour lines includes an indoor space of the building; Based on the location of the entrance of the building, the space surrounded by the plurality of overhead contour lines is divided into a plurality of rooms, and for each room, according to the room type of the corresponding room of the room, a furniture placement method corresponding to the room is generated; A building model is generated based on the shape information corresponding to the building and the positions of each room in the space; and a room model is generated for each room in the building according to the furniture placement method corresponding to the room.

14. The generation method according to claim 13, characterized in that: Based on the location of the entrance of the building, the space surrounded by the plurality of top-view contour lines is divided into a plurality of rooms, including: Based on the location of the entrance, determine a first sub-contour line belonging to the entrance in the top-view contour line, and based on the size information of each top-view contour line, determine a second sub-contour line belonging to the window; Dividing the space surrounded by the plurality of top-view contour lines into a plurality of subspaces based on the position of the first subcontour line and the position of the second subcontour line; From the multiple subspaces, multiple seed spaces are determined, and the room types corresponding to the rooms to which each seed space belongs are calculated using the heat map score; Perform room expansion processing on multiple seed spaces respectively to determine first subspaces corresponding to the multiple rooms respectively; the space size formed by the first subspace belonging to any room is greater than the minimum size threshold corresponding to any room; Based on the location of the entrance and the locations of the first subspaces corresponding to the rooms in the space, determining a second subspace where a corridor connecting the entrance and the multiple rooms is located; Based on the positions of the other subspaces except the first subspace and the second subspace among the multiple subspaces and the positions of the first subspaces corresponding to the rooms, determining the third subspaces corresponding to the rooms respectively from the other subspaces; Based on the first subspace and the third subspace corresponding to each room and the corresponding room type, a corresponding room is constructed.

15. The generation method according to claim 1, characterized in that: The obtaining of the target map comprises: Acquire a third scene parameter for generating an initial map and a fourth scene parameter for generating a land area; the third scene parameter includes at least one of the following: size information of the initial map and a preset scale; the fourth scene parameter includes at least one of the following: the number of land and the area of ​​land; Based on the third scene parameter, create an initial map; Based on the fourth scenario parameter, a target area belonging to land is determined in the initial map to obtain the target map.

16. The generation method according to claim 15, characterized in that: The determining, based on the fourth scenario parameter, a target area belonging to land in the initial map includes: Based on the fourth scene parameter, determining a third seed area from a plurality of sub-areas included in the initial map; Based on the position information of the third seed region in the initial map, the third seed region is subjected to growth and expansion processing to obtain a plurality of sub-regions belonging to the land; the plurality of sub-regions belonging to the land constitute the target region.

17. The generation method according to claim 16, characterized in that: The step of performing growth and expansion processing on the third seed region based on the position information of the third seed region in the initial map to obtain a plurality of sub-regions belonging to the land includes: In each of the multiple iterations, execute: Determine a candidate seed region for the current iteration period based on the position information of the sub-region that has been determined to belong to the land in the current iteration period in the initial map; wherein the candidate seed region is adjacent to any sub-region that belongs to the land; wherein the sub-region includes the third seed region; Randomly determine a preset number of selected seed areas from the candidate seed areas, and determine the selected seed areas as sub-areas belonging to land; In response to the preset iteration stop condition not being met, entering the next iteration cycle.

18. The generation method according to claim 17, characterized in that: The preset iteration stop condition includes at least one of the following: The number of iteration cycles reaches a preset iteration cycle number threshold; Failed to determine the candidate seed region for the current iteration cycle.

19. A virtual scene generation device, characterized in that: The device comprises: An acquisition module, used to acquire a target map and acquire a first scene parameter for generating a hilly terrain; the target map includes a plurality of sub-areas belonging to land; the first scene parameter includes at least one of the following: a terrain undulation degree, a maximum height, and a number of hills of the target map; A height determination module, configured to determine noise data for a plurality of sub-areas belonging to land in the target map based on the first scene parameter; the noise data is used to characterize height information corresponding to the plurality of sub-areas belonging to land; A first region determining module, which determines, based on the noise data and a preset noise threshold, a first sub-region belonging to the hilly terrain from among the plurality of sub-regions belonging to the land; a first scene construction module, configured to determine first height information corresponding to each of the plurality of first sub-areas, and construct a first virtual scene corresponding to the hilly terrain by using the first height information; The noise data includes: noise values ​​corresponding to multiple sub-areas respectively, and The step of determining the first sub-region belonging to the hilly terrain from the multiple sub-regions belonging to the land based on the noise data and the preset noise threshold comprises: for each sub-region among the multiple sub-regions belonging to the land, comparing the noise value corresponding to the sub-region with the noise threshold; The device further comprises a first model building module, wherein the first model building module is used for: An iterative process is performed until an iteration stop condition is met, wherein the iterative process includes: Determining a target first sub-region corresponding to a first target object among the multiple first sub-regions; Select a first subregion whose height value is lower than that of the target first subregion from the first subregions adjacent to the target first subregion, and change it to a new target first subregion; Based on the position information of the target first sub-region in the first region, the first target object is constructed in the first region.

20. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the virtual scene generation method according to any one of claims 1 to 18.

21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the virtual scene generation method according to any one of claims 1 to 18.

Citation Information

Patent Citations

  • Landform generation method and device, computer equipment and storage medium

    CN111784789A

  • Virtual ground surface processing method and device and electronic device

    CN112530012A