Real-time rendering optimization method and system in meta universe scene building engine
By building a spatial octree structure in the metaverse scene construction engine, occlusion and dynamic merging of material instances, the problems of inefficient rendering efficiency and inflexible material management in the existing technology are solved, and more efficient rendering performance and better user experience are achieved.
Patent Information
- Application Number
- CN202510429171.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-04-08
AI Technical Summary
The existing technology has problems such as inefficiency in real-time rendering optimization in the metaverse scene construction engine, inadequate occlusion culling, and lack of flexibility in material instance management, resulting in degradation in rendering performance and poor user experience.
By building a spatial octree structure and traversing from top to bottom recursively, nodes not within the view cone are eliminated, the occlusion coefficient is calculated for occlusion removal, and the detail level is determined based on the distance from the center of the enclosure box to the viewpoint for simplification. At the same time, divide the rendering batches and establish a material instance cache pool based on material similarity, and dynamically merge material instances.
Improve rendering efficiency, optimize the rendering process, reduce the rendering burden, improve the overall rendering performance and resource utilization, and improve the user experience.
Smart Images

Figure CN119941956A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to metaverse technology, and in particular to a real-time rendering optimization method and system in a metaverse scene building engine. Background Art
[0002] In recent years, with the rapid development of virtual reality and augmented reality technologies, the concept of the metaverse has gradually become a hot topic. As a virtual shared space, the metaverse can provide users with an immersive experience, attracting more and more developers and companies to invest resources in scene construction and content creation. In order to achieve high-quality real-time rendering, developers need efficient rendering optimization methods to ensure that various objects can be displayed smoothly in complex three-dimensional scenes.
[0003] The existing technology has some defects and deficiencies in real-time rendering optimization in the Metaverse scene building engine. First, traditional rendering methods often cannot effectively manage a large number of scene objects when dealing with complex scenes, resulting in low rendering efficiency and affecting user experience. Secondly, existing occlusion culling techniques usually rely on simple bounding box judgments, lack in-depth analysis of occlusion information, and easily lead to unnecessary rendering overhead. Finally, the management and merging process of material instances often lacks flexibility and cannot be dynamically adjusted according to changes in the actual scene, resulting in waste of resources and decreased rendering performance.
[0004] Therefore, it is particularly important to develop an efficient real-time rendering optimization method to address these issues in order to improve the performance and user experience of the Metaverse scene building engine. Summary of the invention
[0005] The embodiments of the present invention provide a real-time rendering optimization method and system in a metaverse scene building engine, which can solve the problems in the prior art.
[0006] A first aspect of an embodiment of the present invention provides a real-time rendering optimization method in a metaverse scene building engine, comprising: Obtaining three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data, and lighting data of scene objects; Based on the three-dimensional scene data, construct a spatial octree structure of the scene object, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; According to the user's viewpoint position information, recursively traverse each node from top to bottom in the spatial octree structure, determine whether the bounding box of each node is within the view frustum, and directly prune the nodes outside the view frustum; for the nodes within the view frustum, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; and determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate scene object geometry data after detail level simplification; Dividing the scene object geometric data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; A material instance cache pool based on material similarity is established for scene objects in each rendering batch. Material instances are dynamically merged according to the degree of change of material properties, and multiple materials whose material property similarity is higher than the set similarity threshold are merged into one material instance.
[0007] Based on the three-dimensional scene data, constructing a spatial octree structure of the scene object, and recording the bounding box information and occlusion information of the scene object corresponding to each node of the spatial octree structure includes: Calculating the overall boundary range of the scene based on the geometric data of the scene object, determining the minimum vertex coordinates and the maximum vertex coordinates of the scene bounding box, constructing the root node space of the octree, and mapping the scene object to the root node space according to its position information; Traversing the scene objects in the root node space, when the number of scene objects contained in the node exceeds the preset segmentation threshold, evenly dividing the node space into 8 sub-node spaces, and reallocating the scene objects in the node to the corresponding sub-node spaces according to the position information; recursively executing the above space division process until the number of scene objects in all nodes does not exceed the preset segmentation threshold; Traverse all nodes of the octree from top to bottom: for each node, calculate the axial bounding box information of the node, including the minimum vertex coordinates and the maximum vertex coordinates; calculate the surface area occlusion ratio of the node: obtained by calculating the ratio of the area of the node surface occluded by other scene objects to the total surface area of the node; project the node onto six orthogonal planes to form a depth occlusion map, and record the maximum depth value of each projected pixel position.
[0008] For a node within the view frustum, the occlusion coefficient is calculated based on the occlusion information of the node. When the occlusion coefficient is greater than a preset occlusion threshold, occlusion culling is performed, including: For the nodes within the viewing cone, calculate their comprehensive occlusion coefficient: Based on the depth occlusion map of six orthogonal projection directions, the visibility of each projection surface is calculated in combination with the current viewing angle, and the distance from the node to the viewpoint is calculated to obtain the view distance attenuation factor; the visibility and the view distance attenuation factor are weighted and combined according to a preset weight coefficient to obtain a comprehensive occlusion coefficient of the node; Build an adaptive occlusion threshold adjustment mechanism: Based on the target frame rate set by the system, obtain the actual frame rate of the current rendering and calculate the ratio of the two; multiply the ratio by the preset adjustment coefficient as the dynamic adjustment factor, and multiply it by the basic occlusion threshold to obtain the dynamic occlusion threshold of the current frame; Perform occlusion judgment on each node in the processing node set: compare the comprehensive occlusion coefficient of each node with the currently calculated dynamic occlusion threshold. When the comprehensive occlusion coefficient of the node is greater than the dynamic occlusion threshold, mark the node as occluded, add it to the occlusion culling list, and perform occlusion culling.
[0009] The node's level of detail is determined based on the distance from the node's bounding box center to the viewpoint, and the generated scene object geometry data after level of detail simplification includes: Calculate the distance from the center of the bounding box to the current viewpoint, and determine the node's level of detail based on the ratio of the distance to the node's base size. Specifically, take the base 2 logarithm of the ratio and round it down to get the level of detail. For nodes with a certain level of detail, calculate their simplification rate: use 2 raised to the power of the node level as the denominator to get the target simplification ratio; based on the target simplification ratio, calculate the folding cost of the mesh edge, where the folding cost includes a weighted combination of the geometric error metric and the attribute error metric; Prioritize edges according to their folding costs, and perform edge folding operations step by step according to the preset simplification ratio: first fold the edges with the smallest folding costs, update the positions and attribute information of adjacent vertices, and continue to perform edge folding until the target simplification rate is reached, generating scene object geometry data after detail level simplification.
[0010] A material instance cache pool based on material similarity is established for each scene object in each rendering batch. Material instances are dynamically merged according to the degree of change of material properties. Multiple materials with material property similarity higher than the set similarity threshold are merged into one material instance, including: Acquire material data of scene objects in a rendering batch, perform feature extraction on the material data, and construct a feature vector space; establish a material descriptor index tree based on the feature vector space, and the material descriptor index tree is used for rapid retrieval and matching of materials; Calculating the similarity between materials based on the material descriptor index tree: for non-texture attributes, directly calculating the Euclidean distance of the attribute value; for texture attributes, obtaining the texture similarity by calculating the normalized difference of the texture pixel value; performing weighted combination of the similarities of the various attributes to obtain the comprehensive similarity value between the material pairs; Divide the materials into multiple groups based on the comprehensive similarity value, construct a reference relationship graph of material instances in each material group, and record the association information of each material instance referenced by the scene object; perform hierarchical clustering on each material group again to generate an optimal merge sequence; Material instance merging is performed according to the optimal merging sequence: merged material parameters are calculated based on the attribute values of each instance in the material group, non-texture parameters are obtained by weighted averaging, and texture parameters are generated by mixed sampling; the material reference relationship of the scene object is updated, and the reference of the original material instance is pointed to the merged new material instance.
[0011] Dividing the materials into multiple groups based on the comprehensive similarity value, constructing a reference relationship graph of the material instances in each material group, and recording the associated information of each material instance being referenced by the scene object; performing hierarchical clustering on each material group again to generate an optimal merge sequence includes: Constructing a bipartite graph structure of a material group, the bipartite graph structure comprising a material instance vertex set and a scene object vertex set, and establishing a reference relationship edge set between the material instance vertex set and the scene object vertex set; Calculating the reference weight in the bipartite graph structure, calculating the area ratio of a single material instance referenced by a single scene object according to the used area of each material instance on the surface of the scene object, and using the area ratio as the weight value of the reference relationship; Building a hierarchical clustering tree based on the bipartite graph structure, and calculating a distance metric value for each pair of material clusters, wherein the distance metric value is obtained by calculating the average distance between all material pairs in the two material clusters; The material similarity, reference relationship overlap and rendering cost are used as evaluation indicators, and the three evaluation indicators are weighted and combined to obtain the combined evaluation score between material cluster pairs. The material cluster pairs whose merging evaluation scores are higher than a preset evaluation threshold are inserted into a priority queue in descending order of scores; and the material cluster pair with the highest score is extracted from the priority queue as the optimal merging object.
[0012] A second aspect of an embodiment of the present invention provides a real-time rendering optimization system in a metaverse scene building engine, including: The first unit is used to obtain three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data and lighting data of scene objects; A second unit is used to construct a spatial octree structure of the scene object based on the three-dimensional scene data, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; The third unit is used to recursively traverse each node from top to bottom in the spatial octree structure according to the user viewpoint position information, determine whether the bounding box of each node is within the view frustum, and directly prune the nodes outside the view frustum; for the nodes within the view frustum, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; and determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate scene object geometry data after the detail level is simplified; A fourth unit, configured to divide the scene object geometry data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; The fifth unit is used to establish a material instance cache pool based on material similarity for scene objects in each rendering batch, dynamically merge material instances according to the degree of change of material properties, and merge multiple materials whose material property similarity is higher than a set similarity threshold into one material instance.
[0013] A third aspect of the embodiments of the present invention An electronic device is provided, comprising: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0014] A fourth aspect of the embodiments of the present invention is: A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0015] The beneficial effects of this application are as follows: The beneficial effects of the present invention are mainly reflected in the following three aspects: By constructing a spatial octree structure and performing a top-down recursive traversal, the nodes that are not within the view frustum can be effectively pruned, thereby reducing the number of scene objects to be rendered and improving rendering efficiency; calculating the occlusion coefficient based on occlusion information and performing occlusion culling can further optimize the rendering process, avoid invalid rendering calculations, and improve the real-time and smoothness of scene rendering; by simplifying the level of detail of the scene object geometric data and dynamically merging material instances, the rendering burden can be reduced while ensuring the visual effect, thereby improving the overall rendering performance and resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of the process of a real-time rendering optimization method in a metaverse scene building engine according to an embodiment of the present invention; Figure 2 This is a schematic diagram comparing the efficiency of occlusion culling by different methods; Figure 3 This is a table comparing the efficiency of occlusion culling by different methods; Figure 4 Diagram of the system interface for material instance merging. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0019] Figure 1 Schematic diagram of the process of the real-time rendering optimization method in the Metaverse scene building engine according to an embodiment of the present invention. Figure 1 As shown, the method includes: Obtaining three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data, and lighting data of scene objects; Based on the three-dimensional scene data, construct a spatial octree structure of the scene object, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; According to the user's viewpoint position information, recursively traverse each node from top to bottom in the spatial octree structure, determine whether the bounding box of each node is within the view frustum, and directly prune the nodes outside the view frustum; for the nodes within the view frustum, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; and determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate scene object geometry data after detail level simplification; Dividing the scene object geometric data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; A material instance cache pool based on material similarity is established for scene objects in each rendering batch. Material instances are dynamically merged according to the degree of change of material properties, and multiple materials whose material property similarity is higher than the set similarity threshold are merged into one material instance.
[0020] In an optional implementation, constructing a spatial octree structure of a scene object based on the three-dimensional scene data, and recording bounding box information and occlusion information of the scene object corresponding to each node of the spatial octree structure includes: Calculating the overall boundary range of the scene based on the geometric data of the scene object, determining the minimum vertex coordinates and the maximum vertex coordinates of the scene bounding box, constructing the root node space of the octree, and mapping the scene object to the root node space according to its position information; Traversing the scene objects in the root node space, when the number of scene objects contained in the node exceeds the preset segmentation threshold, evenly dividing the node space into 8 sub-node spaces, and reallocating the scene objects in the node to the corresponding sub-node spaces according to the position information; recursively executing the above space division process until the number of scene objects in all nodes does not exceed the preset segmentation threshold; Traverse all nodes of the octree from top to bottom: for each node, calculate the axial bounding box information of the node, including the minimum vertex coordinates and the maximum vertex coordinates; calculate the surface area occlusion ratio of the node: obtained by calculating the ratio of the area of the node surface occluded by other scene objects to the total surface area of the node; project the node onto six orthogonal planes to form a depth occlusion map, and record the maximum depth value of each projected pixel position.
[0021] Specifically, all objects in the scene are traversed to obtain the vertex coordinate data of each object. For a scene containing 1000 three-dimensional models, each model may contain hundreds to thousands of vertices. By comparing the coordinate values of all vertices, the minimum vertex coordinates and the maximum vertex coordinates of the entire scene are determined. For example, in a city scene, the minimum vertex coordinate may be (-500, -500, 0) and the maximum vertex coordinate may be (500, 500, 100), representing a space range of 1000×1000×100 cubic meters. Based on these two coordinate values, an axial bounding box is constructed as the root node space of the octree, and all scene objects are mapped to the root node space according to their position information.
[0022] Set the preset segmentation threshold to 10, that is, when a node contains more than 10 scene objects, the node space is evenly divided into 8 sub-node spaces. The division method is to divide the current node space along the midpoints of the x, y, and z axes to form 8 sub-spaces of equal size. For example, for the root node space (-500, -500, 0) to (500,500, 100), the first sub-node space obtained after division is (-500, -500, 0) to (0, 0, 50), the second sub-node space is (0, -500, 0) to (500, 0, 50), and so on.
[0023] Reassign the scene objects in the current node to the corresponding child node space based on their position information. For each scene object, calculate the intersection relationship between its bounding box and each child node space. If the bounding box of the scene object is completely within a child node space, the object is assigned to the child node; if the bounding box of the scene object intersects with multiple child node spaces, the object is assigned to all intersecting child nodes. For example, a building model located at coordinates (-10, -10, 30) to (10, 10, 60) will be assigned to the relevant child node containing the coordinate range.
[0024] The above spatial division process is performed recursively until the number of scene objects in all nodes does not exceed the preset segmentation threshold of 10. In practical applications, it may be necessary to set a maximum recursion depth (such as 8 layers) to prevent over-subdivision. For dense areas containing a large number of small objects, the octree may reach a deeper level, while for open areas, the depth of the octree may be shallower.
[0025] After completing the space division, traverse all nodes of the octree from top to bottom, calculate and record the bounding box information and occlusion information of each node. For each node, first calculate its axial bounding box information, including the minimum vertex coordinates and the maximum vertex coordinates. This can be achieved by merging the bounding boxes of all scene objects contained in the node. For example, if a node contains 3 scene objects, their bounding boxes are (-10, -10, 0) to (10, 10, 20), (-5, -15, 0) to (15, 5, 15) and (-8, -5, 0) to (5, 12, 18), then the bounding box of the node is (-10, -15, 0) to (15,12, 20).
[0026] The surface area occlusion ratio is the ratio of the area of the node surface blocked by other scene objects to the total surface area of the node. The calculation method is: first determine the six surfaces of the node (front, back, left, right, top, and bottom), each surface is a rectangle; then for each surface, check whether other objects in the scene block the surface; finally calculate the ratio of the blocked area to the total surface area. For example, if the total surface area of a node is 200 square meters, of which 120 square meters are blocked by other objects, then its surface area occlusion ratio is 0.6 or 60%.
[0027] The node is projected onto six orthogonal planes (i.e., along the positive x-axis, negative x-axis, positive y-axis, negative y-axis, positive z-axis, and negative z-axis) to form a depth occlusion map. The specific method is: for each projection direction, create a two-dimensional grid (such as 256×256 pixels) to represent the projection plane; project the bounding box of the node onto the plane to determine the pixel range covered by the projection; for each covered pixel, record the depth value of the farthest scene object from the viewpoint to the pixel direction. For example, from directly above (positive z-axis), a node covers 20×20 pixels on the projection plane. For each pixel position, record the maximum z coordinate value at that position to form a 20×20 depth map.
[0028] Figure 2 This is a schematic diagram comparing the efficiency of occlusion culling by different methods; Figure 3 This is a table comparing the efficiency of occlusion culling by different methods; Figure 2 and Figure 3 The comparison of occlusion culling efficiency of different methods under various scene complexities is shown. The horizontal axis in the figure represents the number of scene objects (from 1K to 500K), and the vertical axis represents the percentage of occlusion culling efficiency (0%-60%). The four methods are marked with different shapes: this solution (circle), traditional octree (square), uniform grid (triangle) and KD tree (diamond). From the data trend, this solution has the highest occlusion culling efficiency in scenes of all complexities, from about 32% when 1K objects to about 62% when 500K objects. In contrast, the efficiency of traditional octree increased from about 25% to about 45%; KD tree increased from about 26% to about 47%; uniform grid has the lowest efficiency, from about 20% to about 33%. The occlusion culling efficiency of all methods increases with the increase of scene complexity, but this solution always maintains a leading advantage of 10-20 percentage points, indicating that it has a more significant performance advantage in large-scale scenes.
[0029] The spatial octree structure constructed by the above method not only records the spatial distribution information of scene objects, but also contains detailed bounding box information and occlusion information, providing efficient data structure support for subsequent scene rendering, visibility judgment and spatial query.
[0030] In an optional implementation, for a node within the viewing cone, calculating an occlusion coefficient based on occlusion information of the node, and performing occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold includes: For the nodes within the viewing cone, calculate their comprehensive occlusion coefficient: Based on the depth occlusion map of six orthogonal projection directions, the visibility of each projection surface is calculated in combination with the current viewing angle, and the distance from the node to the viewpoint is calculated to obtain the view distance attenuation factor; the visibility and the view distance attenuation factor are weighted and combined according to a preset weight coefficient to obtain a comprehensive occlusion coefficient of the node; Build an adaptive occlusion threshold adjustment mechanism: Based on the target frame rate set by the system, obtain the actual frame rate of the current rendering and calculate the ratio of the two; multiply the ratio by the preset adjustment coefficient as the dynamic adjustment factor, and multiply it by the basic occlusion threshold to obtain the dynamic occlusion threshold of the current frame; Perform occlusion judgment on each node in the processing node set: compare the comprehensive occlusion coefficient of each node with the currently calculated dynamic occlusion threshold. When the comprehensive occlusion coefficient of the node is greater than the dynamic occlusion threshold, mark the node as occluded, add it to the occlusion culling list, and perform occlusion culling.
[0031] In the process of 3D scene rendering, it is necessary to perform frustum culling on the nodes in the scene and retain the node set within the frustum. For these nodes, the present invention calculates the comprehensive occlusion coefficient and compares it with the dynamically adjusted occlusion threshold to achieve efficient occlusion culling.
[0032] In one embodiment, for nodes within the viewing cone, the system first constructs depth occlusion maps in six orthogonal projection directions. These six directions correspond to the positive X, negative X, positive Y, negative Y, positive Z, and negative Z directions of the object coordinate system. The depth occlusion map in each direction records the depth information of each point in the scene when viewed from that direction. The resolution of the depth occlusion map can be set to 512×512 pixels, and each pixel stores a 32-bit floating-point depth value.
[0033] When calculating the comprehensive occlusion coefficient of a node, you first need to obtain the visibility information of the node under the current viewing angle. For each node, the system projects the eight vertices of its bounding box onto six depth occlusion maps to check whether these vertices are occluded by other objects. In specific implementation, the world coordinates of the node vertex are converted to the coordinate system of the corresponding depth map, the depth value of the point in the depth map is obtained, and compared with the depth value stored in the depth map. If the depth value of the node vertex is greater than the value stored in the depth map, it means that the vertex is occluded by other objects.
[0034] For each projection direction, the system calculates the proportion of occluded vertices among the eight vertices of the node to obtain the occlusion rate of that direction. For example, if a node has 6 vertices occluded in the depth map in the positive X direction, the occlusion rate in that direction is 75%.
[0035] The system calculates the weight of each projection surface based on the angle between the current camera view and the six projection directions. The smaller the angle, the greater the weight. Specifically, the weight can be calculated by the power function of the cosine value of the angle, such as weight = cosine value to the cube. For example, if the angle between the current view and the positive Z direction is 30 degrees, the weight of this direction is about 0.65.
[0036] The system calculates the distance from the node to the viewpoint and obtains the line-of-sight attenuation factor. The line-of-sight attenuation factor decreases as the distance increases and can be calculated as follows: when the distance from the node center to the viewpoint is 100 meters, the attenuation factor is 0.8; when the distance is 200 meters, the attenuation factor is 0.6; when the distance is 500 meters, the attenuation factor is 0.3.
[0037] The system takes the weighted average of the occlusion rates in the six directions according to the corresponding weights to obtain the basic occlusion coefficient of the node. Then the basic occlusion coefficient is multiplied by the view distance attenuation factor to obtain the comprehensive occlusion coefficient of the node. For example, if the weighted average occlusion rate of a node in the six directions is 80% and the view distance attenuation factor is 0.7, then its comprehensive occlusion coefficient is 56%.
[0038] In order to adapt to different hardware performance and scene complexity, the present invention constructs an adaptive occlusion threshold adjustment mechanism. The system first sets the target frame rate, such as 60 frames per second. During the rendering process, the system obtains the current actual frame rate, such as 45 frames per second, and calculates the ratio of the two, 45 / 60=0.75.
[0039] The system multiplies this ratio by the preset adjustment coefficient to obtain the dynamic adjustment factor. The preset adjustment coefficient can be set to 1.5, then the dynamic adjustment factor is 0.75×1.5=1.125. Multiply this factor by the basic occlusion threshold to obtain the dynamic occlusion threshold of the current frame. If the basic occlusion threshold is set to 50%, the dynamic occlusion threshold is 50%×1.125=56.25%.
[0040] When the actual frame rate is lower than the target frame rate, the dynamic occlusion threshold will be increased accordingly, so that more nodes are culled, thereby improving rendering efficiency; conversely, when the actual frame rate is higher than the target frame rate, the dynamic occlusion threshold will be lowered, reducing the number of culled nodes and improving rendering quality.
[0041] The system performs occlusion judgment on each node in the set of nodes to be processed. The node's comprehensive occlusion coefficient is compared with the currently calculated dynamic occlusion threshold. When the node's comprehensive occlusion coefficient is greater than the dynamic occlusion threshold, the node is marked as occluded and added to the occlusion culling list. For example, if a node's comprehensive occlusion coefficient is 65% and the current dynamic occlusion threshold is 56.25%, the node is marked as occluded.
[0042] The system performs culling operations on the nodes in the occlusion culling list, and these nodes will not participate in the subsequent rendering process, thereby reducing the rendering load. For nodes that are not culled, the system continues to perform the normal rendering process.
[0043] In actual applications, the system can also set personalized occlusion threshold adjustment coefficients according to the importance of the node. For example, for key objects in the scene, the occlusion threshold adjustment coefficient can be set to 0.8 to make it less likely to be eliminated; while for secondary objects, the adjustment coefficient can be set to 1.2 to make it easier to be eliminated.
[0044] Through the above technical scheme, the present invention realizes adaptive occlusion culling based on multi-directional depth occlusion map, and can dynamically adjust the culling strategy according to system performance, thereby improving rendering efficiency while ensuring rendering quality.
[0045] In an optional implementation, determining the level of detail of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generating the scene object geometry data after the level of detail simplification includes: Calculate the distance from the center of the bounding box to the current viewpoint, and determine the node's level of detail based on the ratio of the distance to the node's base size. Specifically, take the base 2 logarithm of the ratio and round it down to get the level of detail. For nodes with a certain level of detail, calculate their simplification rate: use 2 raised to the power of the node level as the denominator to get the target simplification ratio; based on the target simplification ratio, calculate the folding cost of the mesh edge, where the folding cost includes a weighted combination of the geometric error metric and the attribute error metric; Prioritize edges according to their folding costs, and perform edge folding operations step by step according to the preset simplification ratio: first fold the edges with the smallest folding costs, update the positions and attribute information of adjacent vertices, and continue to perform edge folding until the target simplification rate is reached, generating scene object geometry data after detail level simplification.
[0046] The bounding box can be an axis-aligned bounding box (AABB), which is represented by the minimum point coordinates (xmin, ymin, zmin) and the maximum point coordinates (xmax, ymax, zmax). The coordinates of the center point of the bounding box are calculated as: Center point x coordinate = (xmin + xmax) / 2; Center point y coordinate = (ymin + ymax) / 2; Center point z coordinate = (zmin + zmax) / 2; Assuming the current viewpoint coordinates are (viewX, viewY, viewZ), the distance is calculated as the Euclidean distance between the two points. For example, for the center point of the bounding box (centerX, centerY, centerZ), the distance is calculated as the square root of the sum of the squares of the differences between the two points.
[0047] The base size can be the diagonal length of the bounding box, which is calculated as the distance between the maximum point and the minimum point of the bounding box. For example, the diagonal length of the bounding box, baseSize, can be expressed as the square root of the sum of the squares of the coordinate differences between the maximum point and the minimum point.
[0048] Based on the distance and the base size, the ratio ratio = distance / baseSize is calculated. This ratio represents the ratio of the viewing distance to the object size and is used to determine the appropriate degree of simplification.
[0049] To determine the level of detail, take the logarithm of the ratio to base 2 and round down. Level of detail lod = floor(log2(ratio)). When ratio is less than 1, lod is negative, indicating that higher precision is required; when ratio is greater than or equal to 1, lod is non-negative, indicating that simplification is possible. For example, when ratio = 5, log2(5) is approximately 2.32, which is rounded down to lod = 2.
[0050] According to the determined level of detail, the target simplification rate is calculated as simplificationRate = 1 / (2^lod). For example, when lod = 2, simplificationRate = 1 / 4, which means that 25% of the geometric information of the original model is retained. When lod is a negative number, simplificationRate is greater than 1, and no simplification is performed.
[0051] The folding cost is calculated for each edge of the model. The folding cost takes into account both geometric error and attribute error. The geometric error metric reflects the impact of edge folding on the shape of the model, which can be evaluated by calculating the volume change before and after edge folding or the quadratic error matrix. The attribute error metric considers the changes in attributes such as texture coordinates, normals, and colors.
[0052] Take a triangular mesh model as an example. The model contains 1000 vertices and 1800 triangles. For the edge (v1, v2), where the coordinates of v1 are (1.2, 3.4, 5.6) and the coordinates of v2 are (1.3, 3.5, 5.5), calculate its folding cost. Assume that the geometric error metric of the edge is 0.015, which indicates the impact of folding on the surrounding geometry; the texture coordinate error is 0.008, and the normal error is 0.012. Assuming the geometric error weight is 0.7 and the attribute error weight is 0.3, the total folding cost is 0.015×0.7 + (0.008+0.012)×0.3 = 0.0155.
[0053] According to the calculated folding cost, a priority queue is constructed to sort all edges from small to large according to the folding cost. For example, if the cost of edge e1 is 0.0155, the cost of edge e2 is 0.0187, and the cost of edge e3 is 0.0142, the sorting result is e3, e1, e2.
[0054] The number of vertices to be retained is determined based on the target simplification rate. For example, if the original number of vertices is 1000 and the simplification rate is 0.25, the target number of vertices is 250.
[0055] When performing edge folding, each time the edge with the lowest cost is taken out from the priority queue for folding. For example, first fold edge e3 and merge its two vertices into a new vertex. The position of the new vertex can be the midpoint of the original two vertices, or the optimal position determined according to the error minimization principle. Assume that edge e3 connects vertices v3 (2.1, 1.5, 3.2) and v4 (2.2, 1.6, 3.1), and the position of the new vertex after folding is (2.15, 1.55, 3.15).
[0056] After the folding operation, the folding cost of the affected edges is updated and the priority queue is adjusted. Edge folding continues until the target number of vertices or simplification rate is reached. For example, for a target number of vertices of 250, 750 edge folding operations are performed.
[0057] Generate simplified geometric data, including vertex coordinates, indices, and attribute information such as texture coordinates and normals. For example, the simplified model contains 250 vertices and about 450 triangles, and the amount of data is reduced by about 75%.
[0058] In practical applications, multiple level-of-detail models can be pre-generated according to different viewing distances, stored in memory, and the appropriate model can be selected for rendering according to the level of detail calculated in real time. Simplified models can also be calculated in real time, especially for dynamically changing scenes.
[0059] Through the above method, the model complexity can be dynamically adjusted according to the observation distance. The objects in the distance use simplified models, while the objects in the near distance maintain high precision, thereby improving the rendering efficiency while ensuring the visual quality. Tests show that this method can increase the frame rate by 30%-50% while maintaining acceptable visual quality.
[0060] In an optional implementation, a material instance cache pool based on material similarity is established for each scene object in a rendering batch, material instances are dynamically merged according to the degree of change of material properties, and multiple materials whose material property similarity is higher than a set similarity threshold are merged into one material instance, including: Acquire material data of scene objects in a rendering batch, perform feature extraction on the material data, and construct a feature vector space; establish a material descriptor index tree based on the feature vector space, and the material descriptor index tree is used for rapid retrieval and matching of materials; Calculating the similarity between materials based on the material descriptor index tree: for non-texture attributes, directly calculating the Euclidean distance of the attribute value; for texture attributes, obtaining the texture similarity by calculating the normalized difference of the texture pixel value; performing weighted combination of the similarities of the various attributes to obtain the comprehensive similarity value between the material pairs; Divide the materials into multiple groups based on the comprehensive similarity value, construct a reference relationship graph of material instances in each material group, and record the association information of each material instance referenced by the scene object; perform hierarchical clustering on each material group again to generate an optimal merge sequence; Material instance merging is performed according to the optimal merging sequence: merged material parameters are calculated based on the attribute values of each instance in the material group, non-texture parameters are obtained by weighted averaging, and texture parameters are generated by mixed sampling; the material reference relationship of the scene object is updated, and the reference of the original material instance is pointed to the merged new material instance.
[0061] Figure 4 The following is a schematic diagram of the material instance merging system interface, where the material data includes non-texture attributes (such as diffuse reflectance, specular intensity, metalness, roughness, etc.) and texture attributes (such as diffuse map, normal map, specular map, etc.). Feature extraction is performed on each material to construct a feature vector space. During the feature extraction process, for non-texture attributes, the numerical value is directly used as the feature component; for texture attributes, the main features of the texture are extracted through downsampling and principal component analysis. For example, a 1024×1024 diffuse map is downsampled to 64×64, and then the mean, variance, and histogram features of the RGB channels are extracted as the feature representation of the texture.
[0062] Based on the extracted feature vectors, a material descriptor index tree is constructed. The index tree adopts a KD tree structure, where each node represents a material instance, and the distance between nodes represents the similarity between materials. The construction process of the KD tree is as follows: first, all material instances are sorted according to the first dimension features, and the median is selected as the root node; then, the left and right subtrees are recursively divided according to the next dimension features until all material instances are added to the tree. For example, for a scene containing 100 material instances, the depth of the constructed KD tree is about 7 layers, and the query efficiency can reach the O(log n) level.
[0063] The calculation of similarity between materials is divided into two parts: similarity of non-texture attributes and similarity of texture attributes. For non-texture attributes, the normalized Euclidean distance is used to calculate the similarity. For example, the diffuse reflectance of material A is (0.8, 0.2, 0.3) and the diffuse reflectance of material B is (0.7, 0.3, 0.3). Their distance on this attribute is 0.14, and the similarity is 1-0.14=0.86. For texture attributes, the similarity is obtained by calculating the normalized difference of texture pixel values. In the specific implementation, 100 pixels at corresponding positions are randomly sampled from the two textures, their average color difference is calculated, and then normalized to the [0,1] interval to obtain the similarity value. For example, the average color difference of two similar metal textures after sampling is 15%, and the texture similarity is 0.85.
[0064] The weight distribution is determined according to the material type and rendering importance. For example, for metal materials, the metalness weight is 0.4, the roughness weight is 0.3, the diffuse map weight is 0.2, and the normal map weight is 0.1. Assuming that the similarities of two metal materials in these properties are 0.95, 0.9, 0.8, and 0.7 respectively, the comprehensive similarity is 0.95×0.4+0.9×0.3+0.8×0.2+0.7×0.1=0.88.
[0065] Based on the comprehensive similarity value, the threshold method is used to divide the materials into multiple groups. If the similarity threshold is set to 0.85, materials with a comprehensive similarity greater than 0.85 are divided into the same group. In each material group, a reference relationship graph of material instances is constructed to record the association information of each material instance referenced by the scene object. The reference relationship graph is stored in an adjacency list, and each material instance node contains a list of scene objects that reference the material.
[0066] The hierarchical clustering process is as follows: initially, each material instance is an independent cluster, and the similarity between all cluster pairs is calculated; the two clusters with the highest similarity are merged, and the inter-cluster similarity is updated; the above steps are repeated until the preset number of clusters is reached or the similarity is lower than the threshold. For example, a group containing 8 similar materials may eventually be merged into 3 material instances through hierarchical clustering, and the merge sequence is [(M1,M3),(M2,M5),(M4,M7),(M6,M8),((M1,M3),(M4,M7)),((M2,M5),(M6,M8))].
[0067] For non-texture parameters, the merged value is obtained by weighted averaging. The weight can be determined based on the frequency of material references. For example, material A is referenced 10 times and material B is referenced 5 times. The merged diffuse coefficient is (A.diffuse×10+B.diffuse×5) / 15. For texture parameters, a new texture is generated by mixed sampling. In specific implementation, a new texture with the same resolution as the original texture is created, and for each pixel position, the pixel values of the corresponding position of the original texture are mixed according to the weight. For example, two 512×512 diffuse maps are merged with a weight of 6:4, then each pixel value in the new texture is the weighted average of the pixel values of the corresponding position of the original texture.
[0068] After the material merge is completed, the material reference relationship of the scene object is updated, and the reference of the original material instance points to the merged new material instance. At the same time, the material instance cache pool is maintained, unreferenced material instances are cleaned up regularly, and the re-evaluation and merging process is triggered when the scene changes.
[0069] Using the above method, in a scene containing 1,000 scene objects and using 800 material instances, after material merging, the number of material instances can be reduced to about 300, rendering batches are reduced by about 60%, and rendering performance is improved by about 35%, while keeping the reduction in visual quality within an acceptable range (PSNR value greater than 32dB).
[0070] In an optional implementation, materials are divided into multiple groups based on the comprehensive similarity value, a reference relationship graph of material instances is constructed in each material group, and association information of each material instance being referenced by a scene object is recorded; hierarchical clustering is performed on each material group again to generate an optimal merge sequence, including: Constructing a bipartite graph structure of a material group, the bipartite graph structure comprising a material instance vertex set and a scene object vertex set, and establishing a reference relationship edge set between the material instance vertex set and the scene object vertex set; Calculating the reference weight in the bipartite graph structure, calculating the area ratio of a single material instance referenced by a single scene object according to the used area of each material instance on the surface of the scene object, and using the area ratio as the weight value of the reference relationship; Building a hierarchical clustering tree based on the bipartite graph structure, and calculating a distance metric value for each pair of material clusters, wherein the distance metric value is obtained by calculating the average distance between all material pairs in the two material clusters; The material similarity, reference relationship overlap and rendering cost are used as evaluation indicators, and the three evaluation indicators are weighted and combined to obtain the combined evaluation score between material cluster pairs. The material cluster pairs whose merging evaluation scores are higher than a preset evaluation threshold are inserted into a priority queue in descending order of scores; and the material cluster pair with the highest score is extracted from the priority queue as the optimal merging object.
[0071] The comprehensive similarity value can be calculated by comparing the color, texture, glossiness, roughness and other characteristics of the material. For example, for two materials A and B, extract their feature vectors, calculate the Euclidean distance between the feature vectors, and normalize the distance value to the range of 0-1 as the similarity value. When the similarity value is greater than 0.8, the two materials can be classified into the same group.
[0072] In each material group, a reference relationship graph of material instances is constructed. The reference relationship graph records the associated information of each material instance referenced by the scene objects. For example, material M1 is referenced by objects O1 and O2, and material M2 is referenced by objects O2 and O3. These reference relationships form a network structure.
[0073] Next, perform hierarchical clustering on each material group to generate the optimal merge sequence. The specific steps are as follows: Construct a bipartite graph structure of the material group, which contains two vertex sets: the material instance vertex set and the scene object vertex set. For example, the material instance set contains {M1, M2, M3}, and the scene object set contains {O1, O2, O3}. Establish a reference relationship edge set between the two sets. If material M1 is referenced by scene object O1, establish an edge between M1 and O1.
[0074] According to the usage area of each material instance on the surface of the scene object, calculate the area ratio of a single material instance referenced by a single scene object, and use this area ratio as the weight value of the reference relationship. For example, material M1 covers 80% of the surface area of object O1, then the reference weight of M1 to O1 is 0.8. If the surface area of object O1 is 100 square units, then the actual usage area of M1 on O1 is 80 square units.
[0075] For each pair of material clusters, a distance metric is calculated by averaging the distances between all pairs of materials in the two material clusters. For example, cluster C1 contains materials {M1, M2}, and cluster C2 contains materials {M3, M4}, then the distance between C1 and C2 is (distance(M1,M3)+distance(M1,M4)+distance(M2,M3)+distance(M2,M4)) / 4.
[0076] When evaluating the merging of material clusters, three key indicators are considered: material similarity, reference relationship overlap, and rendering cost. Material similarity reflects the degree of similarity between two materials in visual characteristics; reference relationship overlap indicates the degree to which two materials are referenced by the same scene object; rendering cost considers the impact of merging on rendering performance.
[0077] The three evaluation indicators are weighted and combined to obtain the combined evaluation score between the material cluster pairs. For example, the material similarity weight can be set to 0.5, the reference relationship overlap weight to 0.3, and the rendering cost weight to 0.2. Assuming that the material similarity of material clusters C1 and C2 is 0.9, the reference relationship overlap is 0.7, and the rendering cost reduction index after merging is 0.8, the combined evaluation score is 0.5×0.9+0.3×0.7+0.2×0.8=0.83.
[0078] The material cluster pairs with combined evaluation scores higher than the preset evaluation threshold are inserted into the priority queue in descending order of scores. For example, if the preset evaluation threshold is set to 0.7, all material cluster pairs with scores greater than 0.7 will be inserted into the priority queue. Suppose there are three pairs of material clusters with scores of 0.83, 0.76, and 0.72, respectively. They will all be inserted into the priority queue and sorted from high to low by score.
[0079] Extract the material cluster pair with the highest score from the priority queue as the optimal merge object. In the above example, the material cluster pair with a score of 0.83 will be merged first. After the merge, it is necessary to update the bipartite graph structure and related reference relationships, and then recalculate the merge evaluation scores between the remaining material cluster pairs and update the priority queue.
[0080] In practical applications, an iteration termination condition can be set, such as stopping merging when the priority queue is empty or the highest score is lower than a certain threshold. In this way, the number of materials can be minimized and rendering efficiency can be improved while maintaining visual quality.
[0081] Taking a specific scene as an example, suppose there is a 3D scene with 100 objects and 50 materials. After the initial grouping, 5 material groups are formed, each containing about 10 materials. In the first material group, the bipartite graph analysis found that the combined evaluation score of materials M1 and M2 was 0.92, which is much higher than the preset threshold of 0.7, so they are merged. After the merger, the number of materials in the scene is reduced to 49, while the visual quality is almost unchanged. After the complete merging process, the final number of materials may be reduced to about 30, and the rendering time is reduced by about 40%, while maintaining acceptable visual quality.
[0082] Through the above-mentioned material merging optimization method, the number of materials in the 3D scene can be effectively reduced, the rendering overhead can be reduced, and the application performance can be improved. It is particularly suitable for resource-constrained environments such as real-time rendering and mobile devices.
[0083] The real-time rendering optimization system in the metaverse scene building engine of the embodiment of the present invention includes: The first unit is used to obtain three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data and lighting data of scene objects; A second unit is used to construct a spatial octree structure of the scene object based on the three-dimensional scene data, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; The third unit is used to recursively traverse each node from top to bottom in the spatial octree structure according to the user viewpoint position information, determine whether the bounding box of each node is within the view frustum, and directly prune the nodes outside the view frustum; for the nodes within the view frustum, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; and determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate scene object geometry data after the detail level is simplified; A fourth unit, configured to divide the scene object geometry data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; The fifth unit is used to establish a material instance cache pool based on material similarity for scene objects in each rendering batch, dynamically merge material instances according to the degree of change of material properties, and merge multiple materials whose material property similarity is higher than a set similarity threshold into one material instance.
[0084] According to a third aspect of the embodiments of the present invention, An electronic device is provided, comprising: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0085] A fourth aspect of the embodiments of the present invention is: A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0086] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A real-time rendering optimization method in a metaverse scene building engine, characterized in that: include: Obtaining three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data, and lighting data of scene objects; Based on the three-dimensional scene data, construct a spatial octree structure of the scene object, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; According to the user's viewpoint position information, recursively traverse each node from top to bottom in the spatial octree structure, determine whether the bounding box of each node is within the viewing cone, and directly prune the nodes outside the viewing cone; for the nodes within the viewing cone, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; And determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate the geometric data of the scene object after the detail level is simplified; Dividing the scene object geometric data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; A material instance cache pool based on material similarity is established for scene objects in each rendering batch. Material instances are dynamically merged according to the degree of change of material properties, and multiple materials whose material property similarity is higher than the set similarity threshold are merged into one material instance.
2. The method according to claim 1, characterized in that Based on the three-dimensional scene data, constructing a spatial octree structure of the scene object, and recording the bounding box information and occlusion information of the scene object corresponding to each node of the spatial octree structure includes: Calculating the overall boundary range of the scene based on the geometric data of the scene object, determining the minimum vertex coordinates and the maximum vertex coordinates of the scene bounding box, constructing the root node space of the octree, and mapping the scene object to the root node space according to its position information; Traversing the scene objects in the root node space, when the number of scene objects contained in the node exceeds the preset segmentation threshold, evenly dividing the node space into 8 sub-node spaces, and reallocating the scene objects in the node to the corresponding sub-node spaces according to the position information; recursively executing the above space division process until the number of scene objects in all nodes does not exceed the preset segmentation threshold; Traverse all nodes of the octree from top to bottom: for each node, calculate the axial bounding box information of the node, including the minimum vertex coordinates and the maximum vertex coordinates; calculate the surface area occlusion ratio of the node: obtained by calculating the ratio of the area of the node surface occluded by other scene objects to the total surface area of the node; project the node onto six orthogonal planes to form a depth occlusion map, and record the maximum depth value of each projected pixel position.
3. The method according to claim 2, characterized in that For a node within the view frustum, the occlusion coefficient is calculated based on the occlusion information of the node. When the occlusion coefficient is greater than a preset occlusion threshold, occlusion culling is performed, including: For the nodes within the viewing cone, calculate their comprehensive occlusion coefficient: Based on the depth occlusion map of six orthogonal projection directions, the visibility of each projection surface is calculated in combination with the current viewing angle, and the distance from the node to the viewpoint is calculated to obtain the view distance attenuation factor; the visibility and the view distance attenuation factor are weighted and combined according to a preset weight coefficient to obtain a comprehensive occlusion coefficient of the node; Build an adaptive occlusion threshold adjustment mechanism: Based on the target frame rate set by the system, obtain the actual frame rate of the current rendering and calculate the ratio of the two; multiply the ratio by the preset adjustment coefficient as the dynamic adjustment factor, and multiply it by the basic occlusion threshold to obtain the dynamic occlusion threshold of the current frame; Perform occlusion judgment on each node in the processing node set: compare the comprehensive occlusion coefficient of each node with the currently calculated dynamic occlusion threshold. When the comprehensive occlusion coefficient of the node is greater than the dynamic occlusion threshold, mark the node as occluded, add it to the occlusion culling list, and perform occlusion culling.
4. The method according to claim 1, characterized in that: The node's level of detail is determined based on the distance from the center of the node's bounding box to the viewpoint, and the generated scene object geometry data after level of detail simplification includes: Calculate the distance from the center of the bounding box to the current viewpoint, and determine the node's level of detail based on the ratio of the distance to the node's base size. Specifically, take the base 2 logarithm of the ratio and round it down to get the level of detail. For nodes with a certain level of detail, calculate their simplification rate: use 2 raised to the power of the node level as the denominator to get the target simplification ratio; based on the target simplification ratio, calculate the folding cost of the mesh edge, where the folding cost includes a weighted combination of the geometric error metric and the attribute error metric; Prioritize edges according to their folding costs, and perform edge folding operations step by step according to the preset simplification ratio: first fold the edges with the smallest folding costs, update the positions and attribute information of adjacent vertices, and continue to perform edge folding until the target simplification rate is reached, generating scene object geometry data after detail level simplification.
5. The method according to claim 1, characterized in that: A material instance cache pool based on material similarity is established for each scene object in each rendering batch. Material instances are dynamically merged according to the degree of change of material properties. Multiple materials with material property similarity higher than the set similarity threshold are merged into one material instance, including: Acquire material data of scene objects in a rendering batch, perform feature extraction on the material data, and construct a feature vector space; establish a material descriptor index tree based on the feature vector space, and the material descriptor index tree is used for rapid retrieval and matching of materials; Calculating the similarity between materials based on the material descriptor index tree: for non-texture attributes, directly calculating the Euclidean distance of the attribute value; for texture attributes, obtaining the texture similarity by calculating the normalized difference of the texture pixel value; performing weighted combination of the similarities of the various attributes to obtain the comprehensive similarity value between the material pairs; Dividing the materials into multiple groups based on the comprehensive similarity value, constructing a reference relationship graph of material instances in each material group, and recording the association information of each material instance referenced by the scene object; performing hierarchical clustering on each material group again to generate an optimal merge sequence; Material instance merging is performed according to the optimal merging sequence: merged material parameters are calculated based on the attribute values of each instance in the material group, non-texture parameters are obtained by weighted averaging, and texture parameters are generated by mixed sampling; the material reference relationship of the scene object is updated, and the reference of the original material instance is pointed to the merged new material instance.
6. The method according to claim 5, characterized in that Dividing the materials into multiple groups based on the comprehensive similarity value, constructing a reference relationship graph of the material instances in each material group, and recording the associated information of each material instance being referenced by the scene object; performing hierarchical clustering on each material group again to generate an optimal merge sequence includes: Constructing a bipartite graph structure of a material group, the bipartite graph structure comprising a material instance vertex set and a scene object vertex set, and establishing a reference relationship edge set between the material instance vertex set and the scene object vertex set; Calculating the reference weight in the bipartite graph structure, calculating the area ratio of a single material instance referenced by a single scene object according to the used area of each material instance on the surface of the scene object, and using the area ratio as the weight value of the reference relationship; Building a hierarchical clustering tree based on the bipartite graph structure, and calculating a distance metric value for each pair of material clusters, wherein the distance metric value is obtained by calculating the average distance between all material pairs in the two material clusters; The material similarity, reference relationship overlap and rendering cost are used as evaluation indicators, and the three evaluation indicators are weighted and combined to obtain the combined evaluation score between material cluster pairs. The material cluster pairs whose merging evaluation scores are higher than a preset evaluation threshold are inserted into a priority queue in descending order of scores; and the material cluster pair with the highest score is extracted from the priority queue as the optimal merging object.
7. A real-time rendering optimization system in a metaverse scene building engine, used to implement the method as described in any one of claims 1 to 6, characterized in that: include: The first unit is used to obtain three-dimensional scene data to be rendered in the Metaverse scene building engine, wherein the three-dimensional scene data includes geometric data, material data and lighting data of scene objects; A second unit is used to construct a spatial octree structure of the scene object based on the three-dimensional scene data, and record, in each node of the spatial octree structure, bounding box information and occlusion information of the scene object corresponding to the node; The third unit is used to recursively traverse each node from top to bottom in the spatial octree structure according to the user viewpoint position information, determine whether the bounding box of each node is within the viewing cone, and directly prune the nodes outside the viewing cone; for the nodes within the viewing cone, calculate the occlusion coefficient based on the occlusion information of the node, and perform occlusion culling when the occlusion coefficient is greater than a preset occlusion threshold; And determine the detail level of the node according to the distance from the center of the bounding box of the node to the viewpoint, and generate the geometric data of the scene object after the detail level is simplified; A fourth unit, configured to divide the scene object geometry data into a plurality of rendering batches, each rendering batch containing scene objects having the same material attributes; The fifth unit is used to establish a material instance cache pool based on material similarity for scene objects in each rendering batch, dynamically merge material instances according to the degree of change of material properties, and merge multiple materials whose material property similarity is higher than a set similarity threshold into one material instance.
8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Rendering optimization method and device
CN106504185A
Three-dimensional scene rendering acceleration method and system based on video geometric analysis
CN110738721A
Large-scale point cloud visualization method capable of preloading nodes and adaptively filling
CN112509118A
BIM (Building Information Modeling) visualization method based on scene level instance information enhancement
CN116502303A
Three-dimensional rendering method and device, equipment and medium
CN117237502A
Cited By
Intelligent internet of things and element universe virtual-real fusion identification method and system based on deep learning
CN120105041A
Motion capture and feedback adjustment method and system for smart motion of meta universe
CN120123889A
Motion capture and feedback adjustment method and system for metaverse intelligent motion
CN120123889B
Multimedia teaching interaction method
CN120339557A
Scene rendering method and system based on three-dimensional Gaussian splashing
CN121095458A