Terrain scattering method and device, computer equipment and readable storage medium

By using mask drawing and model generation controls in the Unity engine, the object model is generated directly on the scene terrain, which solves the problem that the Unity engine's own system cannot generate uniform object model, simplifies the process and improves the generation efficiency and quality, avoids the Dependency of third-party plug-ins.

CN119295619APending Publication Date: 2025-01-10BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311701801.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The terrain system that comes with the Unity engine cannot directly generate the scope of the object model, resulting in uneven distribution of the object model, and the use of third-party plug-ins requires additional purchase and installation, which increases cost and complexity, and may have compatibility issues and bugs.

Method used

Provide a method of spreading terrain points, drawing controls and model generation controls through pre-created masks, drawing masks and generating object models in the Unity engine, realizing random distribution on scene terrain, avoiding dependence on third-party plug-ins. Simplifies the process and improves stability.

Benefits of technology

The generation of object models is realized evenly distributed in the Unity engine, reducing costs and complexity, avoiding compatibility conflicts with the Unity engine, and improving the efficiency and quality of generating object models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295619A_ABST
    Figure CN119295619A_ABST
Patent Text Reader

Abstract

The invention provides a terrain spot scattering method and device, computer equipment and a readable storage medium, and relates to the field of game making. The method comprises the steps of obtaining a mask drawing instruction based on a pre-created mask drawing control, and drawing a mask in a scene terrain according to the mask drawing instruction; and based on a pre-created model generation control, generating an object model on the drawn mask to realize scene terrain point scattering. According to the method and the device, a terrain point scattering tool can be realized in the Unity engine, so that an art worker draws a mask on the scene terrain to select the range of the object model to be generated, and randomly distributed object models are automatically generated in the selected range, so that the purpose of drawing the mask on the terrain in the Unity engine to generate the object model is realized; according to the method, uniform distribution of the object models is ensured, implementation through a third-party plug-in is not needed, the method is simple, cost and complexity are reduced, motion conflicts with a Unity engine are avoided, and stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of game production, and in particular to a terrain scattering method, device, computer equipment and readable storage medium. Background Art

[0002] The existing terrain scattering methods include: (1) using the terrain system built into the Unity engine to draw different texture layers and grass layers on the terrain, and then setting the object model to be generated on the grass layer, thereby achieving random generation of the object model. (2) using third-party plug-ins, such as Gaia, MapMagic, etc. These plug-ins can generate different types of ecosystems on the terrain, including different object models.

[0003] However, the terrain system built into the Unity engine cannot directly generate the range of object models on the terrain, but can only generate them on the entire grass layer, which will cause uneven distribution of object models and unnatural display. Using third-party plug-ins requires additional purchase and installation, which increases costs and complexity, and requires compatibility and stability testing with the Unity engine, which may have bugs and conflicts. Artists need to learn how to use the plug-ins and how to operate the interface, which increases learning costs and time. Summary of the invention

[0004] In view of this, the present application provides a terrain scattering method, apparatus, computer device and readable storage medium, which realize drawing a mask on the terrain in the Unity engine to generate an object model.

[0005] In a first aspect, an embodiment of the present application provides a terrain scattering method, comprising:

[0006] Based on the pre-created mask drawing control, a mask drawing instruction is obtained, and a mask is drawn in the scene terrain according to the mask drawing instruction;

[0007] Based on the pre-created model generation control, an object model is generated on the drawn mask to achieve scene terrain scattering.

[0008] In a second aspect, an embodiment of the present application provides a terrain scattering device, comprising:

[0009] A mask drawing module, used for obtaining a mask drawing instruction based on a pre-created mask drawing control, and drawing a mask in the scene terrain according to the mask drawing instruction;

[0010] The model generation module is used to generate an object model on the drawn mask based on a pre-created model generation control to achieve scene terrain scattering.

[0011] In a third aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.

[0012] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.

[0013] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.

[0014] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.

[0015] In an embodiment of the present application, a terrain scattering tool can be implemented in the Unity engine, including a mask drawing control and a model generation control. The tool enables artists to draw a mask on the scene terrain to select the range of object models to be generated, and automatically generate randomly distributed object models within the selected range, thereby achieving the purpose of drawing a mask on the terrain in the Unity engine to generate object models, ensuring that the object models are evenly distributed, and there is no need to implement it through a third-party plug-in. The method is simple, reduces cost and complexity, avoids motion conflicts with the Unity engine, and improves stability.

[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 A schematic diagram showing a flow chart of a terrain scattering method according to an embodiment of the present application is shown;

[0019] Figure 2 A screenshot of the operation interface of the Mask Component control in an embodiment of the present application is shown;

[0020] Figure 3A screenshot showing the operation interface of the Terrain Scatter Tool control of an embodiment of the present application is shown;

[0021] Figure 4 A screenshot of the surface layer configuration interface of an embodiment of the present application is shown;

[0022] Figure 5 A screenshot showing creation of configuration data by the configuration interface of an embodiment of the present application is shown;

[0023] Figure 6 A screenshot showing the completed configuration of the terrain tile layer configuration found in the embodiment of the present application;

[0024] Figure 7 A screenshot showing the completed configuration of the found terrain vegetation layer configuration according to an embodiment of the present application;

[0025] Figure 8 A screenshot of a mask drawing bar of an embodiment of the present application is shown;

[0026] Fig. 9 Screen shots showing operations such as drawing and clearing of a mask control in an embodiment of the present application are shown;

[0027] Fig.10 A screenshot showing the Prefab picking up the asset pool in an embodiment of the present application;

[0028] Fig.11 A screenshot of a prefab asset pushed from the Prefab management plug-in according to an embodiment of the present application is shown;

[0029] Fig.12 A screenshot showing a mask of a slope layer node that can obtain a terrain slope range according to an embodiment of the present application;

[0030] Fig.13 A screenshot showing a Perlin noise random graph obtained by binarizing a noise node in cooperation with a post-processing node in an embodiment of the present application;

[0031] Fig.14 Screen shots showing commonly used zoom-in and zoom-out operations in post-processing of an embodiment of the present application are shown;

[0032] Fig.15 A screenshot showing an initial mask minus a circumvention mask in a child node according to an embodiment of the present application;

[0033] Fig.16 A screenshot showing the layer number of the surface layer mapping configuration interface of an embodiment of the present application;

[0034] Fig.17 A screenshot showing the surface layer point spreading operation of an embodiment of the present application is shown;

[0035] Fig.18 A screenshot showing the density scattering mode of an embodiment of the present application is shown;

[0036] Fig.19 A screenshot showing the quantity interval scattering mode of an embodiment of the present application is shown;

[0037] Fig. 20 Screen shot showing the tilt angle following the terrain normal direction in an embodiment of the present application;

[0038] Fig.21 A screenshot showing the level blending weights of an embodiment of the present application;

[0039] Fig. 22 A screenshot showing Prefab replacement of an embodiment of the present application;

[0040] Fig.23 A screenshot of the interface for generating an initial avoidance mask option in an embodiment of the present application is shown;

[0041] Fig.24 A screenshot of generating a current dot-spreading layer avoidance layer according to an embodiment of the present application is shown;

[0042] Fig.25 A screenshot showing multi-layer scatter point avoidance according to an embodiment of the present application is shown;

[0043] Fig.26 A screenshot showing the implementation of the surround scattering method according to an embodiment of the present application is shown;

[0044] Fig. 27 Screen shots showing exporting configuration and using configuration presets in an embodiment of the present application;

[0045] Fig.28 A structural block diagram of a terrain scattering device according to an embodiment of the present application is shown;

[0046] Fig.29 A structural block diagram of a computer device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0048] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0049] The professional and technical terms and their explanations involved in this application are as follows:

[0050] Unity Engine: is a cross-platform game development engine that can be used to create two-dimensional and three-dimensional games and interactive content.

[0051] Grass Layer: It is a function in the Unity engine that can generate grass or other object models on the terrain and set density and distribution parameters.

[0052] Prefab: It is a function in the Unity engine that can save one or more object models and related components and properties as a reusable resource file.

[0053] Houdini: is a 3D animation software that can be used to create complex physical simulations, procedural modeling, special effects, and more.

[0054] Mask: A binary data used to indicate whether an area is selected or blocked, usually represented by black and white, transparent or opaque.

[0055] AO (Ambient Occlusion) is a type of data used to indicate the degree to which the surface of an object is affected by the surrounding lighting, usually expressed in grayscale values ​​or color values.

[0056] Noise: It is an algorithm used to generate random or pseudo-random image data, usually generated by different types of noise such as PerlinNoise, SimplexNoise, WorleyNoise, etc.

[0057] Scattering: refers to the process of randomly generating object models on the terrain, similar to scattering seeds on the terrain, allowing the object models to grow like plants. The terrain scattering tool is a tool used to achieve this process.

[0058] The terrain scattering method, device, computer equipment and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0059] The present application embodiment provides a terrain scattering method, such as Figure 1 As shown, the method includes:

[0060] Step 101, based on the pre-created mask drawing control, obtain a mask drawing instruction, and draw a mask in the scene terrain according to the mask drawing instruction;

[0061] Step 102, based on the pre-created model generation control, an object model is generated on the drawn mask to achieve scene terrain scattering.

[0062] In this embodiment, a mask drawing control (i.e., a Mask Component control) and a model generation control (i.e., a Terrain Scatter Tool control) are created in advance. The Mask Component control is used to draw a mask on the terrain according to the mask drawing instruction. Tools such as a brush can be used to select the range of the object model to be generated. The mask can also be erased, displayed or hidden, the mask color can be changed, and the mask can be cleared with one click.

[0063] The Terrain Scatter Tool control is used to generate object models on the drawn mask. You can push the object models you want to generate from the PrefabManager Houdini plug-in to the Terrain Scatter Tool control, or you can remove unwanted object models from the Terrain Scatter Tool control.

[0064] In one embodiment of the present application, before performing terrain scattering, the method further includes:

[0065] Create a terrain scattering control, which includes a mask drawing control and a model generation control. The mask drawing control is used to control the drawing and editing of the mask, and the model generation control is used to control the generation of the object model.

[0066] In this embodiment, a terrain scattering tool (ie, a terrain scattering control) is created in the Unity engine. The tool includes a Mask Component control and a Terrain Scatter Tool control, which are respectively used to control mask drawing and editing and object model generation.

[0067] For example, first install the com.pwrd.perfect-houdini plugin in the project, and find the Terrain Spreader tool in the Game Object list in the Hierarchy area of ​​Unity. Click the Terrain Spreader tool created, and the Terrain Spreader tool interface will be displayed in the Inspector. Figure 2 This is the operation interface of the Mask Component control. The Mask Component control controls mask drawing and editing. Figure 3 It is the operation interface of the Terrain Scatter Tool control. The Terrain Scatter Tool control controls the instantiation and arrangement of prefabs (i.e. object models) on the drawn mask.

[0068] For the first time, make the necessary configuration and click Figure 2 In the operation interface of Mask Component, click the first row button "Open the surface layer map and other related configuration interfaces" to open the Figure 4 In the configuration interface shown, click Create Setting Data and save it in the default path. If you need to use the same configuration data with other people, you can mount the configuration data of other people to the Detail setting data box of the terrain layer. Figure 5 As shown, this interface is mainly used to obtain the configuration data of the terrain texture layer and terrain vegetation layer in the project terrain. After opening the terrain to be edited, click Figure 5 Click the button "Automatically search for new layers in visible terrain" corresponding to the terrain texture layer marked with a square box, and the terrain texture layer configured in the terrain will be automatically searched. The interface after configuration is as follows: Figure 6 As shown; click Figure 5 Click the button "Automatically search for new layers in visible terrain" corresponding to the terrain vegetation layer marked with a square box, and the terrain vegetation layer configured in the terrain will be automatically searched to complete the configuration. The interface after the configuration is as follows Figure 7 shown.

[0069] Close the configuration interface and return to the terrain scattering tool operation interface, such as Figure 8 As shown in the figure, a mask drawing bar appears on the left side of the Scene interface. You can now use the mouse to draw the mask area you want to operate on the terrain. You can press and hold the preset shortcut key (such as Ctrl+Draw) to erase the mask. Fig. 9 As shown, the tool interface also has operation controls such as showing or hiding the mask, changing the mask color, and clearing the mask with one click.

[0070] After you are familiar with the Mask Component control, the next step is to use the Terrain Scatter Tool control. First, load the required resources into the resource pool, such as Fig.10 In the Unity asset bar, click on the box icon to pick up the asset. Fig.11 As shown, it is the prefab asset pushed from the Prefab management plug-in.

[0071] Now that the preparations are complete, you can start scattering points. Get the mask drawing instructions, and based on the Mask Component control, draw a mask in the scene terrain according to the mask drawing instructions. That is, determine the area range of the stone, tree and other object models that need to be generated, and then based on the Terrain Scatter Tool control, generate object models (such as stones, trees, etc.) on the drawn mask, and finally realize the scattering of points on the scene terrain.

[0072] It should be noted that after drawing a mask in the scene terrain, the point-scattering editing state is entered. In the point-scattering editing state, the mask cannot be drawn because the mask cannot be changed during editing. If the mask needs to be modified, it needs to exit the editing mode to modify it.

[0073] The embodiment of the present application can implement a terrain scattering tool in the Unity engine. The tool allows artists to draw a mask on the scene terrain to select the range of object models to be generated, and automatically generate randomly distributed object models within the selected range, thereby achieving the purpose of drawing a mask on the terrain in the Unity engine to generate object models, ensuring that the object models are evenly distributed, and there is no need to implement it through a third-party plug-in. The method is simple, reduces cost and complexity, avoids motion conflicts with the Unity engine, and improves stability.

[0074] In one embodiment of the present application, based on a pre-created model generation control, an object model is generated on a drawn mask, including:

[0075] Based on the model generation control, add a horizontal mixing layer, and move at least one object model to the horizontal mixing layer;

[0076] Add a logical node to the horizontal hybrid layer. The logical node is used to configure the layer data of the horizontal hybrid layer. The layer data is used to filter the area for generating object models according to terrain attributes.

[0077] The type of layer data of the horizontal mixing layer is configured as an initial mask on the logical node, and the model parameters of the object model are configured;

[0078] An object model is generated on the mask according to the model parameters and the type of layer data.

[0079] In this embodiment, in the scattered point editing state, based on the model generation control, you can add a horizontal mixing layer through the add button, select the horizontal mixing layer and click the prefab asset push button below to push the asset into the horizontal mixing layer.

[0080] Enter the layer editing interface through the edit button on the horizontal mixed layer, and create a logical node in the pop-up editing window. The node types of the logical node include layer data, post-processing, and avoidance layer. The layer data is used to filter the area for generating object models according to the terrain attributes. It can store surface texture layers and some functional layers, such as slope layers, height layers, AO layers, noise layers, etc. The area to generate object models can be filtered according to the slope, height, AO and other attributes of the terrain to avoid the incoordination between the object model and the terrain caused by filtering only according to the grass layer. For example, Fig.12 As shown, the slope layer node can obtain the mask of the terrain slope range and generate trees on steep slopes; post-processing is a secondary processing of these layers, with functions such as enlargement, reduction, inversion, and binarization; the avoidance layer also belongs to the layer data, which is the model and terrain section projection layer pre-calculated during baking.

[0081] Then, select layer data as the logical node type and the type of layer data as the initial mask to scatter the corresponding prefabs on the scene terrain. Further, adjust the model parameters such as density, quantity, spacing, weight, etc. of the scattered prefabs to obtain the final object model.

[0082] It should be noted that in the scattered point editing state, one or more horizontal mixed layers can be added, each horizontal mixed layer can contain one or more object models. In each horizontal mixed layer, one or more logical nodes can be added, and each logical node can select different types of layer data.

[0083] If you give up editing, click Back to clear all scattered points and exit the editing state. If you are satisfied, click Finish, and the instantiated object model will be placed in the preset group created under the currently activated scene. The object model can be grouped according to the name of the terrain scene where it is located.

[0084] Through the above method, based on the mask drawn in the scene terrain, after determining the range of the object model to be generated, the object model can be directly generated on the scene terrain without generating it on the entire grass layer, avoiding the problem of uneven distribution of the object model.

[0085] In one embodiment of the present application, the method further includes: adding a post-processing node to the logical node, and performing secondary processing of the layer data on the post-processing node; wherein the secondary processing includes at least one of the following: enlargement, reduction, blurring, reversal, and binarization.

[0086] In this embodiment, one or more post-processing nodes may be added to each logical node, and each post-processing node may perform secondary processing on the layer data, such as enlarging, reducing, blurring, reversing, binarizing, etc. These operations may increase the details and changes of the layer data, and achieve richer and more diverse effects. Fig.13 As shown in , the noise node and the post-processing node binarization can obtain a Perlin noise random graph; Fig.14 As shown in the figure, the enlargement and reduction operations are commonly used in post-processing.

[0087] In one embodiment of the present application, the method further includes: adding a child node to the logical node, and performing sub-calculation on the layer data on the child node.

[0088] In this embodiment, one or more sub-nodes may be added to each logical node. The sub-node is a processing unit for layer data and layer avoidance advanced sub-calculations. Each sub-node can perform sub-calculations on layer data, such as addition, subtraction, multiplication, and division operations. These operations can achieve more complex layer mixing effects. For example, Fig.15 As shown, the initial mask minus the avoidance mask is performed in the child node.

[0089] In one embodiment of the present application, adding a horizontal mixed layer includes: in response to a layer selection instruction in a surface layer configuration page, determining one of a plurality of surface layers as a horizontal mixed layer.

[0090] In this embodiment, it is possible to filter the surface layer map, that is, the level mixed layer. Specifically, when it is necessary to filter out a certain layer of the surface in the terrain and sprinkle points on it, open Figure 6 The configuration page of the terrain texture layer is shown in Fig.16 As shown in the figure, in the "Current Mask Editing Area Common Layer Filter (Click to Refresh)" button, you can filter the layer information of the terrain in the mask area. For example, if you need a grass layer, the grass map in the configuration interface corresponds to the serial number 2, and the corresponding layer in the editing interface is Layer02. Grass01 to Grass04 correspond to the corresponding layer data of the surface grass of the terrain vegetation system. Fig.17 As shown, check "Show Edit Mask" to display the mask of the current layer in the editing state.

[0091] In one embodiment of the present application, configuring the model parameters of the object model includes: in response to the parameter configuration instruction, configuring the model parameters of the object model to be a density scattering mode or a quantity spacing scattering mode;

[0092] The density scattering mode is to scatter points evenly at a density of 0 to 1, and the quantity spacing scattering mode is to scatter points randomly according to a given quantity of points and the minimum interval between two points.

[0093] In this embodiment, the model parameters of the object model include a scattering mode, which includes a density scattering mode and a quantity spacing scattering mode. In the editing interface of the flat mixed layer, a specific scattering mode can be selected. In the density scattering mode, the points are evenly scattered according to a density of 0 to 1, with a value of 1 being the densest and a value of 0 being the sparsest. Fig.18 Uncheck the density scatter mode to get the quantity spacing scatter mode. The quantity spacing scatter mode means that a given number of points is randomly scattered with the minimum interval between two points. Fig.19 shown.

[0094] Through the above method, the scattering model of the object model can be flexibly set.

[0095] In one embodiment of the present application, the terrain attributes include a terrain slope; the method further includes: in response to a model tilt angle configuration instruction, configuring the tilt angle of the object model to follow the normal direction of the terrain slope, and / or configuring the tilt angle of the object model to follow the weight value of the normal direction of the terrain slope.

[0096] In this embodiment, in the point-scattering editing state, the tilt angle of the object model is set to follow the direction of the terrain normal. This function allows the object model to rotate on the terrain slope to follow the terrain slope, and the weight value of following the terrain normal can be adjusted. Fig. 20 As shown, if you want the object to rotate to follow the slope of the terrain, you can check this function and adjust the weight value of the terrain normal.

[0097] Through the above method, the tilt angle of the object model is rotated along the normal direction of the terrain to ensure the display effect.

[0098] In one embodiment of the present application, the method further includes: when a plurality of object models are included in the horizontal mixing layer, in response to a model weight configuration instruction, adjusting the display ratio of the plurality of object models by adjusting the horizontal mixing weight value.

[0099] In this embodiment, when the horizontal mixing layer includes multiple object models, horizontal mixing weight adjustment can be performed, which means that multiple object models are placed in one spreader node and instantiations are generated at the same time according to the weight ratio, thereby improving efficiency. Fig.21 As shown, the horizontal mixing weight value is adjusted to achieve different proportions of multiple object models.

[0100] In one embodiment of the present application, the method further includes: in response to the model replacement instruction, determining the object model to be replaced in the scene terrain, and replacing the object model to be replaced with the candidate object model.

[0101] In this embodiment, if you want to replace a certain object model, you can use the candidate object model to replace the object model to be replaced. Fig. 22 As shown, you can select the scattered point items that need to be replaced, and then click the replace button of the prefab you want to replace in the Prefab library below to achieve the replacement.

[0102] In one embodiment of the present application, the method further includes: in response to the model avoidance instruction, determining an avoidance object model in the scene terrain, and generating an initial avoidance mask of the avoidance object model, the initial avoidance mask being used to perform avoidance calculation on the avoidance object model;

[0103] The model avoidance information carried in the model avoidance instruction includes at least one of the following: inclusion words, exclusion words, inclusion group name, upward offset of surface section, whether to exclude non-rendering models, whether to exclude non-collision models, and whether to exclude triggers.

[0104] In this embodiment, in the scatter point editing state, you can also set whether to generate an initial avoidance mask. This function can avoid other object models that already exist in the scene terrain (for example, existing rocks, trees, buildings, etc. in the scene), and prevent object models from overlapping or interspersing with other object models. You can also set keyword filtering conditions such as included words, excluded words, and included group names, as well as set parameters such as the upward offset value of the surface section.

[0105] For example, if you want to avoid the rocks, trees, buildings and other models that have been arranged in the scene, you can check the option "Whether to generate initial avoidance mask", and then click Execute to pre-generate a projection of these models on the terrain section, called the initial avoidance mask, for avoidance calculation. Fig.23 As shown, after checking the option "Whether to generate initial avoidance mask", multiple sub-options will be generated, including words, exclusion words, and group names for keyword filtering to generate avoidance mask; exclude non-rendered models, exclude non-collision models, and exclude triggers are used to filter out models that are not displayed for triggering in some scenes. Usually, these options can be kept by default; the upward offset of the surface section is used to avoid the setting of how high the model is from the ground, such as how high the tree crown is from the ground. If it is "0", only the tree trunk will be avoided. It should be noted that in the animated picture, checking "Show edit mask" can display the current editing status. The original model in the terrain can be excluded from the avoidance mask by subtracting the mask drawn.

[0106] Through the above method, other object models that already exist in the scene can be avoided, and the generated object model can be prevented from overlapping or interlacing with other object models, thereby improving the aesthetics and realism.

[0107] In one embodiment of the present application, the method further includes: generating an avoidance layer of the level mixing layer in response to the layer avoidance instruction;

[0108] The layer avoidance information carried in the layer avoidance instruction includes at least one of the following: including words and an upward offset of the surface section.

[0109] In this embodiment, in the point scattering editing state, you can also set whether to generate the current avoidance mask. In the editing interface, there is a checkable option "Whether to generate the current avoidance layer". When this option is checked, an avoidance layer of the same level mixed layer can be generated in real time, that is, the projection map of the object model and the terrain section mask of the current level mixed layer, such as Fig.24 As shown, the sub-options include the inclusion word (i.e., the inclusion keyword) and the upward offset of the terrain section. The avoidance layer can be found in the editing interface avoidance layer of the next level mixed layer, such as Fig.25 shown.

[0110] In the embodiment of the present application, an avoidance layer is set to implement a multi-layer point scattering avoidance function, thereby avoiding other object models that already exist in the scene and preventing object models from overlapping or interlacing with other object models.

[0111] In one embodiment of the present application, the method further includes: in response to a dot-scattering surround instruction, expanding the target avoidance layer of the previous level of the horizontal mixing layer by a preset pixel and then subtracting the target avoidance layer to obtain a surround mask; and configuring a sub-model around the object model based on the surround mask.

[0112] In this embodiment, the dot-scattering surround function can be realized. Dot-scattering surround means scattering some small sub-models around the scattered object model, for example, planting a tree and then planting some small flowers around the tree. This can be achieved by using the avoidance layer. The specific operation is to expand the previous level dot-scattering avoidance layer by a few pixels, and then subtract this avoidance layer to obtain the surround mask. The operation is as follows: Fig.26 Through the above method, the richness of terrain scattering display is improved.

[0113] In one embodiment of the present application, the method further includes: saving node addition information and / or configuration information in the process of generating the object model.

[0114] In this embodiment, the configured node addition information can be exported, and the layer data, model parameters, surface layer, model inclination angle, horizontal mixing weight value, sub-model and other configuration information can also be exported for later use or shared with other personnel. Fig. 27 shown.

[0115] In summary, this application has the following beneficial effects:

[0116] (1) Improves the efficiency and convenience of generating object models in the Unity engine, without the need to purchase and install third-party plug-ins or learn complex and redundant functions.

[0117] (2) The flexibility and freedom of generating object models in the Unity engine are improved. Masks of any shape and size can be drawn on the terrain to select the range of the object model to be generated. Various post-processing and sub-calculation operations can also be performed on the generated object model layout to achieve richer and more diverse effects.

[0118] (3) The quality and realism of object models generated in the Unity engine are improved. The area where the object model is to be generated can be screened according to the attributes of the terrain, so that the object model is coordinated with the terrain. Other object models that already exist in the scene can also be avoided, so that the object model does not overlap or intersperse with other object models.

[0119] As a specific implementation of the above-mentioned terrain scattering method, the present application embodiment provides a terrain scattering device. Fig.28 As shown, the terrain scattering device 2800 includes: a mask drawing module 2801 and a model generating module 2802.

[0120] The mask drawing module 2801 is used to obtain a mask drawing instruction based on a pre-created mask drawing control, and draw a mask in the scene terrain according to the mask drawing instruction;

[0121] The model generation module 2802 is used to generate an object model on the drawn mask based on a pre-created model generation control to achieve scene terrain scattering.

[0122] In this embodiment, a terrain scattering tool can be implemented in the Unity engine, including a mask drawing control and a model generation control. The tool allows artists to draw a mask on the scene terrain to select the range of object models to be generated, and automatically generate randomly distributed object models within the selected range, thereby achieving the purpose of drawing a mask on the terrain in the Unity engine to generate object models, ensuring that the object models are evenly distributed, and there is no need to implement it through a third-party plug-in. The method is simple, reduces cost and complexity, avoids motion conflicts with the Unity engine, and improves stability.

[0123] Furthermore, the terrain scattering device 2800 also includes:

[0124] The control creation module is used to create a terrain scattering control, and the terrain scattering control includes a mask drawing control and a model generation control, wherein the mask drawing control is used to control the drawing and editing of the mask, and the model generation control is used to control the generation of the object model.

[0125] Furthermore, the model generation module 2802 is specifically used for:

[0126] Generate a control based on the model, add a horizontal mixing layer, and move at least one object model to the horizontal mixing layer;

[0127] Adding a logical node to the horizontal hybrid layer, the logical node is used to configure layer data of the horizontal hybrid layer, the layer data is used to filter the area for generating the object model according to the terrain attributes;

[0128] Configuring the type of the layer data of the horizontal hybrid layer as an initial mask on the logical node, and configuring the model parameters of the object model;

[0129] The object model is generated on the mask according to the model parameters and the type of the layer data.

[0130] Furthermore, the model generation module 2802 is also used to add a post-processing node to the logical node, and perform secondary processing of the layer data on the post-processing node; wherein the secondary processing includes at least one of the following: enlargement, reduction, blurring, reversal, and binarization.

[0131] Furthermore, the model generation module 2802 is also used to add a sub-node to the logical node, and perform sub-calculation on the layer data on the sub-node.

[0132] Furthermore, the model generation module 2802 is specifically configured to determine one of the multiple surface layers as the horizontal mixed layer in response to a layer selection instruction in the surface layer configuration page.

[0133] Furthermore, the model generation module 2802 is specifically configured to configure the model parameters of the object model to be a density scattering mode or a quantity spacing scattering mode in response to the parameter configuration instruction;

[0134] The density scattering mode is to scatter points evenly at a density of 0 to 1, and the quantity spacing scattering mode is to scatter points randomly according to a given quantity of scattering points and a minimum interval between two points.

[0135] Furthermore, the terrain attributes include a terrain slope; the model generation module 2802 is also used to configure the inclination angle of the object model to follow the normal direction of the terrain slope, and / or configure the weight value of the inclination angle of the object model to follow the normal direction of the terrain slope in response to a model inclination angle configuration instruction.

[0136] Furthermore, the model generation module 2802 is also used to adjust the display ratio of the multiple object models by adjusting the horizontal mixing weight value in response to the model weight configuration instruction when the horizontal mixing layer includes multiple object models.

[0137] Furthermore, the model generation module 2802 is further configured to determine the object model to be replaced in the scene terrain in response to the model replacement instruction, and replace the object model to be replaced with the candidate object model.

[0138] Furthermore, the model generation module 2802 is further configured to determine an avoidance object model in the scene terrain in response to a model avoidance instruction, and to generate an initial avoidance mask of the avoidance object model, wherein the initial avoidance mask is used to perform avoidance calculation on the avoidance object model;

[0139] Among them, the model avoidance information carried in the model avoidance instruction includes at least one of the following: inclusion words, exclusion words, inclusion group name, upward offset of surface section, whether to exclude non-rendering models, whether to exclude non-collision models, and whether to exclude triggers.

[0140] Furthermore, the model generation module 2802 is further configured to generate an avoidance layer of the same-level hybrid layer in response to a layer avoidance instruction;

[0141] The layer avoidance information carried in the layer avoidance instruction includes at least one of the following: including words and an upward offset of the surface section.

[0142] Furthermore, the model generation module 2802 is also used to respond to the dot-scattering surround instruction, expand the target avoidance layer of the previous level of the horizontal mixing layer by preset pixels and then subtract the target avoidance layer to obtain a surround mask; and configure a sub-model around the object model based on the surround mask.

[0143] Furthermore, the model generation module 2802 is also used to save the node addition information and / or configuration information in the process of generating the object model.

[0144] The terrain scattering device 2800 in the embodiment of the present application can be a computer device, or a component in the computer device, such as an integrated circuit or a chip. The computer device can be a terminal, or other devices other than a terminal. Exemplarily, the computer device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted computer device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0145] The terrain scattering device 2800 provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented in the terrain scattering method embodiment are not described here.

[0146] The present application also provides a computer device, such as Fig.29 As shown, the computer device 2900 includes a processor 2901 and a memory 2902. The memory 2902 stores programs or instructions that can be executed on the processor 2901. When the program or instructions are executed by the processor 2901, the various steps of the above-mentioned terrain scattering method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0147] The memory 2902 can be used to store software programs and various data. The memory 2902 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 2902 may include a volatile memory or a non-volatile memory, or the memory 2902 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 2902 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0148] The processor 2901 may include one or more processing units; optionally, the processor 2901 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 2901.

[0149] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned terrain scattering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0150] An embodiment of the present application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned terrain scattering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0151] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0152] An embodiment of the present application also provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned terrain scattering method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0153] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0154] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A terrain scattering method, characterized in that: include: Based on the pre-created mask drawing control, a mask drawing instruction is obtained, and a mask is drawn in the scene terrain according to the mask drawing instruction; Based on the pre-created model generation control, an object model is generated on the drawn mask to achieve scene terrain scattering.

2. The method according to claim 1, characterized in that The method further comprises: A terrain scattering control is created, wherein the terrain scattering control includes a mask drawing control and a model generation control, wherein the mask drawing control is used to control the drawing and editing of the mask, and the model generation control is used to control the generation of the object model.

3. The method according to claim 1, characterized in that The generating control based on the pre-created model, generating the object model on the drawn mask, comprises: Generate a control based on the model, add a horizontal mixing layer, and move at least one object model to the horizontal mixing layer; Adding a logical node to the horizontal hybrid layer, the logical node is used to configure layer data of the horizontal hybrid layer, the layer data is used to filter the area for generating the object model according to the terrain attributes; Configuring the type of the layer data of the horizontal hybrid layer as an initial mask on the logical node, and configuring the model parameters of the object model; The object model is generated on the mask according to the model parameters and the type of the layer data.

4. The method according to claim 3, characterized in that The method further comprises: adding a post-processing node to the logical node, and performing secondary processing of the layer data on the post-processing node; The secondary processing includes at least one of the following: enlargement, reduction, blurring, reversal, and binarization.

5. The method according to claim 3, characterized in that: The method further comprises: A child node is added to the logic node, and a sub-calculation is performed on the layer data on the child node.

6. The method according to claim 3, characterized in that The adding of a horizontal mixing layer comprises: In response to a layer selection instruction in a surface layer configuration page, one of a plurality of surface layers is determined as the horizontal mixed layer.

7. The method according to claim 3, characterized in that The configuring the model parameters of the object model includes: In response to the parameter configuration instruction, the model parameters of the object model are configured as a density scattering mode or a quantity spacing scattering mode; The density scattering mode is to scatter points evenly at a density of 0 to 1, and the quantity spacing scattering mode is to scatter points randomly according to a given quantity of scattering points and a minimum interval between two points.

8. The method according to claim 3, characterized in that The terrain attribute includes a terrain slope; the method further includes: In response to the model tilt angle configuration instruction, the tilt angle of the object model is configured to follow the normal direction of the terrain slope, and / or the tilt angle of the object model is configured to follow the weight value of the normal direction of the terrain slope.

9. The method according to claim 3, characterized in that: The method further comprises: When the horizontal mixing layer includes a plurality of the object models, the display ratios of the plurality of the object models are adjusted by adjusting the horizontal mixing weight values ​​in response to the model weight configuration instruction.

10. The method according to claim 3, characterized in that: The method further comprises: In response to the model replacement instruction, an object model to be replaced is determined in the scene terrain, and the object model to be replaced is replaced by a candidate object model.

11. The method according to any one of claims 3 to 10, characterized in that The method further comprises: In response to the model avoidance instruction, determining an avoidance object model in the scene terrain, and generating an initial avoidance mask of the avoidance object model, wherein the initial avoidance mask is used to perform avoidance calculation on the avoidance object model; Among them, the model avoidance information carried in the model avoidance instruction includes at least one of the following: inclusion words, exclusion words, inclusion group name, upward offset of surface section, whether to exclude non-rendering models, whether to exclude non-collision models, and whether to exclude triggers.

12. The method according to any one of claims 3 to 10, characterized in that The method further comprises: In response to the layer avoidance instruction, generating an avoidance layer of the flat hybrid layer; The layer avoidance information carried in the layer avoidance instruction includes at least one of the following: including words and an upward offset of the surface section.

13. The method according to claim 12, characterized in that The method further comprises: In response to the dot-scattering surround instruction, the target avoidance layer of the previous level of the horizontal mixed layer is enlarged by a preset pixel and then the target avoidance layer is subtracted to obtain a surround mask; A sub-model is configured around the object model based on the surrounding mask.

14. The method according to any one of claims 3 to 10, characterized in that The method further comprises: The node addition information and / or configuration information in the process of generating the object model is saved.

15. A terrain scattering device, characterized in that: include: A mask drawing module, used for obtaining a mask drawing instruction based on a pre-created mask drawing control, and drawing a mask in the scene terrain according to the mask drawing instruction; The model generation module is used to generate an object model on the drawn mask based on a pre-created model generation control to achieve scene terrain scattering.

16. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the terrain scattering method according to any one of claims 1 to 14 are implemented.

17. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the terrain scattering method according to any one of claims 1 to 14 are implemented.