Static grid body processing method and device and electronic equipment

By classifying the static meshes in the virtual scene and generating hierarchical instantiation of static meshes, the performance consumption problem caused by too many static meshes in the virtual scene is solved, and a smoother gaming experience is achieved.

CN119648951APending Publication Date: 2025-03-18GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411520977.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

During the production of virtual scenes, when manually editing levels and placing scene models, too many static mesh and repeated models lead to excessive performance consumption, causing lag in the screen, affecting the player's gaming experience.

Method used

By responding to static mesh processing instructions, multiple static meshes in the virtual scene are obtained and classified into mesh collections. The static meshes in the same set have the same base static mesh and materials, and generate hierarchical instantiation of static mesh to reduce the number of renderings.

Benefits of technology

Reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of drawing calls during rendering, thereby reducing the performance consumption of the device, and improving the smoothness of the game and player experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648951A_ABST
    Figure CN119648951A_ABST
Patent Text Reader

Abstract

The invention provides a static grid body processing method and device and electronic equipment, and the method comprises the steps: obtaining a plurality of to-be-processed static grid bodies in a virtual scene in response to a static grid body processing instruction; the static grid bodies are provided with corresponding basic static grid bodies; the static grid body is generated by transforming the corresponding basic static grid body; determining at least one grid body set based on the plurality of static grid bodies; wherein the basic static grid bodies corresponding to the static grid bodies in the same grid body set are the same, and the corresponding materials are the same; and generating a hierarchical instantiated static grid body corresponding to the grid body set. According to the mode, the number of the static grid bodies needing to be rendered successively in the virtual scene is reduced, the number of times of drawing calling generated during rendering is reduced, and performance consumption of equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of virtual three-dimensional models, and in particular to a method, device and electronic device for processing a static mesh. Background Art

[0002] In the production process of virtual scenes, relevant staff often need to manually edit levels and place scene models to make the scenes more natural and beautiful. The types of manually added models are usually huge in number and repetitive. Usually when drawing a model, a draw call needs to be generated for the model, and the central processing unit (CPU) sends a large amount of rendering data related to the model to the graphics processing unit (GPU). Too many draw calls will greatly increase the performance consumption of the device, which may cause the screen display to freeze, resulting in a poor gaming experience for players. Summary of the invention

[0003] In view of this, the purpose of the present disclosure is to provide a static mesh processing method, device and electronic device to reduce the number of static meshes that need to be rendered successively in a virtual scene, reduce the number of drawing calls generated during rendering, and reduce the performance consumption of the device.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for processing a static mesh, the method comprising: responding to a static mesh processing instruction, obtaining multiple static meshes to be processed in a virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the multiple static meshes, determining at least one mesh set; wherein the static meshes in the same mesh set have the same basic static mesh corresponding to them and the same corresponding materials; generating a hierarchical instantiated static mesh corresponding to the mesh set.

[0005] In a second aspect, an embodiment of the present disclosure provides a static mesh processing device, the device comprising: a static mesh acquisition module, used to respond to a static mesh processing instruction to acquire multiple static meshes to be processed in a virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; a mesh set determination module, used to determine at least one mesh set based on multiple static meshes; wherein the static meshes in the same mesh set have the same basic static mesh corresponding to them and the same corresponding materials; a hierarchical instantiated static mesh generation module, used to generate a hierarchical instantiated static mesh corresponding to the mesh set.

[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned static mesh processing method.

[0007] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned static mesh processing method.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] The above-mentioned static mesh processing method, device and electronic device respond to the static mesh processing instruction, obtain multiple static meshes to be processed in the virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the multiple static meshes, at least one mesh set is determined; wherein the static meshes in the same mesh set correspond to the same basic static mesh and the same corresponding material; and the hierarchical instantiated static mesh corresponding to the mesh set is generated. This method reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of drawing calls generated during rendering, and reduces the performance consumption of the device.

[0010] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0011] 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

[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0013] Figure 1 A flowchart of a method for processing a static mesh provided by an embodiment of the present disclosure;

[0014] Figure 2A schematic diagram of the structure of a static mesh processing device provided in an embodiment of the present disclosure;

[0015] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0017] In the current virtual scene production process, scene editing functions often require manual editing of levels and placement of scene models to make the scene more natural and beautiful. Each scene model is usually regarded as an object in the virtual scene, called an actor. The above scene models are usually non-deformable, usually static meshes. However, these manually added models have not been batched and sorted, and the number of objects is extremely large. When rendering objects in the virtual scene, too many draw calls will be generated. When the number of scenes is large, it is difficult to manage, and directly entering the game will cause serious performance problems.

[0018] In summary, the detailed scene editing process often requires manual placement of scene models. There are many repeated models in the scene. If they are not batched, the performance consumption of the scene increases with the increase of repeated actors, and it is difficult to uniformly manage similar models.

[0019] Based on this, the embodiments of the present disclosure provide a method, device and electronic device for processing a static mesh. This technology can be applied to virtual scenes that require the placement of a large number of virtual objects.

[0020] See also Figure 1 First, a method for processing a static mesh provided by an embodiment of the present invention is introduced. The method comprises the following steps:

[0021] Step S102, responding to the static mesh processing instruction, obtaining multiple static meshes to be processed in the virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh.

[0022] The above-mentioned static mesh is an important asset type in the game engine. It refers to three-dimensional models that do not require skeletal animation or deformation during the game. A large number of static meshes are usually set up in the virtual scene to present the required scene display effect.

[0023] The above static mesh processing instructions can usually be generated by relevant staff through writing instructions, or by relevant staff interacting with pre-set interactive controls for triggering the static mesh processing process; or they can be automatically generated by the system after relevant staff place the required static meshes in the virtual scene. The specific settings can be made according to the needs, and are not set here.

[0024] Usually, some static meshes of various shapes are generated in advance to represent different virtual objects. For example, static meshes representing trees, grass, mountains, houses, etc. can be generated. These static meshes are usually called basic static meshes. The basic static meshes can be scaled, rotated, and other changes can be performed to generate static meshes that are consistent with but not exactly the same as the basic static meshes, and placed in the virtual scene to increase the richness of the scene effect. For example, five basic static meshes representing trees can be generated, and then the five basic static meshes representing trees can be transformed to generate multiple static meshes of different sizes and orientations, and placed in the virtual scene according to certain arrangement rules, so that the virtual scene can have a display effect of dense trees and rich varieties.

[0025] Step S104, determining at least one mesh set based on the multiple static meshes; wherein the static meshes in the same mesh set correspond to the same basic static mesh and have the same corresponding materials.

[0026] In practical applications, all static meshes can be divided into mesh collections according to their corresponding basic static meshes and materials. After the relevant staff has selected a part of the static meshes, these static meshes can be divided into mesh collections according to their corresponding basic static meshes and materials. The selected static meshes can usually be determined by static mesh processing instructions. After the relevant staff has selected one or more static meshes, a corresponding mesh collection can be determined based on the basic static meshes and materials corresponding to the selected static meshes, and then other static meshes can be determined based on their corresponding basic static meshes and materials to determine whether to divide them into the determined mesh collection. Similarly, the selected static meshes can be determined by the above-mentioned static mesh processing instructions.

[0027] As mentioned above, the static meshes in the same mesh collection have the same base static mesh, that is, they are all generated by transforming the same base static mesh, and have the same corresponding materials. The same base static mesh may have multiple optional materials. When different static meshes have the same base static mesh but different corresponding materials, it is difficult to render different static meshes with one draw call, so the above different static meshes cannot be divided into the same mesh collection.

[0028] Usually, it is necessary to first establish a mesh set, and then add each static mesh to the corresponding mesh set. Since the mesh set is divided based on the basic static meshes and materials, it is necessary to determine the basic static meshes and materials corresponding to the static meshes that need to be divided into the mesh set, and generate the corresponding mesh set. In the specific implementation, it is necessary to traverse all static meshes. For the first static mesh that needs to be divided, since there is no established mesh set at present, it is necessary to establish a corresponding mesh for a basic mesh and material for the static mesh. For the static meshes after the first static mesh, it can be determined whether the static mesh belongs to the established mesh set. If not, it is necessary to establish a new mesh set for the basic static mesh and material corresponding to the static mesh. In this way, all static meshes that need to be divided into mesh sets are traversed and divided into corresponding mesh sets.

[0029] Step S106: Generate a hierarchical instantiated static mesh corresponding to the mesh set.

[0030] After determining the mesh collection, you need to create a hierarchical instanced static mesh for each mesh collection. Hierarchical instanced static mesh is called "Hierarchical Instanced Static Mesh", abbreviated as "HISM". In game development and Unreal Engine, HISM has the ability to efficiently render and manage a large number of static mesh instances. With HISM, multiple instances of the same static mesh can be efficiently rendered with a single draw call, reducing processing overhead and improving performance.

[0031] Hierarchical instanced static meshes are organized and instantiated (i.e. copied and placed) in a tree structure, thereby reducing memory usage and improving rendering performance. Typically, multiple instances of the same mesh and material data are shared, and the transformation matrix (position, rotation, scale) is updated only when necessary, thus avoiding repeated loading of the same resources. In subsequent rendering processes, the number of draw calls can be reduced by rendering the hierarchical instanced static meshes, thereby reducing device performance consumption.

[0032] The above-mentioned static mesh processing method responds to the static mesh processing instruction, obtains multiple static meshes to be processed in the virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the multiple static meshes, at least one mesh set is determined; wherein the static meshes in the same mesh set correspond to the same basic static mesh and the same corresponding material; and generates a hierarchical instantiated static mesh corresponding to the mesh set. This method reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of drawing calls generated during rendering, and reduces the performance consumption of the device.

[0033] The following embodiment provides a specific method for determining at least one mesh set based on multiple static meshes.

[0034] In practical applications, you may need to try to divide multiple static meshes into a target mesh set. At this time, you need to traverse multiple static meshes and perform the following operations for each static mesh: first determine the target base static mesh and target material corresponding to the static mesh, and find the target mesh set corresponding to the target base static mesh. If the currently processed static mesh is the first static mesh processed, there will be no mesh set established for the target base static mesh corresponding to the static mesh, and the search result is not found. If the currently processed static mesh is not the first static mesh processed, there is usually an established mesh set. You need to search the established mesh set for the target base static mesh corresponding to the static mesh.

[0035] If the target mesh collection is not found, it is necessary to establish a target base static mesh and a target mesh collection corresponding to the target material, and then the static mesh can be added to the target mesh collection. It is worth noting that in some cases the material of the static mesh may be missing, in which case the system will automatically set the material of the static mesh to the system material. If the material of the static mesh is missing, there is usually a setting problem, and it is usually not possible to establish a corresponding target mesh collection for the static mesh. Therefore, it is necessary to determine whether the target material corresponding to the static mesh is the preset system material; if not, the target base static mesh and a target mesh collection corresponding to the target material can be established.

[0036] If the target mesh collection is found, it is necessary to further determine whether the target material corresponding to the static mesh is the same as the material corresponding to the target mesh collection; if they are the same, then add the static mesh to the target mesh collection. When searching for a target mesh collection, the target base static mesh and target material corresponding to the static mesh can also be used as search elements. If found, the static mesh can be directly added to the found target mesh collection.

[0037] In a virtual scene, some static meshes may be set to be invisible. For example, after setting a static mesh, the relevant staff may find that it is not necessary to display it; or the static mesh represents the invisible state of a virtual object, etc. When a static mesh is invisible, it does not need to be rendered, so it does not need to be divided into any target mesh collection. Therefore, you can first determine whether the static mesh is visible in the virtual scene; if it is visible, then add the static mesh to the target mesh collection.

[0038] The above-mentioned static mesh has a scaling parameter: the scaling parameter is used to indicate the scaling factor of the static mesh relative to the corresponding base static mesh. The scaling parameter is usually set manually, and it may be a negative number. However, when the scaling parameter is negative, it is a setting error. Before dropping the static mesh into the target mesh collection, it is also necessary to determine whether the scaling parameter of the static mesh is a positive number; if not, it is necessary to determine that the static mesh is not added to the target mesh collection.

[0039] In actual applications, when generating a static mesh processing instruction, the user can make the static mesh processing instruction indicate the first static mesh among multiple static meshes. For example, the name of the static mesh can be input, or the display area of ​​the static mesh can be selected. When the static mesh processing instruction includes the first static mesh, it indicates that the user wants to generate a hierarchical instantiation static mesh based on the basic static mesh corresponding to the first static mesh and the static mesh with the same material.

[0040] Therefore, it is necessary to determine the first basic static mesh and the first material corresponding to the first static mesh, and establish a first mesh set corresponding to the first basic static mesh and the first material. Then, for each static mesh except the first static mesh among the multiple static meshes, determine the target basic static mesh and the target material corresponding to the static mesh. Then, determine whether the target basic static mesh corresponding to the static mesh is the same as the first basic static mesh; if they are the same, it is also necessary to determine whether the target material corresponding to the static mesh is the same as the first material; if they are the same, the static mesh needs to be added to the first mesh set. Then, all static meshes that meet the requirements can be added to the first mesh set.

[0041] When a virtual scene needs to be displayed, a rendering trigger event for the virtual scene is usually generated. For example, the virtual scene appears in the field of view of the virtual character controlled by the player. At this time, the hierarchical instantiated static mesh corresponding to the mesh collection can be rendered. When the virtual scene is for a certain game level, in order to facilitate management, a first level corresponding to the game level can be established, and then the hierarchical instantiated static mesh corresponding to the specified game level can be moved to the first level. In response to the rendering trigger event of the virtual scene for the specified game level, only the hierarchical instantiated static mesh in the first level needs to be rendered. Compared with directly reading the rendering parameters of the static mesh in the specified game level to render the static mesh, fewer drawing calls are generated and less device consumption is generated.

[0042] The present disclosure also provides another method for processing a static mesh. Figure 1 The method is implemented based on the method shown in. The method implements a tool for batch merging static meshes into hierarchical instanced static meshes (HISM) in a scene based on Unreal Engine (UE).

[0043] This method takes the game scene corresponding to the game level as an example. By looping all static mesh actors in the scene, the repeated static meshes, materials and transform information in the scene are collected, and a large number of actors in the original hand-held level are organized into HISM actors. Among them, those that reference the same model and material can be merged into HISM, so as to achieve the purpose of reducing draw calls and the total number of actors in the scene and the purpose of organizing the scene model.

[0044] The method will be described and analyzed in detail below.

[0045] This method has two modes, wherein mode one is: scanning all repeated static meshes in the specified level and merging HISMs; mode two is: for the currently selected static mesh actor, scanning the repeated static meshes in the specified level and merging HISMs.

[0046] For mode 1, two buttons are designed on the graphical user interface. Button Step1 is used to bake all duplicate static meshes in the current level into HISM actors. Button Step2 is used to move the generated HISM actors to the specified level where the HISM actors are stored. In addition, an Input Edit bar can be set for mode 1 for users to enter the following parameters: Actor Folder Path is the group name of the generated HISM actors in the level, HISM Level Path is the level where the merged HISM actors are placed, that is, the level to which the HISM actors are moved after pressing the Step2 button, and CurrentLevel Name is the current level name, that is, the SM actors in which level are to be merged, and need to be loaded and kept as the current level. In addition, since actors with negative scale values ​​cannot be HISMed, a check step is also added to the tool to filter out these erroneous actors and display them in the pre-set Warning bar in the graphical user interface.

[0047] The detailed functions of the two buttons in Mode 1 are introduced in detail below.

[0048] 1. Pre-prepared actor template

[0049] A blueprint with an empty HISM component built in (hereinafter referred to as HISM blueprint template) needs to be prepared in advance to generate and store the collected models of each HISM and the information of each instance in the scene.

[0050] 2. When you press the Step1 button, the following steps will be executed in sequence:

[0051] (1) Prepare three parameters as containers for key information and clear them

[0052] HISM Info Array (string array): used to store non-repeated model information in the scene. The format is "static mesh name_with_the first material name on the static mesh".

[0053] Newly Spawned Actors (type is Actor array): used to store newly added HISMactors in the scene.

[0054] Actors with Negative Scaling (type is Actor array): used to record actors with negative scale values ​​in the scene.

[0055] (2) Get all static mesh actors in the current scene and perform preliminary screening

[0056] Check if the name of the level to which each static mesh actor belongs is consistent with the entered Current Level Name, and check if the static mesh actor is visible. If both of these are met, check the scaling value of the static mesh component under the staticmesh actor. If the scaling value is less than 0, record the actor in the Actors with Negative Scaling list.

[0057] (3) Record the key information of each static mesh actor

[0058] As described in (1), HISM Info Array (string array type) is used to store non-repeated model information in the scene. For each static mesh actor, obtain the name of the static mesh specified on the static mesh component under it, and the name of the first material on the static mesh (a static mesh often has multiple material slots), connect the two with "_with_", and retrieve whether the string combination of model + material already exists in the HISM Info Array. If not, add it to the HISM Info Array.

[0059] (4) Merge HISM

[0060] For static mesh actors that pass the check described in (2) (referring to those that have not appeared in the HISM Info Array and have been newly added to the HISM Info Array), loop through all actors in the level that have the same model and material combination, record the transform information of these actors, and finally merge them into one HISM (because these actors share the referenced model and only have different transforms, they can be merged into one HISM). This operation is performed in the HISM Current Actor function, and the contents of the HISM Current Actor function are described in detail below.

[0061] The input to this function is the static meshcomponent under the static mesh actor that passed the inspection mentioned above.

[0062] First, for the current static mesh actor (the component under this actor references a model that has not been merged with HISM, hereinafter referred to as the template actor), prepare an empty Transform Array to store the Transform data of all instances under HISM that will be generated in this loop.

[0063] Next, get all the static mesh actors in the world and loop each actor. If: A. the model and material referenced by the static mesh component under the looped actor are consistent with those of the template actor; B. the actor is in the specified current level (referring to the input Current Level Name level) and is visible; C. the material referenced by the model is not the UE default material WorldGridMaterial (this situation often indicates that the material is lost), if these three conditions are met, the transform information of the static mesh component under the looped actor will be recorded in the Transform Array.

[0064] After the loop is finished (a loop for all static mesh actors in the world), if the Transform array is not empty, a HISM blueprint template is generated in the level, and the newly generated HISM blueprint template is added to the NewlySpawned Actors array. For easy organization, the newly generated HISM blueprint template is divided into the Actor Folder Path group set on the tool panel mentioned above, and the actor name of the newly generated HISM blueprint template is changed to the format of BP_HISM_model name_material name for easy search and management. Then obtain the HISM component under the newly generated HISM blueprint template (as described in 1), and set the model and material of the HISM component to the model and material on the component under the template actor. Finally, according to the transform information recorded in the Transform Array, a corresponding number of instances are generated under the HISM component.

[0065] 3. Press the button to finish the execution of Step 1.

[0066] After the execution of button Step1 is completed.

[0067] 4. Press the button Step 2 to move the newly generated HISM actors to the specified level.

[0068] As shown in step 2, newly generated HISM actors are managed in the Newly Spawned Actors array. The original actors and newly generated HISM actors are in the current level, i.e., Current LevelName level, after executing button 1. When button Step 2 is pressed, the actors in the Newly Spawned Actors array are moved to the new level specified by HISMLevel Path.

[0069] The functions of mode 2 and mode 1 are almost the same, the only difference is that mode 1 needs to loop through all actors in the current level first, and then determine whether the actor should be merged with the HISM step one by one. Mode 2 only needs to perform the operations in 2(3) and 2(4) of mode 1 on the currently selected static mesh actor. The node for getting the currently selected static mesh actor is Get selected actors (UE built-in function).

[0070] This tool can solve the need for post-processing hand-edited levels in actual scene editing work, by automatically scanning all repeated static meshes in the scene level, merging them into HISM and migrating them to the specified level. It also provides another mode, which is to automatically scan the actors in the scene that reference the same static mesh and synthesize HSIM according to the type of static mesh currently selected by the user, and merge them into HISM and migrate them to the specified level. This tool can achieve the purpose of reducing the total number of drawcalls and actors in the scene, automating the batch workflow of hand-edited levels, and greatly improving work efficiency.

[0071] For the above method embodiments, see Figure 2 A static mesh processing device is shown, the device comprising:

[0072] The static mesh acquisition module 202 is used to respond to the static mesh processing instruction and acquire multiple static meshes to be processed in the virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh;

[0073] A mesh set determining module 204 is used to determine at least one mesh set based on the multiple static meshes; wherein the static meshes in the same mesh set correspond to the same basic static mesh and have the same corresponding material;

[0074] The hierarchical instantiation static mesh generation module 206 is used to generate a hierarchical instantiation static mesh corresponding to the mesh set.

[0075] The above-mentioned static mesh processing device responds to the static mesh processing instruction and obtains multiple static meshes to be processed in the virtual scene; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the multiple static meshes, at least one mesh set is determined; wherein the static meshes in the same mesh set have the same basic static meshes and the same corresponding materials; and a hierarchical instantiated static mesh corresponding to the mesh set is generated. This method reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of drawing calls generated during rendering, and reduces the performance consumption of the device.

[0076] The above-mentioned mesh collection determination module is also used to: traverse multiple static meshes, and perform the following operations for each static mesh: determine the target basic static mesh and target material corresponding to the static mesh; search for the target mesh collection corresponding to the target basic static mesh; if not found, establish a target mesh collection corresponding to the target basic static mesh and the target material, and add the static mesh to the target mesh collection; if found, determine whether the target material corresponding to the static mesh is the same as the material corresponding to the target mesh collection; if they are the same, add the static mesh to the target mesh collection.

[0077] The mesh set determination module is further used to: determine whether the static mesh is visible in the virtual scene; if visible, add the static mesh to the target mesh set.

[0078] The mesh set determination module is further used to: determine whether the target material corresponding to the static mesh is a preset system material; if not, establish a target base static mesh and a target mesh set corresponding to the target material.

[0079] The above-mentioned static mesh processing instruction is used to indicate a first static mesh among multiple static meshes; the mesh set determination module is also used to: determine a first basic static mesh and a first material corresponding to the first static mesh; establish a first mesh set corresponding to the first basic static mesh and the first material; for each static mesh among the multiple static meshes except the first static mesh, determine a target basic static mesh and a target material corresponding to the static mesh; determine whether the target basic static mesh is the same as the first basic static mesh; if they are the same, determine whether the target material is the same as the first material; if they are the same, add the static mesh to the first mesh set.

[0080] The above-mentioned static mesh has a scaling parameter: the scaling parameter is used to indicate the scaling factor of the static mesh relative to the corresponding basic static mesh; before adding the static mesh to the target mesh set, the above-mentioned device includes: a scaling factor determination module, used to determine whether the scaling parameter of the static mesh is a positive number; and a non-adding to mesh set module, used to determine that the static mesh is not added to the target mesh set if not.

[0081] The above-mentioned device also includes: a rendering module, which is used to respond to a rendering trigger event for the virtual scene and render the hierarchical instantiated static mesh corresponding to the mesh set.

[0082] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned static mesh processing method, for example:

[0083] In response to a static mesh processing instruction, a plurality of static meshes to be processed in a virtual scene are obtained; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the plurality of static meshes, at least one mesh set is determined; wherein the static meshes in the same mesh set have the same basic static mesh corresponding to them and have the same corresponding materials; and a hierarchical instantiated static mesh corresponding to the mesh set is generated.

[0084] The above method reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of draw calls generated during rendering, and reduces the performance consumption of the device.

[0085] Optionally, the above-mentioned step of determining at least one mesh set based on multiple static meshes includes: traversing multiple static meshes, and performing the following operations for each static mesh: determining the target base static mesh and the target material corresponding to the static mesh; searching for the target mesh set corresponding to the target base static mesh; if not found, establishing a target mesh set corresponding to the target base static mesh and the target material, and adding the static mesh to the target mesh set; if found, determining whether the target material corresponding to the static mesh is the same as the material corresponding to the target mesh set; if they are the same, adding the static mesh to the target mesh set.

[0086] Optionally, the step of adding the static mesh to the target mesh set includes: determining whether the static mesh is visible in the virtual scene; if it is visible, adding the static mesh to the target mesh set.

[0087] Optionally, the above step of establishing a target base static mesh and a target mesh set corresponding to the target material includes: determining whether the target material corresponding to the static mesh is a preset system material; if not, establishing a target base static mesh and a target mesh set corresponding to the target material.

[0088] Optionally, the above-mentioned static mesh processing instruction is used to indicate a first static mesh among multiple static meshes; based on the multiple static meshes, the step of determining at least one mesh set includes: determining a first basic static mesh and a first material corresponding to the first static mesh; establishing a first mesh set corresponding to the first basic static mesh and the first material; for each static mesh among the multiple static meshes except the first static mesh, determining a target basic static mesh and a target material corresponding to the static mesh; determining whether the target basic static mesh is the same as the first basic static mesh; if they are the same, determining whether the target material is the same as the first material; if they are the same, adding the static mesh to the first mesh set.

[0089] Optionally, the above-mentioned static mesh has a scaling parameter: the scaling parameter is used to indicate the scaling multiple of the static mesh relative to the corresponding base static mesh; before adding the static mesh to the target mesh set, the above-mentioned method includes: determining whether the scaling parameter of the static mesh is a positive number; if not, determining that the static mesh is not to be added to the target mesh set.

[0090] Optionally, the method further includes: responding to a rendering trigger event for the virtual scene, and rendering the hierarchical instantiated static mesh corresponding to the mesh set.

[0091] See also Figure 3 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned static mesh processing method.

[0092] Further, Figure 3 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0093] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0094] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.

[0095] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned static mesh processing method.

[0096] The embodiments of the present disclosure provide a method, device, and electronic device for processing a static mesh, including a computer-readable storage medium storing program code, wherein the program code includes instructions that can be used to execute the methods described in the foregoing method embodiments, for example:

[0097] In response to a static mesh processing instruction, a plurality of static meshes to be processed in a virtual scene are obtained; the static mesh has a corresponding basic static mesh; the static mesh is generated by transforming the corresponding basic static mesh; based on the plurality of static meshes, at least one mesh set is determined; wherein the static meshes in the same mesh set have the same basic static mesh corresponding to them and have the same corresponding materials; and a hierarchical instantiated static mesh corresponding to the mesh set is generated.

[0098] The above method reduces the number of static meshes that need to be rendered successively in the virtual scene, reduces the number of draw calls generated during rendering, and reduces the performance consumption of the device.

[0099] Optionally, the above-mentioned step of determining at least one mesh set based on multiple static meshes includes: traversing multiple static meshes, and performing the following operations for each static mesh: determining the target base static mesh and the target material corresponding to the static mesh; searching for the target mesh set corresponding to the target base static mesh; if not found, establishing a target mesh set corresponding to the target base static mesh and the target material, and adding the static mesh to the target mesh set; if found, determining whether the target material corresponding to the static mesh is the same as the material corresponding to the target mesh set; if they are the same, adding the static mesh to the target mesh set.

[0100] Optionally, the step of adding the static mesh to the target mesh set includes: determining whether the static mesh is visible in the virtual scene; if it is visible, adding the static mesh to the target mesh set.

[0101] Optionally, the above step of establishing a target base static mesh and a target mesh set corresponding to the target material includes: determining whether the target material corresponding to the static mesh is a preset system material; if not, establishing a target base static mesh and a target mesh set corresponding to the target material.

[0102] Optionally, the above-mentioned static mesh processing instruction is used to indicate a first static mesh among multiple static meshes; based on the multiple static meshes, the step of determining at least one mesh set includes: determining a first basic static mesh and a first material corresponding to the first static mesh; establishing a first mesh set corresponding to the first basic static mesh and the first material; for each static mesh among the multiple static meshes except the first static mesh, determining a target basic static mesh and a target material corresponding to the static mesh; determining whether the target basic static mesh is the same as the first basic static mesh; if they are the same, determining whether the target material is the same as the first material; if they are the same, adding the static mesh to the first mesh set.

[0103] Optionally, the above-mentioned static mesh has a scaling parameter: the scaling parameter is used to indicate the scaling multiple of the static mesh relative to the corresponding base static mesh; before adding the static mesh to the target mesh set, the above-mentioned method includes: determining whether the scaling parameter of the static mesh is a positive number; if not, determining that the static mesh is not to be added to the target mesh set.

[0104] Optionally, the method further includes: responding to a rendering trigger event for the virtual scene, and rendering the hierarchical instantiated static mesh corresponding to the mesh set.

[0105] Those skilled in the art can clearly understand that, for the convenience and brevity 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.

[0106] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0107] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. 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, and the computer software product is stored in a storage medium, including a number of instructions to enable 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: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0108] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0109] Finally, it should be noted that the above 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 embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above 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 method for processing a static mesh, characterized in that: The method comprises: In response to a static mesh processing instruction, a plurality of static meshes to be processed in a virtual scene are obtained; the static meshes have corresponding basic static meshes; the static meshes are generated by transforming the corresponding basic static meshes; Based on the multiple static meshes, determining at least one mesh set; wherein the static meshes in the same mesh set correspond to the same basic static meshes and have the same corresponding materials; Generate a hierarchical instanced Static Mesh corresponding to the mesh collection.

2. The method according to claim 1, characterized in that The step of determining at least one mesh set based on the plurality of static meshes comprises: Traverse the multiple static meshes, and perform the following operations on each of the static meshes: Determine a target base static mesh and a target material corresponding to the static mesh; Find a target mesh set corresponding to the target basic static mesh; If not found, create a target mesh set corresponding to the target basic static mesh and the target material, and add the static mesh to the target mesh set; If found, determine whether the target material corresponding to the static mesh is the same as the material corresponding to the target mesh set; If they are the same, add the static mesh to the target mesh set.

3. The method according to claim 2, characterized in that The step of adding the static mesh to the target mesh set comprises: Determining whether the static mesh is visible in the virtual scene; If visible, add the Static Mesh to the target mesh collection.

4. The method according to claim 2, characterized in that: The step of establishing the target base static mesh and the target mesh set corresponding to the target material comprises: Determine whether the target material corresponding to the static mesh is a preset system material; If not, create a target base static mesh and a target mesh set corresponding to the target material.

5. The method according to claim 1, characterized in that The static mesh processing instruction is used to indicate a first static mesh among the plurality of static meshes; The step of determining at least one mesh set based on the plurality of static meshes comprises: Determine a first base static mesh and a first material corresponding to the first static mesh; Creating a first mesh set corresponding to the first base static mesh and the first material; For each of the static meshes except the first static mesh among the plurality of static meshes, determining a target base static mesh and a target material corresponding to the static mesh; Determining whether the target base static mesh is the same as the first base static mesh; If they are the same, determining whether the target material is the same as the first material; If they are the same, add the static mesh to the first mesh set.

6. The method according to claim 2, characterized in that The static mesh has a scaling parameter: the scaling parameter is used to indicate a scaling factor of the static mesh relative to a corresponding base static mesh; Before adding the static mesh to the target mesh set, the method includes: Determining whether a scaling parameter of the static mesh is a positive number; If not, determine that the static mesh is not added to the target mesh set.

7. The method according to claim 1, characterized in that The method further comprises: In response to a rendering trigger event for the virtual scene, the hierarchical instantiated static mesh corresponding to the mesh set is rendered.

8. A static mesh processing device, characterized in that: The device comprises: A static mesh acquisition module, used to respond to a static mesh processing instruction and acquire a plurality of static meshes to be processed in a virtual scene; the static meshes have corresponding basic static meshes; the static meshes are generated by transforming the corresponding basic static meshes; A mesh set determination module, configured to determine at least one mesh set based on the plurality of static meshes; wherein the static meshes in the same mesh set correspond to the same basic static meshes and have the same corresponding materials; The hierarchical instantiation static mesh generation module is used to generate a hierarchical instantiation static mesh corresponding to the mesh set.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the static mesh processing method according to any one of claims 1 to 7.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the static mesh processing method according to any one of claims 1 to 7.