3D model dynamic loading method using Unity engine

By constructing a tree-like index structure and optimizing the LOD algorithm, the detail levels of 3D models are dynamically scheduled, solving the problems of wasted computing power and dynamic detail distortion in the Unity engine during rendering, and achieving more efficient rendering and a more realistic immersive experience.

CN121746510AActive Publication Date: 2026-03-27HANGZHOU MOQI SPACE-TIME TECHNOLOGY CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202610218805.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-24
Publication Date
2026-03-27
Estimated Expiration
2046-02-24

AI Technical Summary

Technical Problem

The existing Unity engine cannot effectively distinguish the differences in visual importance in a scene when loading and rendering 3D models, resulting in wasted computing power and distortion of details in dynamic areas, which affects the realism of the scene and the dynamic loading effect.

Method used

By constructing a tree-like index structure, analyzing the spatial distance of nodes, view occlusion, visual richness, and motion coefficients, the LOD algorithm is optimized, and the detail levels of the mesh model and texture image are dynamically scheduled for rendering.

Benefits of technology

Significantly reduces computational load, improves frame rate and performance, accurately assesses visual focus, enhances image quality and scene realism, and avoids resource waste and dynamic detail distortion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121746510A_ABST
    Figure CN121746510A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of model loading, in particular to a 3D model dynamic loading method using a Unity engine, and the method comprises the following steps: obtaining an OSGB file of a 3D model obtained by image data reconstruction, converting the format, importing the OSGB file into the Unity engine, and constructing a tree index structure by using a file naming rule, each node is associated with the corresponding grid model and the mapping image; when the Unity engine runs, all nodes located in the view field of the main camera at all moments are obtained; and calculating the visual field fading degree, the visual richness, the visual saliency, the motion coefficient and the rendering evaluation value of each node, optimizing the node evaluation function of the LOD algorithm, and dynamically scheduling and loading the grid model and the mapping image of the corresponding detail level according to the evaluation result of the node for rendering. According to the method, high-performance rendering is ensured, and meanwhile, the reality sense and immersion sense of a scene picture are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of model loading, in particular to a 3D model dynamic loading method using a Unity engine. BACKGROUND

[0002] With the rapid development of smart cities, digital twins and entertainment games, large-scale and high-precision three-dimensional models have become the core elements for building immersive virtual environments. However, the Unity engine requires a lot of computer graphics processing power for loading and rendering three-dimensional models. To achieve real-time and smooth loading of large-scale real scene models, multi-level detail technology can dynamically adjust the rendering precision, thereby reducing the load of real-time rendering.

[0003] Traditional multi-level detail technology usually only relies on the static geometric relationship between the node and the main camera to adjust the detail level, which cannot effectively distinguish the inherent visual importance difference in the scene, resulting in the allocation of too high rendering precision for an object that is very close but has simple visual texture, causing waste of computing power, while an object that is far away but has complex structure and rich details appears blurred due to insufficient precision. The misalignment of rendering resource allocation and human visual perception focus makes the limited computing power unable to be used to improve the picture quality of the area that users pay most attention to. At the same time, it cannot perceive and respond to the strong attraction of dynamic elements in the scene to the user's visual attention, resulting in the same loading and rendering precision of dynamic and static areas at the same viewing distance, which leads to distortion of details in dynamic areas due to insufficient rendering precision, thereby reducing the realism of the scene and affecting the dynamic loading effect of the model. SUMMARY

[0004] In order to solve the above technical problems, a 3D model dynamic loading method using a Unity engine is provided to solve the existing problems.

[0005] The technical problem solving scheme of the application is to provide a 3D model dynamic loading method using a Unity engine, comprising the following steps: An OSGB file of a three-dimensional model reconstructed from image data is obtained, converted and imported into the Unity engine, and a tree index structure is constructed using file naming rules, wherein each node is associated with a corresponding mesh model and a map image; during the runtime of the Unity engine, all nodes within the viewing range of the main camera at each time are obtained; For each node within the viewing range of the main camera at each time, the spatial distance relationship between the mesh model of each node and the main camera, and the proportion of the mesh model whose field of view is not blocked are analyzed, and the field of view attenuation degree of each node is calculated. The visual richness of each node is calculated according to the number of different connected domains corresponding to the mapping image of each node and the shape difference and the complex color information contained in the mapping image, and the visual saliency of each node is obtained by combining the visual field attenuation degree. The motion coefficient of each node is calculated according to the displacement change of the pixel points in the mapping image of the same node at adjacent time points and the number of the pixel points with displacement, the rendering evaluation value of each node is calculated by combining the dynamic change of the main camera at adjacent time points and the visual saliency, and the node evaluation function of the LOD algorithm is optimized, and the corresponding detailed level of the grid model and the mapping image is dynamically scheduled and loaded according to the evaluation result of the node in the field of view of the main camera to perform rendering.

[0006] Preferably, the tree index structure is a quadtree structure.

[0007] Preferably, the visual field attenuation degree of each node is calculated by: obtaining the bounding box of the grid model corresponding to each node, calculating the distance between the center position of each face in the bounding box and the main camera, and selecting the face corresponding to the minimum distance as the visual field face; dividing the visual field face into a plurality of sub-regions, performing line-of-sight occlusion detection on each sub-region, calculating the ratio of the number of sub-regions without line-of-sight occlusion to the total number of sub-regions corresponding to the visual field face as the unoccluded proportion, and multiplying the area of the visual field face by the unoccluded proportion to obtain the visual field proportion of each node; calculating the distance between the center position of the bounding box of each node and the main camera; The visual field attenuation degree is positively correlated with the distance and negatively correlated with the visual field proportion.

[0008] Preferably, the visual richness of each node is calculated by: extracting all connected domains in the gray image corresponding to the mapping image, and calculating the Hu moment value of each connected domain; calculating the discrete degree of the Hu moment value of all connected domains in the gray image; calculating the image entropy of the pixel value of all pixel points in each color channel of the mapping image corresponding to each node, and calculating the average image entropy of all color channels as the average image entropy; counting the number of all connected domains in the gray image; The visual richness is the result of fusion of the number, the discrete degree, and the average image entropy.

[0009] Preferably, the specific process of fusion is that the product of the number, the discrete degree, and the average image entropy is taken as the visual richness.

[0010] Preferably, the visual saliency is the ratio of the visual richness to the visual field attenuation degree.

[0011] Preferably, the motion coefficient of each node is calculated, including: inputting the map images corresponding to the same node at each time and the previous time into an optical flow algorithm, obtaining the displacement vector of each pixel point, and calculating the module length of the displacement vector; obtaining the segmentation threshold of the module length of all pixel points in the map image corresponding to each node within the field of view of the main camera at each time, marking the pixel points with a module length greater than or equal to the segmentation threshold as motion pixel points; statistically analyzing the proportion of the number of motion pixel points in the map image corresponding to each node within the field of view of the main camera at each time; The motion coefficient is the normalized result of the product of the average value of the module length of all motion pixel points in the map image and the proportion of the number.

[0012] Preferably, the rendering evaluation value of the i-th node within the field of view of the main camera at the j-th time is calculated according to the following formula: wherein, is the rendering evaluation value of the i-th node within the field of view of the main camera at the j-th time, is the visual saliency of the i-th node within the field of view of the main camera at the j-th time, is the motion coefficient of the i-th node within the field of view of the main camera at the j-th time, is a preset weight factor, is the distance from the i-th node within the field of view of the main camera at the j-th time to the main camera, is the distance from the i-th node within the field of view of the main camera at the j-th time to the main camera. Preferably, the formula of the optimized node evaluation function is: wherein, is the evaluation result of the node, is the distance from the center position of the bounding box of the node to the main camera, is the edge length of the node, is the rendering evaluation value of the node.

[0013]

[0014] ​​​​​​​​​​​​​Preferably, the dynamic scheduling and loading of the grid model and the texture image corresponding to the detail level for rendering comprises: if the evaluation result of each node located in the field of view of the main camera at each time is less than 1, the detail level of the node is subdivided to load and render the descendant nodes; if the evaluation result is greater than or equal to 1, the detail level of the node is maintained and rendered.

[0015] The present application has at least the following beneficial effects: The present application has the beneficial effects of significantly reducing the amount of calculation, avoiding unnecessary resource loading and rendering, and improving the frame rate and overall performance by loading the nodes in the field of view of the main camera in real time. The beneficial effects of calculating the field of view fading degree of each node are that by quantifying the distance between the node and the camera and the unoccluded proportion of the grid model in the field of view, the nodes that are close but have a small visible area and the nodes that are far away but have a large visible area can be effectively distinguished, reflecting the importance of the nodes in the field of view and more accurately evaluating the spatial visual influence of the nodes on the screen, so that the rendering resources are preferentially allocated to the nodes with a larger visible range, avoiding the allocation of too high precision to a model that is very close but actually occluded or only occupies a small part, and improving the rendering efficiency. The beneficial effects of calculating the visual richness of each node are that by quantifying the structural complexity and color information of the texture, more attention can be paid to areas with rich details, thereby maintaining high performance while improving visual realism. The beneficial effects of obtaining the visual saliency of each node are that the visual focus in the scene that is really worth rendering in detail is identified from multiple dimensions, ensuring that the rendering is preferentially allocated to the area where the visual focus is located, and significantly improving the picture quality of the user's attention concentration area. The beneficial effects of calculating the motion coefficient of each node are that by considering the displacement of the pixel points in the texture image of the same node at adjacent times when the main camera does not move, the motion state of the node is dynamically perceived and captured, so as to ensure that dynamic elements can be presented with finer models, avoid motion blur or loss of details, and enhance the interactive experience. The beneficial effects of calculating the rendering evaluation value of each node are that the dynamic changes of the main camera are combined to prevent excessive adjustment of details for static or low-speed nodes, and by integrating visual features and motion features, the possibility of a node becoming the focus of user visual attention due to its own motion characteristics and texture characteristics is evaluated, effectively preserving dynamic details and improving scene realism and immersion. The node evaluation function of the LOD algorithm is optimized, and the grid model and the texture image corresponding to the detail level are dynamically scheduled and loaded for rendering according to the evaluation result of the node in the field of view of the main camera, which has the beneficial effects of accurately directing the limited computing power to the area that the user pays most attention to based on the importance of the node to the visual impact, and solving the problem of detail distortion in dynamic areas due to insufficient loading precision, thereby significantly improving the visual fidelity of the picture and the realism of the scene while ensuring real-time rendering performance. BRIEF DESCRIPTION OF DRAWINGS

[0016] A Unity engine-based 3D model dynamic loading method according to an embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0017] Figure 1 A Unity engine-based 3D model dynamic loading method according to an embodiment of the present application is described in detail below with reference to the accompanying drawings. Figure 2 A Unity engine-based 3D model dynamic loading method according to an embodiment of the present application is described in detail below with reference to the accompanying drawings. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the present application clearer, the Unity engine-based 3D model dynamic loading method according to the present application is described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.

[0020] Please refer to Figure 1 which shows a Unity engine-based 3D model dynamic loading method according to an embodiment of the present application, which includes the following steps: Step 1, obtain the OSGB file of the three-dimensional model reconstructed from the image data, import it into the Unity engine after format conversion, and construct a tree index structure using the file naming rule, wherein each node is associated with a corresponding mesh model and a map image; during the runtime of the Unity engine, obtain all nodes located within the field of view of the main camera at each time.

[0021] With the development of virtual reality technology, the real world can be simulated in a computer, and man and computer can be integrated, so that man can be placed in the real world. This technology can simulate the real environment, and let the experimenter immerse in the virtual environment through the combination of multiple senses, and has the characteristics of strong interaction. In order to build a virtual environment that fits the real world, people have been exploring how to make more realistic three-dimensional models. Oblique photography technology can quickly and efficiently obtain rich image data information, and reconstruct high-precision real three-dimensional models using computing clusters, which makes it possible to create large-scale and high-fidelity virtual environments.

[0022] Based on the above analysis, the image data of the target scene area is collected by a five-lens oblique camera carried by a drone, and the image data is input into the ContextCapture software to generate a three-dimensional model with texture. In this embodiment, the ground resolution requirement of the five-lens oblique camera is within 5 cm, the image heading overlap is more than 80%, and the lateral overlap is more than 70%. As other embodiments, the implementer can set it according to the actual situation. The process of constructing a real scene three-dimensional model by using the ContextCapture software is a known technology, and will not be described here.

[0023] Since the model constructed by the ContextCapture software is usually a high-precision but static grid, it lacks interactivity and dynamic behavior. The Unity engine is a powerful, integrated real-time interactive content creation platform and game engine, which can realize dynamic interaction. Therefore, importing the real scene three-dimensional model into Unity can convert a static and non-interactive model into an object in a dynamic, interactive, and complex rule-integrated virtual world, to realize virtual-real synchronization and real-time roaming.

[0024] Secondly, loading and rendering a three-dimensional model in a virtual scene requires a lot of computer graphics power. Therefore, how to quickly and smoothly load and render the oblique three-dimensional model is a difficult problem. To achieve real-time and smooth loading of large-scale real scene models, the multi-level of detail (LOD) technology can solve the model loading problem by reducing the complexity of the model. The purpose is to dynamically adjust the rendering accuracy according to the spatial relationship between the model and the observer. Specifically, a three-dimensional model close to the observer is presented with higher accuracy, while a three-dimensional model far from the observer is presented with lower accuracy, so as to reduce the overall rendering pressure and optimize the experience of the virtual scene.

[0025] Among them, the LOD algorithm based on the quadtree structure recursively divides the entire scene into four quadrants, forming a multi-level tree structure. The root node represents the coarsest global model, and the child nodes represent the more detailed one-level model block of the corresponding area of the parent node. During rendering, a predetermined evaluation criterion is used to determine whether the detail level of each node meets the current requirements. When the parent node does not meet the accuracy requirements, four higher-precision child nodes are loaded and replace the parent node for rendering. Conversely, when the accuracy provided by the child node far exceeds the required accuracy, the child node is replaced by its parent node to combine the rendering batch and reduce the computational load.

[0026] Since the Unity engine only supports FBX files and does not support OSGB files, the three-dimensional model with textures is exported by the ContextCapture software to generate an OSGB file. The osgb2fbx software is used to batch format conversion of the OSGB file to obtain the FBX file supported by the Unity engine, which contains the grid model and the corresponding map image. It should be noted that the osgb2fbx software for format conversion is a known technology, which will not be described here; secondly, the ContextCapture software does not export a large OSGB file, but thousands of small OSGB files, each file represents a node in the quadtree, the naming of these files itself encodes its position in the quadtree, at the same time, each OSGB file is attached with a small area of its own belonging to the map image.

[0027] Load the FBX file using the Unity platform, parse the naming rules of the file name, build the quadtree index structure in the program logic, and map each mesh model and map image to the node of the quadtree; It should be noted that the construction of quadtree index structure is a known technology, which will not be described here.

[0028] When roaming through the Unity engine, use the built-in frustum culling method of Unity to get all the nodes located in the field of view of the main camera at each time; It should be noted that in the Unity engine, the main camera represents the field of view of the player in the virtual scene, and the main camera position and some models may change dynamically during roaming, therefore, the real-time update of the picture is carried out at a frequency of 60fps / s, as other implementation manners, the implementer can set it according to the actual situation; secondly, the frustum culling method is a known technology, which will not be described here.

[0029] At this point, all the nodes located in the field of view of the main camera at each time are obtained, as well as the mesh model and map image corresponding to the node.

[0030] Step 2, for each node in the field of view of the main camera at each time, analyze the spatial distance relationship between the mesh model of each node and the main camera, and the proportion of the mesh model whose field of view is not blocked, and calculate the field of view fading degree of each node.

[0031] Because each node in the quadtree corresponds to different entity objects in the three-dimensional scene, and the geometric size of these entities in space is different, even if they are in the same range of the main camera, the visual proportion they occupy in the field of view is not consistent; considering that the entity represented by the mesh model usually has multiple faces, and some faces may not be observed by the main camera because of the orientation, therefore, by analyzing the field of view proportion of the unblocked area of the mesh model corresponding to the node, and the distance between the node and the main camera, the field of view fading degree is calculated, and the rendering accuracy of the node is preliminarily evaluated, which is: For each node located in the field of view of the main camera at each time, get the bounding box of the mesh model corresponding to each node through the mesh rendering component of the Unity engine; In the embodiment, the bounding box type adopts an Axis Aligned Bounding Box (AABB), and the acquisition of the bounding box is a known technology and will not be described here.

[0032] The distance between the center position of each face in the bounding box and the main camera is calculated, the face corresponding to the minimum distance is selected as the view field face; In the embodiment, the distance is calculated by calculating the Euclidean distance between the center position of each face and the main camera, and the Euclidean distance is a known technology and will not be described here.

[0033] The view field face is divided into a plurality of sub-regions, a ray collision detection technology is used to emit a ray from the position of the main camera to each sub-region for line-of-sight occlusion detection, and the ratio of the number of sub-regions without line-of-sight occlusion to the number of all sub-regions corresponding to the view field face is taken as the unoccluded proportion; In the embodiment, the view field face is evenly divided into 12 sub-regions, and as other implementation manners, the implementer can set it according to the actual situation; secondly, the ray collision detection method built in the Unity engine is a known technology and will not be described here, and whether the ray will collide with other objects before reaching the sub-region is detected to determine whether the sub-region is occluded.

[0034] The product of the area of the view field face and the unoccluded proportion is taken as the view field proportion of each node; The view field fading degree of each node in the view field range of the main camera at each moment is positively correlated with the distance and negatively correlated with the view field proportion; It should be noted that the positive correlation means that the dependent variable increases with the increase of the independent variable and decreases with the decrease of the independent variable, and the negative correlation means that the dependent variable decreases with the increase of the independent variable and increases with the decrease of the independent variable.

[0035] In the embodiment, the square of the distance between the center position of the bounding box of each node and the main camera is calculated, and the ratio of the square to the view field proportion is taken as the view field fading degree of each node in the view field range of the main camera at each moment, and as other implementation manners, the ratio of the normalized distance to the normalized view field proportion can be taken as the view field fading degree of each node in the view field range of the main camera at each moment.

[0036] It should be noted that the three-dimensional space coordinate system adopts the default three-dimensional space coordinate system of Unity, so the construction of the bounding box, the calculation of the center position of each face and the distance are known technologies and will not be described here.

[0037] It should be noted that, in the calculation of the ratio, in order to avoid the denominator being 0, a preset value greater than 0 is added to the denominator, and in the embodiment, the preset value greater than 0 is 0.01, and as other embodiments, the implementer can set it according to the actual situation; secondly, the field of view is represented as the surface concerned by the mesh model corresponding to the node under the visual angle at each time; the larger the area of the field of view, the wider the area covered by the mesh model in the picture, and the greater the influence on the user's visual perception; the greater the unobstructed proportion, the higher the degree of unobstruction of the field of view under the visual angle at this moment; the greater the obtained field of view proportion, the greater the visibility of the mesh model in the picture, the higher the visual importance, and the more need for high-precision rendering to improve the realism and detail performance of the picture; the farther the node is from the main camera, the greater the square of the distance, indicating that the entity represented by the mesh model corresponding to the node is in a very far position; the obtained field of view fading degree can reflect the degree of fading processing required by the mesh model corresponding to the node in the user's visual perception level, the smaller the value, the closer the mesh model is to the user and the larger the display area of the mesh model, therefore, higher loading precision and rendering resources should be set to improve the picture quality; otherwise, it indicates that the importance is weaker, and fading is needed to improve the rendering efficiency.

[0038] At this point, the field of view fading degree of each node within the main camera visual field range at each time is obtained.

[0039] Step 3, evaluate the number of different connected domains of the map image corresponding to each node and the shape difference, and the complexity of the color information contained in the map image, calculate the visual richness of each node, and combine the field of view fading degree to obtain the visual saliency of each node.

[0040] Further, since entities with significant appearance features, such as building outlines, doors and windows with large color differences, billboards, graffiti, etc. usually have higher visual appeal, higher loading precision is required, while grassland, wasteland, water surface and other areas with uniform color and gentle texture usually have lower visual appeal, and the loading precision can be reduced.

[0041] Further, the step flow chart of the method for obtaining the visual saliency of each node provided by the embodiment of the application is as shown in Figure 2

[0042] First, the map image corresponding to the node is analyzed for connected domain, specifically: For each node located in the main camera visual field range at each time, the map image corresponding to the node is converted into a gray image, and all connected domains in the gray image are extracted; ​In the embodiment, the weighted average method is used to perform the gray-scale processing to obtain the gray-scale image; the region growing method is used to extract the connected domains, wherein the weighted average method and the region growing method are known technologies and will not be described herein.

[0043] Secondly, it is determined whether the multiple connected domains are the same objects, such as bricks, windows, and the like; if the multiple connected domains are the same objects, although the number of the objects can be relatively large, the overall visual saliency is relatively low due to the lack of shape changes. Since the sizes of the same objects are consistent, the structural complexity is calculated by analyzing the shape difference of the different connected domains and the number of the connected domains, specifically as follows: The Hu moment function is used to calculate the Hu moment values of the connected domains; and the dispersion degree of the Hu moment values of all the connected domains in the gray-scale image is calculated. It should be noted that the Hu moment function is a known technology and will not be described herein. Since the Hu moment function can calculate seven Hu moment values for each connected domain to form a moment vector, the mean of the coefficients of variation of all the dimensions is used as the dispersion degree of the gray-scale image, wherein the calculation of the coefficient of variation is a known technology and will not be described herein. As other embodiments, the implementer can use other methods of the prior art, for example, information entropy, and the present embodiment does not specially limit this.

[0044] The image entropy of all the pixel points in each color channel of the corresponding texture image of each node is calculated; and the mean of the image entropies of all the color channels is used as the average image entropy. It should be noted that the texture image is an RGB image, and each pixel point has pixel values of R, G, and B color channels. Secondly, the calculation of the image entropy is a known technology and will not be described herein.

[0045] The number of all the connected domains in the gray-scale image is counted, and the product of the number, the dispersion degree, and the average image entropy is used as the visual richness of each node in the field of view of the main camera at each moment. It should be noted that the more the number of the connected domains, the more the objects with obvious gray-scale differences in the texture image, the more the mutually separated objects in the texture image, and the greater the complexity of the internal structure of the texture image. The greater the dispersion degree, the more obvious the shape difference between the different connected domains, the more diversified the object shapes in the texture image. The greater the average image entropy, the more the color information contained in the texture image. The greater the obtained visual richness, the more complex and rich the color of the structure of the grid model corresponding to the node, the higher the visual attraction, and the more the high-precision rendering is needed to display the image details and improve the picture quality.

[0046] Further, based on the visual field attenuation degree and the visual richness, the visual saliency is determined, specifically: The ratio of the visual richness and the visual field attenuation degree is taken as the visual saliency of each node located in the field of view range of the main camera at each time; It should be noted that the greater the visual saliency, the more important the node corresponding to the texture image in the picture has both rich structure and color details and is closer to the main camera, and the higher the importance, the more high-precision rendering is needed.

[0047] At this point, the visual saliency of each node located in the field of view range of the main camera at each time is obtained.

[0048] Step 4, the motion coefficient of each node is calculated through the displacement change of the pixel points in the texture image of the same node at adjacent times and the number of pixel points with displacement, the rendering evaluation value of each node is calculated in combination with the dynamic change of the main camera at adjacent times and the visual saliency, and the node evaluation function of the LOD algorithm is optimized, and the corresponding detail level of the grid model and the texture image is dynamically scheduled and loaded according to the evaluation result of the node in the field of view range of the main camera to perform rendering.

[0049] In current game and video applications, in order to improve the scene realism, part of the models in the environment such as flowers, trees, water surface, etc. usually produce dynamic changes with wind force or water flow. Considering that the importance of the node can be evaluated by the visual saliency at present, but only static scenes can be analyzed, and the visual importance of dynamic elements cannot be effectively captured, therefore, the displacement change between the texture images corresponding to the same node at adjacent times is analyzed, and the motion coefficient is calculated, specifically: The texture images corresponding to the same node at each time and the previous time are input into the optical flow algorithm, the displacement vector of each pixel point is obtained, and the length of the displacement vector is calculated; In the present embodiment, the optical flow algorithm adopts KTL optical flow method, wherein the KTL optical flow method and the calculation of the length are both known technologies, and will not be described here. As other implementation manners, the implementer can adopt other methods of prior art, for example, Lucas-Kanade method, etc., and the present embodiment does not specially limit this.

[0050] It should be noted that the length of the displacement vector can reflect the displacement change between the texture images at adjacent times, and the greater the length, the greater the displacement change of the pixel point.

[0051] The segmentation threshold of the length of all pixel points in the texture image corresponding to each node located in the field of view range of the main camera at each time is obtained; In the embodiment, the threshold segmentation method of Otsu is used to obtain the segmentation threshold, which is a known technology and will not be described here. As other embodiments, the implementer can use other methods of prior art, such as cross-validation method, and the embodiment does not specially limit this.

[0052] The pixel points with the length greater than or equal to the segmentation threshold are marked as motion pixel points. The proportion of the number of motion pixel points in the map image corresponding to each node within the field of view of the main camera at each time is counted. The normalized result of the product of the average value of the length of all motion pixel points in the map image and the proportion is calculated as the motion coefficient of each node within the field of view of the main camera at each time. In the embodiment, the sigmoid function is used for normalization processing, which is a known technology and will not be described here.

[0053] It should be noted that the greater the proportion, the higher the proportion of the region of the map image that moves, that is, there is a large area of region that moves significantly; the greater the average value, the more intense the average motion amplitude of all the moving pixel points; the greater the motion coefficient, the more the grid model part corresponding to the node not only has a large range of motion, but also has a very significant motion amplitude, which is more likely to attract user attention and has higher visual importance.

[0054] It should be noted that the motion coefficient is set to 1 for the initial time of roaming.

[0055] Further, based on the above analysis, the rendering evaluation value is calculated based on the visual saliency and the motion coefficient, specifically: wherein, is the rendering evaluation value of the i th node within the field of view of the main camera at the j th time, is the visual saliency of the i th node within the field of view of the main camera at the j th time, is the motion coefficient of the i th node within the field of view of the main camera at the j th time, is a preset weight factor, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera, is the distance from the i th node within the field of view of the main camera at the j th time to the main camera. The distance from each node to the main camera; In this embodiment, the preset weight factor is set to 2. Since the normalized motion coefficient ranges from 0.5 to 1, increasing the motion coefficient by setting the preset weight factor makes... The value range is between 1 and 2, so as to improve the rendering accuracy of nodes and avoid calculation errors when the main camera is stationary.

[0056] It should be noted that when the main camera is stationary, the motion changes of nodes in the texture image are entirely due to the node's own movement, such as object movement. In this case, a high motion coefficient truly reflects the dynamic visual appeal of the node, and the mesh model corresponding to that node requires higher precision rendering to ensure the visual experience of stationary nodes. However, when the main camera is moving, the motion changes of nodes in the texture image are mainly due to camera movement, and the motion coefficient cannot reflect the node's own movement. In this case, the node's motion characteristics are not analyzed to avoid errors. Therefore, the higher the obtained rendering evaluation value, the more likely the node is to become the focus of the user's visual attention due to its own motion and texture characteristics, and the more precise the rendering is required to ensure the display effect of the image.

[0057] Furthermore, the formula for the node evaluation function in the traditional quadtree-based LOD algorithm is as follows: in, This represents the distance from the center of the node's bounding box to the main camera. Let d be the side length of the node, where d is the width of the node's bounding box. A constant used to control the fineness of the entire LOD loading process. The larger the value, the higher the level of detail required for the current scene to be drawn.

[0058] It should be noted that the LOD algorithm based on quadtrees is a well-known technology and will not be elaborated upon here.

[0059] Therefore, based on the rendering evaluation values, the node evaluation function of the quadtree-based LOD algorithm is optimized. The node evaluation function is as follows: in, The evaluation results for the nodes, This represents the distance from the center of the node's bounding box to the main camera. Let be the side length of the node. This is the rendering evaluation value for the node; Based on the node evaluation function, the evaluation result of each node is calculated as follows: in, For the first At any given moment, it is within the field of view of the main camera. Evaluation results of each node For the first At any given moment, it is within the field of view of the main camera. The distance from the center of the bounding box of each node to the main camera. For the first At any given moment, it is within the field of view of the main camera. The side length of each node, For the first At any given moment, it is within the field of view of the main camera. The rendering evaluation value of each node; For the Each node, if the evaluation result If the value is less than 1, the node needs further subdivision. This involves traversing the node's four child nodes and determining if the child node's precision has reached the finest level of the quadtree structure. If the child node is at the finest level, it is loaded and displayed directly; otherwise, the child node is iterated and evaluated until the evaluation result of the descendant node meets the precision requirement or reaches the finest level of the quadtree structure. If the evaluation result... If the value is greater than or equal to 1, then the node does not need to be subdivided and the currently loaded precision level remains unchanged. When the main camera moves or the scene changes dynamically, the Unity engine loads and renders the nodes within the main camera's field of view in real time as needed, thus achieving dynamic loading of the overall 3D model.

[0060] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0061] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.

[0062] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application. Therefore, any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of this application, without departing from the content of the technical solution of this application, shall fall within the protection scope of the technical solution of this application.

Claims

1. A method for dynamically loading 3D models using the Unity engine, characterized in that, The method includes the following steps: Obtain the OSGB file of the 3D model reconstructed from the image data, convert the format and import it into the Unity engine, and build a tree-like index structure using file naming rules, where each node is associated with the corresponding mesh model and texture image; when the Unity engine is running, obtain all nodes within the field of view of the main camera at each time point; For each node within the field of view of the main camera at each time point, analyze the spatial distance relationship between the mesh model of each node and the main camera, as well as the proportion of the field of view of the mesh model that is not occluded, and calculate the field of view fading degree of each node. The visual richness of each node is calculated by evaluating the number and shape differences of different connected components corresponding to the texture image of each node, as well as the complexity of the color information contained in the texture image. Combined with the visual fading degree, the visual saliency of each node is obtained. By analyzing the displacement changes of pixels in the texture image of the same node at adjacent time points, and the number of pixels with displacement, the motion coefficients of each node are calculated. Combined with the dynamic changes of the main camera at adjacent time points and the visual saliency, the rendering evaluation value of each node is calculated, and the node evaluation function of the LOD algorithm is optimized. Based on the evaluation results of nodes within the field of view of the main camera, the corresponding mesh model and texture image at the detail level are dynamically scheduled and loaded for rendering.

2. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The tree-like index structure is a quadtree structure.

3. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The calculation of the field-of-view blurring degree for each node includes: Obtain the bounding box of the mesh model corresponding to each node; calculate the distance between the center position of each face in the bounding box and the main camera, and select the face corresponding to the minimum distance as the view plane; The field of view is divided into multiple sub-regions. Line of sight occlusion is detected in each sub-region. The ratio of the number of sub-regions without line of sight occlusion to the total number of sub-regions in the field of view is calculated as the unoccluded percentage. The product of the area of ​​the field of view and the unoccluded percentage is used as the field of view percentage of each node. Calculate the distance between the center of the bounding box of each node and the main camera; The degree of visual field blurring is positively correlated with distance and negatively correlated with the proportion of the visual field.

4. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The calculation of the visual richness of each node includes: Extract all connected components from the grayscale image corresponding to the texture image, and calculate the Hu moment value of each connected component; Calculate the degree of dispersion of Hu moments for all connected components in a grayscale image; Calculate the image entropy of the pixel values ​​of all pixels in each color channel of the texture image corresponding to each node; calculate the mean of the image entropy of all color channels as the average image entropy; Count the number of all connected components in a grayscale image; The visual richness is the result of fusing the number of elements, the degree of dispersion, and the average image entropy.

5. A method for dynamically loading 3D models using the Unity engine as described in claim 4, characterized in that, The specific process of the fusion is as follows: the product of the number, the degree of dispersion, and the average image entropy is used as the visual richness.

6. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The visual salience is the ratio of the visual richness to the visual field dilution.

7. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The calculation of the motion coefficients of each node includes: Input the texture image corresponding to the same node at each time step and the previous time step into the optical flow algorithm to obtain the displacement vector of each pixel and calculate the magnitude of the displacement vector; Obtain the segmentation threshold of the modulus of all pixels in the texture image corresponding to each node within the field of view of the main camera at each time point, and mark the pixels with a modulus greater than or equal to the segmentation threshold as moving pixels; The percentage of moving pixels in the texture image corresponding to each node within the field of view of the main camera at each time point was statistically analyzed. The motion coefficient is the normalized result of the product of the average value of the magnitude of all moving pixels in the texture image and the proportion of their number.

8. The method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, No. At any given moment, it is within the field of view of the main camera. Rendering evaluation value of each node The calculation formula is: ,in, For the first At any given moment, it is within the field of view of the main camera. The rendering evaluation value of each node. For the first At any given moment, it is within the field of view of the main camera. The visual saliency of each node, For the first At any given moment, it is within the field of view of the main camera. The motion coefficients of each node As a preset weighting factor, For the first At any given moment, it is within the field of view of the main camera. The distance from each node to the main camera For the first At any given moment, it is within the field of view of the main camera. The distance from each node to the main camera.

9. A method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The optimized node evaluation function formula is as follows: ,in, The evaluation results for the nodes, This represents the distance from the center of the node's bounding box to the main camera. Let be the side length of the node. This is the rendering evaluation value for the node.

10. A method for dynamically loading 3D models using the Unity engine as described in claim 1, characterized in that, The dynamic scheduling and loading of mesh models and texture images corresponding to the level of detail for rendering includes: if the evaluation result of each node within the field of view of the main camera at each time point is less than 1, then the level of detail of that node is subdivided to load and render the descendant nodes; if the evaluation result is greater than or equal to 1, then the level of detail of that node is maintained and rendered.

Citation Information

Patent Citations

  • Multi-model same-screen rendering method based on Unity 3D engine

    CN111354067A

  • Visualization method and device based on Unity engine loading model

    CN115187445A

  • Highlight stroking method used in Unity 3D

    CN115578498A

  • Indoor and outdoor integrated visualization method for 3D map building of smart city

    CN120689535A

  • 3D Gaussian splash rendering optimization method in VR based on Unity engine

    CN121330145A