Model rendering method, system and equipment based on subtraction algorithm and storage medium
By classifying the resource models in the game map and adjusting the dynamic details level, the problem of model rendering methods in the existing technology ignore the visual importance and perspective differences, and high picture quality and performance improvements are achieved at different perspectives.
Patent Information
- Application Number
- CN202411274091.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When dealing with complex models in game maps, existing model rendering methods ignore the visual importance of different components inside the model and the significant differences in surrounding viewing angles, resulting in excessive surface reduction of important components in some cases, affecting Screen details and player experience.
Using a method based on the surface reduction algorithm, classify the resource models in the game map, and dynamically adjust the detailed levels of the model according to the scene and perspective changes during the game runtime, and generate multi-level LOD models to ensure high picture quality under different perspectives. .
It effectively reduces the rendering burden of the model, improves game performance, and ensures that players can maintain high picture quality from different perspectives, avoiding unnecessary waste of computing resources.
Smart Images

Figure CN119258528A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of model rendering technology, and in particular to a model rendering method, system, device and storage medium based on a face reduction algorithm. Background Art
[0002] With the rapid development of computer graphics technology, the game industry has increasingly higher requirements for the real-time and realism of graphics rendering. In game development, especially large-scale open games, game maps often contain a large number of complex and detailed model resources, such as buildings, terrain, vegetation, etc. These resource models not only improve the visual experience of the game, but also bring huge computing pressure to the graphics rendering system. However, if the model rendering method directly loads and uses full-precision model resources, the model maintains the same level of detail regardless of the player's perspective or distance, which leads to unnecessary waste of computing resources. Especially when the player is far away from certain models or the models are partially blocked, rendering these models with full precision not only does not help improve the visual effect, but also increases the rendering burden of the system. Therefore, the model rendering method based on level of detail (LOD) has attracted much attention because it can effectively balance model accuracy and rendering performance.
[0003] However, most existing LOD technologies focus on unified LOD processing of the entire model, ignoring the visual importance of different components within the model and the significant differences in surround perspective. This processing method often results in that in some cases, although the LOD of the overall model is optimized, some important or significant components are excessively reduced in surface area, affecting the expression of picture details and player experience. Summary of the invention
[0004] The main purpose of this application is to overcome the shortcomings and deficiencies of the prior art and to provide a model rendering method, system, device and storage medium based on a face reduction algorithm. By classifying the various components in the resource model, the scene during game runtime and the perspective saliency, the detail level of the model is dynamically adjusted to effectively reduce the rendering burden of the model and ensure that the player's gaming experience at different perspectives can maintain high picture quality.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, the present application provides a model rendering method based on a face reduction algorithm, comprising the following steps:
[0007] Get the resource model in the game map;
[0008] Reducing the surface of the resource model by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail;
[0009] Redefine and classify each component in the resource model to obtain a classification result;
[0010] Formulate a multi-level LOD model selection strategy based on the classification results, scenes and perspective changes during game runtime;
[0011] Based on the multi-level LOD model selection strategy, each component in the resource model is rendered.
[0012] As a preferred technical solution, the resource model in the game map includes:
[0013] Through the HeightField node network, the initial terrain basic shape is created according to the preset game map requirements and terrain features; the terrain basic shape includes the overall outline and basic height information of the terrain;
[0014] Based on the basic shape of the terrain, different levels of detail features are added to the terrain by combining noise nodes, Boolean nodes, and deformation nodes to obtain diversified terrain features; the terrain features include mountains, canyons, and plains;
[0015] Based on the terrain features and game requirements, a resource model is created, and appropriate materials and textures are assigned to the resource model.
[0016] As a preferred technical solution, the method of obtaining a resource model in the game map includes obtaining a terrain model, a building model, a character model, and a vegetation model in the game map.
[0017] As a preferred technical solution, the resource model is reduced in surface area by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail, including:
[0018] Setting the initial error threshold, target polygon number and LOD model level number of the resource model;
[0019] Determine the target polygon count or error threshold reduction strategy for each level of LOD model;
[0020] Dividing the resource model into a plurality of regions according to geometric features or visual importance of the resource model;
[0021] In each area, the number of polygons is reduced by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model;
[0022] Adjusting the resource model with the initial face reduction to generate an LOD model of the current level;
[0023] The target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail.
[0024] As a preferred technical solution, the resource model with the initial face reduction is adjusted to generate the LOD model of the current level, including:
[0025] Calculating the folding error of each edge in the resource model of the preliminary face reduction;
[0026] Select the edge with the smallest error to collapse, that is, merge the two vertices of the edge into a new vertex and update the topological structure of the adjacent faces;
[0027] The error value of the affected area is recalculated after each collapse until the target polygon count or error threshold for the current LOD level is reached.
[0028] As a preferred technical solution, the strategy of determining the target polygon number or error threshold reduction for each LOD level includes:
[0029] According to the performance requirements of the resource model and the acceptable level of detail of the resource model, a decreasing factor of the number of polygons or the error threshold from the highest level LOD model to the lowest level LOD model is determined.
[0030] As a preferred technical solution, the target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail, including:
[0031] According to the decrement factor, starting from the target of the LOD model of the current level, the target polygon number or error threshold of each subsequent level LOD model is calculated to obtain a multi-level LOD model with different levels of detail.
[0032] As a preferred technical solution, the redefinition and classification of each component in the resource model to obtain a classification result includes:
[0033] Obtaining each component in the resource model;
[0034] According to the material type, texture complexity, lighting influence and interaction relationship with other components of each component, the components are classified to obtain classification results.
[0035] As a preferred technical solution, a multi-level LOD model selection strategy is formulated according to the classification results, the scene and perspective changes during game operation, including:
[0036] According to the classification result, determining the level of the initial LOD model of each component;
[0037] When the game is running, real-time analysis of the complexity of the current game scene and the data of changes in the player's perspective;
[0038] According to the complexity of the current game scene and the data of the player's perspective change, the visibility of each component in the current game state is evaluated;
[0039] Based on the evaluation results, determine the target level LOD model that the component needs to switch to.
[0040] As a preferred technical solution, determining the target level LOD model to which the component needs to be switched according to the evaluation result includes:
[0041] When the visibility of a component increases and the current level LOD model of the component is not sufficient to provide sufficient details, the level of the LOD model of the component will be increased; conversely, if the visibility of the component decreases, the level of the LOD model will be decreased.
[0042] As a preferred technical solution, the complexity of the current game scene includes the number of components, distribution, lighting complexity, and use of special effects.
[0043] As a preferred technical solution, the data of the player's perspective change includes movement, rotation, scaling of the perspective, and changes in the distance from the player's viewing distance to each component.
[0044] As a preferred technical solution, it also includes:
[0045] A smooth transition strategy is adopted when switching LOD levels to achieve seamless transition during LOD model level switching.
[0046] As a preferred technical solution, a smooth transition strategy is adopted when switching LOD levels to achieve seamless transition during model level switching, including:
[0047] Set the transparency parameter of the current level LOD model to be completely opaque, and the transparency parameter of the target level LOD model to be completely transparent;
[0048] According to the preset transition duration and the difference between the current time and the transition start time, the transparency value of the current level LOD model and the transparency value of the target level LOD model are calculated by linear interpolation;
[0049] Rendering the current level LOD model according to the transparency value of the current level LOD model, and rendering the target level LOD model according to the transparency value of the target level LOD model;
[0050] When the difference between the current time and the transition start time is greater than or equal to the preset transition duration or when the transparency of the current level LOD model reaches full transparency, the transition is considered complete;
[0051] The target level LOD model is set as the current level LOD model, and the target level LOD model transparency is reset to fully opaque, achieving a seamless transition during model level switching.
[0052] In a second aspect, the present application provides a model rendering system based on a face reduction algorithm, which is applied to the model rendering method based on a face reduction algorithm, comprising:
[0053] Obtain resource model module, face reduction module, classification module, strategy formulation module and rendering module;
[0054] The resource model acquisition module is used to acquire the resource model in the game map;
[0055] The face reduction module is used to reduce the face of the resource model by using a face reduction algorithm to generate a multi-level LOD model containing different levels of detail;
[0056] The classification module is used to redefine and classify each component in the resource model to obtain a classification result;
[0057] The strategy formulation module is used to formulate a multi-level LOD model selection strategy according to the classification results, the scene and the perspective changes during the game operation;
[0058] The rendering module is used to render each component in the resource model based on the multi-level LOD model selection strategy.
[0059] As a preferred technical solution, the surface reduction module is specifically used for:
[0060] Setting the initial error threshold, target polygon number and LOD model level number of the resource model;
[0061] Determine the target polygon count or error threshold reduction strategy for each level of LOD model;
[0062] Dividing the resource model into a plurality of regions according to geometric features or visual importance of the resource model;
[0063] In each area, the number of polygons is reduced by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model;
[0064] Adjusting the resource model with the initial face reduction to generate an LOD model of the current level;
[0065] The target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail.
[0066] As a preferred technical solution, the surface reduction module is also specifically used for:
[0067] Calculating the folding error of each edge in the resource model of the preliminary face reduction;
[0068] Select the edge with the smallest error to collapse, that is, merge the two vertices of the edge into a new vertex and update the topological structure of the adjacent faces;
[0069] The error value of the affected area is recalculated after each collapse until the target polygon count or error threshold for the current LOD level is reached.
[0070] As a preferred technical solution, the classification module is specifically used for:
[0071] Obtaining each component in the resource model;
[0072] According to the material type, texture complexity, lighting influence and interaction relationship with other components of each component, the components are classified to obtain classification results.
[0073] In a third aspect, the present application provides an electronic device, the electronic device comprising:
[0074] at least one processor; and,
[0075] a memory communicatively connected to the at least one processor; wherein,
[0076] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can perform the model rendering method based on the face reduction algorithm.
[0077] In a fourth aspect, the present application provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the model rendering method based on the face reduction algorithm.
[0078] In summary, compared with the prior art, the effective effects brought about by the technical solution provided by this application include at least:
[0079] This application proposes a model rendering method based on a face reduction algorithm, which obtains a resource model in a game map; reduces the resource model through a face reduction algorithm to generate a multi-level LOD model containing different levels of detail; redefines and classifies each component in the resource model to obtain a classification result; formulates a multi-level LOD model selection strategy based on the classification result, the scene and perspective changes during game operation; and renders each component in the resource model based on the multi-level LOD model selection strategy. This application introduces a redefinition and classification of each component in the resource model, and fully considers the scene and perspective significance during game operation, so as to formulate a more sophisticated and flexible multi-level LOD model selection strategy. This method can not only effectively reduce the rendering burden of the model and improve game performance, but also dynamically adjust the level of detail of the model according to different scenes and perspective changes, ensuring that the player's gaming experience at different perspectives can maintain a high picture quality effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0081] Figure 1 A flowchart of a model rendering method based on a face reduction algorithm provided in one embodiment of the present application;
[0082] Figure 2 A flow chart of reducing faces by using a face reduction algorithm provided in one embodiment of the present application;
[0083] Figure 3 A flowchart for adjusting a resource model for preliminary face reduction provided in one embodiment of the present application;
[0084] Figure 4 A flowchart of formulating a multi-level LOD model selection strategy provided for an embodiment of the present application;
[0085] Figure 5 A flow chart of a smooth transition strategy provided for one embodiment of the present application;
[0086] Figure 6 A block diagram of a model rendering system based on a face reduction algorithm provided in one embodiment of the present application;
[0087] Figure 7 A structural diagram of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0088] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0089] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0090] In large-scale open games, game maps often contain a large number of complex and detailed model resources, such as buildings, terrain, vegetation, etc. These resource models not only improve the visual experience of the game, but also bring huge computing pressure to the graphics rendering system. However, if the model rendering method directly loads and uses full-precision model resources, the model maintains the same level of detail regardless of the player's perspective or distance, which leads to unnecessary waste of computing resources. Especially when the player is far away from certain models or the models are partially blocked, rendering these models with full precision not only does not help improve the visual effect, but also increases the rendering burden of the system. Therefore, the model rendering method based on the level of detail (LOD) has attracted much attention because it can effectively balance the model accuracy and rendering performance. However, most of the existing LOD technologies focus on unified LOD processing of the entire model, ignoring the visual importance of different components inside the model and the significant differences in the surround perspective. This processing method will cause the key components of the model (such as doors and windows of buildings, key terrain features of the terrain, etc.) to be over-reduced during the rendering process, affecting the visual effect due to insufficient details.
[0091] In order to solve the above technical problems, this application dynamically adjusts the detail level of the model by classifying each component in the resource model, the scene during game operation, and the perspective saliency, thereby effectively reducing the rendering burden of the model and ensuring that the player's gaming experience at different perspectives can maintain a high picture quality.
[0092] The LOD (Level of Detail) model in this application is an important optimization technology in graphics. This technology works by preparing multiple models of different levels of detail for the same object. These models are selected and used under different rendering conditions to achieve a balance between visual effects and rendering performance.
[0093] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0094] See also Figure 1 In one embodiment of the present application, a model rendering method based on a face reduction algorithm is provided, comprising the following steps:
[0095] S1. Get the resource model in the game map.
[0096] Furthermore, the steps of generating the resource model in the game map include:
[0097] (1) Using the HeightField node network in Houdini software, create an initial terrain basic shape according to the preset game map requirements and terrain features; the terrain basic shape includes the overall outline and basic height information of the terrain;
[0098] (2) Based on the basic shape of the terrain, different levels of detail features are added to the terrain by combining noise nodes, Boolean nodes, and deformation nodes to simulate the complexity and diversity of natural terrain, thereby obtaining diverse terrain features; the terrain features include mountains, canyons, plains, etc.
[0099] Furthermore, the terrain with different levels of detail features is further optimized and adjusted, including but not limited to smoothing the edges of the terrain using masks and blur nodes, and adjusting the height, texture and other properties of the terrain according to the game design requirements.
[0100] (3) Based on the terrain features and game requirements, a resource model is created, and appropriate materials and textures are assigned to the resource model to enhance the realism and visual effects of the model.
[0101] Specifically, the resource model in the game map includes obtaining the terrain model, building model, character model, vegetation model and other elements in the game map. In this embodiment, the vegetation models such as trees and grass can be randomly or according to specific rules distributed on the terrain by using Scatter and Instance nodes to form a natural ecological community; the vegetation density, distribution rules and other parameters can also be customized to meet the needs of different game scenes.
[0102] The Houdini software in this embodiment is a powerful programmatic modeling and simulation software. Houdini software can efficiently create and modify complex terrain models through its unique node network system and height field (HeightField) technology. The core of Houdini software is a node-based workflow, and users build complex scenes and effects by connecting different nodes. Each node represents a specific operation or function, such as terrain generation, vegetation distribution, water body simulation, etc. In addition, by adjusting the parameters and connection relationships of the nodes, users can flexibly implement various map editing functions.
[0103] S2. Reducing the surface of the resource model by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail.
[0104] Furthermore, this implementation uses a hybrid face reduction algorithm, that is, combining an edge collapse algorithm based on an error metric and a cluster simplification algorithm to reduce the face of the resource model to generate a multi-level LOD model with different levels of detail; see Figure 2 , the steps include:
[0105] S21, setting the initial error threshold, target polygon number and level number of the LOD model of the resource model;
[0106] S22, determining the target polygon number or error threshold reduction strategy for each level LOD model;
[0107] Furthermore, this embodiment determines the decreasing factor of the number of polygons or the error threshold from the highest level LOD model to the lowest level LOD model according to the performance requirements of the resource model and the acceptability of the details of the resource model.
[0108] S23, dividing the resource model into a plurality of regions according to the geometric features or visual importance of the resource model;
[0109] S24, in each area, reducing the number of polygons by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model;
[0110] Furthermore, a clustering simplification algorithm is first used for preliminary face reduction, which can quickly reduce the complexity of the model and ensure that no key features are lost.
[0111] S25, adjusting the resource model with the initial face reduction to generate an LOD model of the current level;
[0112] S26, adjusting the target number of polygons or the error threshold of the subsequent LOD model level according to the target number of polygons or the error threshold reduction strategy of each level of LOD model, so as to generate a multi-level LOD model with different levels of detail.
[0113] Furthermore, according to the reduction factor, starting from the target of the LOD model of the current level, the above-mentioned process of preliminary face reduction and preliminary face reduction model adjustment is repeated to calculate the target number of polygons or error threshold of each subsequent level LOD model, and finally a multi-level LOD model with different levels of detail is obtained.
[0114] Furthermore, Nmax is defined as the target number of polygons of the highest level LOD model, r is the decreasing factor, which indicates the ratio of the number of polygons from one LOD layer to the next LOD layer; L is the total number of LOD model layers; the number of polygons N of each LOD layer is calculated l It can be calculated by the following formula:
[0115] N L =Nmax×r L
[0116] For example, assuming Nmax = 10000, r = 0.5, L = 1…3, the number of polygons at each level of LOD is: N1 = 10000 × 0.5 1 =5000; N2 = 10000 × 0.5 2 =2500; N3=10000×0.5 3 =1250.
[0117] As the LOD model level decreases, the number of polygons is gradually halved, thereby reducing the complexity of rendering. Specifically, in step S25, the resource model with the initial face reduction is adjusted to generate the LOD model of the current level, see Figure 3 , the steps include:
[0118] S25.1. Calculate the folding error of each edge in the resource model of the preliminary face reduction;
[0119] Furthermore, an error matrix Q is constructed to evaluate the impact of the folding operation on the model shape; the error matrix Q is a symmetric matrix that represents the local geometric properties of the vertices on both sides of the folded edge.
[0120] The folding error Δ can be estimated by calculating the quadratic distance between the new vertex position after folding and the original vertex position, that is, Δ = v T Qv, where v is the displacement vector from the original vertex to the new vertex.
[0121] The folding error takes into account factors such as the position of the edge, the size and shape of the adjacent faces, and other factors to calculate an error value that can reflect the degree of influence of folding the edge on the shape of the model.
[0122] S25.2, select the edge with the smallest error to fold, that is, merge the two vertices of the edge into a new vertex, and update the topological structure of the adjacent faces;
[0123] S25.3. Recalculate the error value of the affected area after each fold until the target number of polygons or the error threshold of the current LOD level is reached.
[0124] By adjusting the error threshold and target polygon count, the degree of detail at different LOD levels can be flexibly controlled to suit different rendering requirements and performance constraints.
[0125] This embodiment uses a combination of an edge collapse algorithm based on error metrics and a cluster simplification algorithm to reduce the face of the resource model, which can reduce the number of polygons while maintaining the visual quality of the model, helping to maintain the realism and immersion of the game.
[0126] S3, redefine and classify each component in the resource model to obtain a classification result;
[0127] Furthermore, each component in the resource model is redefined and classified, and the steps include:
[0128] Obtain each component in the resource model; for example, the terrain model includes forests, deserts, waters, bridges, tunnels and other components; the vegetation model includes trees, flowers, bushes and other components; the role model includes the role played by the player in the game, the challenge objects that the player needs to face in the game and other components.
[0129] According to the material type, texture complexity, lighting influence and interaction relationship of each component with other components, the components are classified to obtain classification results. According to the classification results of the components, components with similar characteristics and importance are assigned to the same LOD model level. For example, components with high texture complexity and high lighting influence may need to maintain high details in a closer LOD level.
[0130] S4. Formulate a multi-level LOD model selection strategy based on the classification results, scenes during game runtime, and changes in viewing angles.
[0131] For further information, see Figure 4 ,According to the classification results, the scene and perspective changes during game runtime, the steps of formulating a multi-level LOD model selection strategy include:
[0132] S41, determining the level of the initial LOD model of each component according to the classification result;
[0133] Furthermore, based on the classification results, the level of the initial LOD model of each component is determined, and this level is intended to provide a reasonable balance between visual quality and performance at the beginning of the game.
[0134] S42, when the game is running, real-time analysis of the complexity of the current game scene and the data of the player's perspective change;
[0135] Furthermore, when the game is running, real-time analysis of the complexity of the current game scene and the data of changes in the player's perspective is a key link in improving the gaming experience, optimizing performance and resource allocation; this is not only about visual enjoyment, but also directly affects the smoothness and response speed of the game. Specifically, the complexity of the current game scene includes the number of components, distribution, lighting complexity, and the use of special effects. For example, in a large open world game, the number of components increases significantly when switching from a quiet countryside to a bustling city, such as the density of buildings, vehicles, and pedestrians; this places higher demands on the rendering engine.
[0136] The data of the player's perspective change includes the movement, rotation, and scaling of the perspective, as well as the change in the distance from the player's viewing distance to each component.
[0137] S43. Evaluate the visibility of each component in the current game state according to the complexity of the current game scene and the data of the player's perspective change.
[0138] S44. According to the evaluation result, determine the target level LOD model that the component needs to switch to.
[0139] Furthermore, when the visibility of a component increases and the current level LOD model of the component is insufficient to provide sufficient details, the level of the LOD model of the component will be increased; conversely, if the visibility of the component decreases, the level of the LOD model will be decreased.
[0140] In the game, as the distance between the player and the scene or object changes, the system needs to automatically switch LOD models with different detail levels. If this switching is not smooth enough, a "jump" phenomenon may occur, affecting the player's visual experience. Therefore, in this embodiment, it also includes:
[0141] A smooth transition strategy is used when switching LOD levels to achieve seamless transition during LOD model level switching. Figure 5 , the steps include:
[0142] S44.1. Set the transparency parameter of the current level LOD model to be completely opaque, and the transparency parameter of the target level LOD model to be completely transparent;
[0143] S44.2. Calculate the transparency value of the current level LOD model and the transparency value of the target level LOD model by linear interpolation according to the preset transition duration and the difference between the current time and the transition start time;
[0144] Furthermore, the transparency value of the current level LOD model and the transparency value of the target level LOD model may be calculated by using the easing function.
[0145] S44.3, rendering the current level LOD model according to the transparency value of the current level LOD model, and rendering the target level LOD model according to the transparency value of the target level LOD model;
[0146] S44.4. When the difference between the current time and the transition start time is greater than or equal to the preset transition duration or when the transparency of the current level LOD model reaches full transparency, the transition is considered complete;
[0147] S44.5. Set the target level LOD model as the current level LOD model, and reset the target level LOD model transparency to completely opaque, thereby achieving a seamless transition during model level switching.
[0148] S5. Rendering each component in the resource model based on the multi-level LOD model selection strategy.
[0149] In summary, the model rendering method based on the face reduction algorithm of the present application first obtains the resource model in the game map, and generates a multi-level LOD model containing different levels of detail by combining the face reduction algorithm based on the error metric edge collapse algorithm and the cluster simplification algorithm. It can reduce the number of polygons while maintaining the visual quality of the model, which helps to maintain the realism and immersion of the game. Then, the classification of each component in the resource model is redefined to obtain the classification result. Next, according to the classification results and the scene and perspective changes during the game runtime, the level of detail of the model is dynamically adjusted; finally, based on this strategy, the various components in the resource model are refined and rendered, which can not only effectively reduce the rendering burden of the model and improve the game performance, but also can dynamically adjust the level of detail of the model according to different scenes and perspective changes, ensuring that the player's game experience at different perspectives can maintain high-quality picture effects. In addition, during the switching process, the present application adopts a smooth transition strategy to achieve seamless transition during the LOD model level switching process, ensuring that the switching process between different LOD models is as smooth as possible to avoid visual abruptness.
[0150] It should be noted that, for the sake of convenience of description, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously.
[0151] Based on the same idea as the model rendering method based on the face reduction algorithm in the above-mentioned embodiment, the present application also provides a model rendering system based on the face reduction algorithm, which can be used to execute the above-mentioned model rendering method based on the face reduction algorithm. For ease of explanation, the structural schematic diagram of the embodiment of the model rendering system based on the face reduction algorithm only shows the parts related to the embodiment of the present application. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the system, and may include more or fewer components than the illustrated one, or combine certain components, or arrange the components differently.
[0152] See also Figure 6 In another embodiment of the present application, a model rendering system based on a face reduction algorithm is provided, the system comprising a resource model acquisition module 101, a face reduction module 102, a classification module 103, a strategy formulation module 104 and a rendering module 105;
[0153] The resource model acquisition module 101 is used to acquire the resource model in the game map;
[0154] The face reduction module 102 is used to reduce the face of the resource model by using a face reduction algorithm to generate a multi-level LOD model containing different levels of detail;
[0155] The classification module 103 is used to redefine and classify each component in the resource model to obtain a classification result;
[0156] The strategy formulation module 104 is used to formulate a multi-level LOD model selection strategy according to the classification results, the scene and the perspective changes during the game operation;
[0157] The rendering module 105 is used to render each component in the resource model based on the multi-level LOD model selection strategy.
[0158] As a preferred technical solution, it also includes creating a resource model module, and the resource model creation module is used to:
[0159] Through the HeightField node network, the initial terrain basic shape is created according to the preset game map requirements and terrain features; the terrain basic shape includes the overall outline and basic height information of the terrain;
[0160] Based on the basic shape of the terrain, different levels of detail features are added to the terrain by combining noise nodes, Boolean nodes, and deformation nodes to obtain diversified terrain features; the terrain features include mountains, canyons, and plains;
[0161] Based on the terrain features and game requirements, a resource model is created, and appropriate materials and textures are assigned to the resource model.
[0162] Furthermore, the resource model includes obtaining a terrain model, a building model, a character model, and a vegetation model in a game map.
[0163] As a preferred technical solution, the surface reduction module 102 is specifically used for:
[0164] Setting the initial error threshold, target polygon number and LOD model level number of the resource model;
[0165] Determine the target polygon count or error threshold reduction strategy for each level of LOD model;
[0166] Dividing the resource model into a plurality of regions according to geometric features or visual importance of the resource model;
[0167] In each area, the number of polygons is reduced by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model;
[0168] Adjusting the resource model with the initial face reduction to generate an LOD model of the current level;
[0169] The target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail.
[0170] As a preferred technical solution, the surface reduction module 102 is also specifically used for:
[0171] Calculating the folding error of each edge in the resource model of the preliminary face reduction;
[0172] Select the edge with the smallest error to collapse, that is, merge the two vertices of the edge into a new vertex and update the topological structure of the adjacent faces;
[0173] The error value of the affected area is recalculated after each collapse until the target polygon count or error threshold for the current LOD level is reached.
[0174] As a preferred technical solution, a target polygon number or error threshold reduction strategy for each LOD level is determined, including a reduction factor module, wherein the reduction factor module is used to:
[0175] According to the performance requirements of the resource model and the acceptable level of detail of the resource model, a decreasing factor of the number of polygons or the error threshold from the highest level LOD model to the lowest level LOD model is determined.
[0176] As a preferred technical solution, the decrement factor module is also specifically used for:
[0177] According to the decrement factor, starting from the target of the LOD model of the current level, the target polygon number or error threshold of each subsequent level LOD model is calculated to obtain a multi-level LOD model with different levels of detail.
[0178] As a preferred technical solution, the classification module 103 is specifically used to: obtain each component in the resource model;
[0179] According to the material type, texture complexity, lighting influence and interaction relationship with other components of each component, the components are classified to obtain classification results.
[0180] As a preferred technical solution, the strategy formulation module 104 is specifically used for:
[0181] According to the classification result, determining the level of the initial LOD model of each component;
[0182] When the game is running, real-time analysis of the complexity of the current game scene and the data of changes in the player's perspective;
[0183] According to the complexity of the current game scene and the data of the player's perspective change, the visibility of each component in the current game state is evaluated;
[0184] Based on the evaluation results, determine the target level LOD model that the component needs to switch to.
[0185] When the visibility of a component increases and the current level LOD model of the component is not sufficient to provide sufficient details, the level of the LOD model of the component will be increased; conversely, if the visibility of the component decreases, the level of the LOD model will be decreased.
[0186] As a preferred technical solution, the complexity of the current game scene includes the number of components, distribution, lighting complexity, and use of special effects.
[0187] The data of the player's perspective change includes the movement, rotation, and scaling of the perspective, as well as the change in the distance from the player's viewing distance to each component.
[0188] As a preferred technical solution, a smooth transition module is also included, and the smooth transition module is used to:
[0189] Set the transparency parameter of the current level LOD model to be completely opaque, and the transparency parameter of the target level LOD model to be completely transparent;
[0190] According to the preset transition duration and the difference between the current time and the transition start time, the transparency value of the current level LOD model and the transparency value of the target level LOD model are calculated by linear interpolation;
[0191] Rendering the current level LOD model according to the transparency value of the current level LOD model, and rendering the target level LOD model according to the transparency value of the target level LOD model;
[0192] When the difference between the current time and the transition start time is greater than or equal to the preset transition duration or when the transparency of the current level LOD model reaches full transparency, the transition is considered complete;
[0193] The target level LOD model is set as the current level LOD model, and the target level LOD model transparency is reset to fully opaque, achieving a seamless transition during model level switching.
[0194] It should be noted that the model rendering system based on the surface reduction algorithm of the present application corresponds one to one with the model rendering method based on the surface reduction algorithm of the present application. The technical features and beneficial effects described in the embodiment of the model rendering method based on the surface reduction algorithm are applicable to the embodiment of the model rendering system based on the surface reduction algorithm. For specific contents, please refer to the description in the embodiment of the method of the present application. It will not be repeated here. This is hereby declared.
[0195] In addition, in the implementation of the model rendering system based on the surface reduction algorithm in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the model rendering system based on the surface reduction algorithm is divided into different program modules to complete all or part of the functions described above.
[0196] See also Figure 7 In another embodiment, an electronic device for implementing a model rendering method based on a face reduction algorithm is provided, including a processor, a memory, and a bus, and may also include a computer program stored in the memory and executable on the processor.
[0197] Exemplarily, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more module elements may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the device.
[0198] The electronic device may be a computing device such as a desktop computer, a notebook, a palm computer, a cloud server, etc. The device may include, but is not limited to, a processor and a memory.
[0199] In some embodiments, the processor may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center (Control Unit) of the device, and uses various interfaces and lines to connect the various components of the entire device; by running or executing the program or module stored in the memory, and calling the data stored in the memory, the various functions of the electronic device and the processing data are executed.
[0200] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; in addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0201] Wherein, the memory may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the memory may also include both an internal storage unit of the electronic device and an external storage device. The memory may be used not only to store application software and various types of data installed in the electronic device, such as the code of a model rendering program based on a face reduction algorithm, but also to temporarily store data that has been output or is to be output.
[0202] Figure 7 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0203] The model rendering program based on the face reduction algorithm stored in the memory of the electronic device is a combination of multiple instructions, and when running in the processor, it can achieve:
[0204] Get the resource model in the game map;
[0205] Reducing the surface of the resource model by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail;
[0206] Redefine and classify each component in the resource model to obtain a classification result;
[0207] Formulate a multi-level LOD model selection strategy based on the classification results, scenes and perspective changes during game runtime;
[0208] Based on the multi-level LOD model selection strategy, each component in the resource model is rendered.
[0209] Accordingly, the present application also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the model rendering method based on the face reduction algorithm as described in any one of the above embodiments.
[0210] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), flash memory, mobile hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
[0211] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0212] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0213] The above embodiments are preferred implementation modes of the present application, but the implementation modes of the present application are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present application should be equivalent replacement methods and are included in the protection scope of the present application.
Claims
1. A model rendering method based on a face reduction algorithm, characterized in that: The steps include: Get the resource model in the game map; Reducing the surface of the resource model by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail; Redefine and classify each component in the resource model to obtain a classification result; Formulate a multi-level LOD model selection strategy based on the classification results, scenes and perspective changes during game runtime; Based on the multi-level LOD model selection strategy, each component in the resource model is rendered.
2. The model rendering method based on the face reduction algorithm according to claim 1, characterized in that: The resource model in the game map includes: Through the HeightField node network, the initial terrain basic shape is created according to the preset game map requirements and terrain features; the terrain basic shape includes the overall outline and basic height information of the terrain; Based on the basic shape of the terrain, different levels of detail features are added to the terrain by combining noise nodes, Boolean nodes, and deformation nodes to obtain diversified terrain features; the terrain features include mountains, canyons, and plains; Based on the terrain features and game requirements, a resource model is created, and appropriate materials and textures are assigned to the resource model.
3. The model rendering method based on the face reduction algorithm according to claim 1, characterized in that: The obtaining of resource models in the game map includes obtaining a terrain model, a building model, a character model, and a vegetation model in the game map.
4. The model rendering method based on the face reduction algorithm according to claim 1, characterized in that: The resource model is reduced in surface area by using a surface reduction algorithm to generate a multi-level LOD model containing different levels of detail, including: Setting the initial error threshold, target polygon number and LOD model level number of the resource model; Determine the target polygon count or error threshold reduction strategy for each level of LOD model; Dividing the resource model into a plurality of regions according to geometric features or visual importance of the resource model; In each area, the number of polygons is reduced by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model; Adjusting the resource model with the initial face reduction to generate an LOD model of the current level; The target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail.
5. The model rendering method based on the face reduction algorithm according to claim 4, characterized in that: The step of adjusting the resource model with the initial face reduction to generate the LOD model of the current level includes: Calculating the folding error of each edge in the resource model of the preliminary face reduction; Select the edge with the smallest error to collapse, that is, merge the two vertices of the edge into a new vertex and update the topological structure of the adjacent faces; The error value of the affected area is recalculated after each collapse until the target polygon count or error threshold for the current LOD level is reached.
6. The model rendering method based on the face reduction algorithm according to claim 4, characterized in that: The target polygon count or error threshold reduction strategy for each LOD level is determined, including: According to the performance requirements of the resource model and the acceptable level of detail of the resource model, a decreasing factor of the number of polygons or the error threshold from the highest level LOD model to the lowest level LOD model is determined.
7. The model rendering method based on the face reduction algorithm according to claim 6, characterized in that: The method of adjusting the target polygon number or error threshold of the subsequent LOD model level according to the target polygon number or error threshold reduction strategy of each level LOD model, thereby generating a multi-level LOD model with different levels of detail, includes: According to the decrement factor, starting from the target of the LOD model of the current level, the target polygon number or error threshold of each subsequent level LOD model is calculated to obtain a multi-level LOD model with different levels of detail.
8. The model rendering method based on the face reduction algorithm according to claim 1, characterized in that: The redefining and classifying each component in the resource model to obtain a classification result includes: Obtaining each component in the resource model; According to the material type, texture complexity, lighting influence and interaction relationship with other components of each component, the components are classified to obtain classification results.
9. The model rendering method based on the face reduction algorithm according to claim 1, characterized in that: The method of formulating a multi-level LOD model selection strategy based on the classification results, the scene and the perspective changes during the game operation includes: According to the classification result, determining the level of the initial LOD model of each component; When the game is running, real-time analysis of the complexity of the current game scene and the data of changes in the player's perspective; According to the complexity of the current game scene and the data of the player's perspective change, the visibility of each component in the current game state is evaluated; Based on the evaluation results, determine the target level LOD model that the component needs to switch to.
10. The model rendering method based on the face reduction algorithm according to claim 9, characterized in that: Determining the target level LOD model to which the component needs to be switched based on the evaluation result includes: When the visibility of a component increases and the current level LOD model of the component is not sufficient to provide sufficient details, the level of the LOD model of the component will be increased; conversely, if the visibility of the component decreases, the level of the LOD model will be decreased.
11. The model rendering method based on the face reduction algorithm according to claim 9, characterized in that: The complexity of the current game scene includes the number of components, distribution, lighting complexity, and use of special effects.
12. The model rendering method based on the face reduction algorithm according to claim 9, characterized in that: The data of the player's perspective change includes the movement, rotation, and scaling of the perspective, as well as the change in the distance from the player's viewing distance to each component.
13. The model rendering method based on the face reduction algorithm according to claim 9, characterized in that: Also includes: A smooth transition strategy is adopted when switching LOD levels to achieve seamless transition during LOD model level switching.
14. The model rendering method based on the face reduction algorithm according to claim 13, characterized in that: The smooth transition strategy is adopted when switching the LOD level to achieve seamless transition during the model level switching process, including: Set the transparency parameter of the current level LOD model to be completely opaque, and the transparency parameter of the target level LOD model to be completely transparent; According to the preset transition duration and the difference between the current time and the transition start time, the transparency value of the current level LOD model and the transparency value of the target level LOD model are calculated by linear interpolation; Rendering the current level LOD model according to the transparency value of the current level LOD model, and rendering the target level LOD model according to the transparency value of the target level LOD model; When the difference between the current time and the transition start time is greater than or equal to the preset transition duration or when the transparency of the current level LOD model reaches full transparency, the transition is considered complete; The target level LOD model is set as the current level LOD model, and the target level LOD model transparency is reset to fully opaque, achieving a seamless transition during model level switching.
15. A model rendering system based on a face reduction algorithm, characterized in that: A model rendering method based on a face reduction algorithm applied to any one of claims 1 to 14, comprising a resource model acquisition module, a face reduction module, a classification module, a strategy formulation module, and a rendering module; The resource model acquisition module is used to acquire the resource model in the game map; The face reduction module is used to reduce the face of the resource model by using a face reduction algorithm to generate a multi-level LOD model containing different levels of detail; The classification module is used to redefine and classify each component in the resource model to obtain a classification result; The strategy formulation module is used to formulate a multi-level LOD model selection strategy according to the classification results, the scene and the perspective changes during the game operation; The rendering module is used to render each component in the resource model based on the multi-level LOD model selection strategy.
16. The model rendering system based on the face reduction algorithm according to claim 15, characterized in that: The surface reduction module is specifically used for: Setting the initial error threshold, target polygon number and LOD model level number of the resource model; Determine the target polygon count or error threshold reduction strategy for each level of LOD model; Dividing the resource model into a plurality of regions according to geometric features or visual importance of the resource model; In each area, the number of polygons is reduced by merging vertices and deleting unnecessary faces or edges to obtain a preliminary reduced-face resource model; Adjusting the resource model with the initial face reduction to generate an LOD model of the current level; The target polygon number or error threshold of the subsequent LOD model level is adjusted according to the target polygon number or error threshold reduction strategy of each level LOD model, so as to generate a multi-level LOD model with different levels of detail.
17. The model rendering system based on the face reduction algorithm according to claim 16, characterized in that: The surface reduction module is also specifically used for: Calculating the folding error of each edge in the resource model of the preliminary face reduction; Select the edge with the smallest error to collapse, that is, merge the two vertices of the edge into a new vertex and update the topological structure of the adjacent faces; The error value of the affected area is recalculated after each collapse until the target polygon count or error threshold for the current LOD level is reached.
18. The model rendering system based on the face reduction algorithm according to claim 15, characterized in that: The classification module is specifically used for: Obtaining each component in the resource model; According to the material type, texture complexity, lighting influence and interaction relationship with other components of each component, the components are classified to obtain classification results.
19. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the model rendering method based on the face reduction algorithm as described in any one of claims 1-14.
20. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the model rendering method based on the face reduction algorithm described in any one of claims 1 to 14 is implemented.
Citation Information
Patent Citations
Multi-scale level of detail-based simulation method
CN101877142A
Scene rendering method and device, computer readable storage medium and computer equipment
CN111105491A
Three-dimensional tree model real-time simplification method based on viewpoint mutual information
CN111462318A
Three-dimensional model multi-level LOD generation method based on surface reduction algorithm
CN113781642A
Resource rendering method and device
CN115228083A
Cited By
Large-scale scene area reduction optimization method, device and equipment based on clustering algorithm
CN120472115A