3D model loading method, device, equipment and medium
By performing spatial meshing and weight calculation on the 3D model, the problem of insufficient caching in web browsers was solved, enabling efficient loading of important components and improving model loading efficiency and browser performance.
Patent Information
- Application Number
- CN202511416507.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-09-30
AI Technical Summary
When previewing lightweight 3D models, web browsers may experience low model loading efficiency due to insufficient cache space or page freezing caused by loading multiple models simultaneously or multiple tabs of models.
By dividing the 3D model into spatial meshes, multi-dimensional data of the components are obtained, including semantic units. Initial weight values and fine-tuned weight values are calculated, and the component loading queue is sorted and loaded according to the target weight values.
It improves the efficiency of 3D model loading, prioritizing the loading of important components while meeting the requirements of model display effects, thus enhancing the browser's performance.
Smart Images

Figure CN120892645B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image data processing, and in particular to a 3D model loading method, device, equipment and medium. BACKGROUND
[0002] When a web browser previews a lightweight 3D model, it often causes problems such as insufficient cache space or page freezing due to simultaneous loading of multiple models or loading of multiple tab models, resulting in low model loading efficiency. SUMMARY
[0003] The present application provides a 3D model loading method, device, equipment and medium to solve the problems of low 3D model loading efficiency and cache overflow in the prior art.
[0004] In a first aspect, the present application provides a 3D model loading method, comprising:
[0005] spatial grid division of the 3D model to obtain a plurality of components;
[0006] determining the multi-dimensional data of each of the components, wherein the multi-dimensional data at least includes semantic units;
[0007] obtaining the current component loading queue of the 3D model and the initial weight value of each of the to-be-loaded components in the component loading queue;
[0008] determining the scene to which the 3D model belongs, and calculating the fine-tuning weight value of the to-be-loaded component in the scene based on the semantic unit of the to-be-loaded component, wherein the fine-tuning weight value is used to measure the importance of the to-be-loaded component in the scene;
[0009] calculating a target weight value according to the initial weight value and the fine-tuning weight value;
[0010] sorting the to-be-loaded components in the component loading queue according to the target weight value, and loading the to-be-loaded components according to the sorting result.
[0011] In a second aspect, the present application provides a 3D model loading device, comprising:
[0012] a model division module for spatial grid division of a 3D model to obtain a plurality of components;
[0013] a data determination module for determining the multi-dimensional data of each of the components, wherein the multi-dimensional data at least includes semantic units;
[0014] a queue acquisition module for obtaining the current component loading queue of the 3D model and the initial weight value of each of the to-be-loaded components in the component loading queue;
[0015] a fine-tuning weight value calculation module, configured to determine a scene to which the 3D model belongs, and calculate a fine-tuning weight value of the to-be-loaded component in the scene based on a semantic unit of the to-be-loaded component, wherein the fine-tuning weight value is used to measure an importance of the to-be-loaded component in the scene;
[0016] a target weight value calculation module, configured to calculate a target weight value according to the initial weight value and the fine-tuning weight value;
[0017] a component loading module, configured to sort the to-be-loaded components in the component loading queue according to the target weight value, and load the to-be-loaded components according to a result of the sorting.
[0018] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the 3D model loading method according to any of the embodiments of the present application.
[0019] In a fourth aspect, the present application provides a computer readable storage medium, having a computer program stored thereon, wherein the program is executable on a processor to implement the 3D model loading method according to any of the embodiments of the present application.
[0020] In a fifth aspect, the present application provides a computer program product, including a computer program, wherein the computer program is executable on a processor to implement the 3D model loading method according to any of the embodiments of the present application.
[0021] The 3D model loading method, device, equipment and medium provided by the application, first divide the 3D model into a spatial grid to obtain a plurality of components, and determine the multi-dimensional data of each component, wherein the multi-dimensional data at least includes semantic units. Then, obtain the current component loading queue of the 3D model, and the initial weight value of each to-be-loaded component in the component loading queue. Next, determine the scene to which the 3D model belongs, and calculate the fine-tuning weight value of the to-be-loaded component in the scene based on the semantic unit of the to-be-loaded component, wherein the fine-tuning weight value is used to measure the importance of the to-be-loaded component in the scene. Finally, calculate the target weight value according to the initial weight value and the fine-tuning weight value, sort the to-be-loaded components in the component loading queue according to the target weight value, and load the to-be-loaded components according to the sorting result. Therefore, the fine-tuning weight value of the component in different scenes is obtained based on the semantics of the component, the importance of the to-be-loaded component in the scene is measured by the fine-tuning weight value, so that the semantics of the component and the scene can be dynamically associated, and then sorted, and the to-be-loaded components are loaded according to the sorting result, so that the components with greater weights can be preferentially loaded based on the sorting of the target weight value in different scenes, and the efficiency of model loading is improved on the basis of meeting the model display effect requirements. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0023] Figure 1 A flowchart of a 3D model loading method provided by an embodiment of the application;
[0024] Figure 2 A flowchart of component queuing provided by an embodiment of the application;
[0025] Figure 3a A flowchart of calculating fine-tuning weight values in the 3D model loading method provided by an embodiment of the application;
[0026] Figure 3b An example of a scene tree, a label and a semantic tree in an embodiment of the application;
[0027] Figure 4 A flowchart of loading to-be-loaded components in the 3D model loading method provided by an embodiment of the application;
[0028] Figure 5 A flowchart of component loading decisions in the 3D model loading method provided by an embodiment of the application;
[0029] Figure 6 A flow chart of the process of cleaning useless components in the 3D model loading method provided by the embodiment of the present application;
[0030] Figure 7 A flow chart of the process of releasing cache in the 3D model loading method provided by the embodiment of the present application;
[0031] Figure 8 A structural schematic diagram of a 3D model loading device provided by the embodiment of the present application;
[0032] Figure 9 A structural schematic diagram of an electronic device provided by the embodiment of the present application.
[0033] The specific embodiments of the present application have been shown in the above-mentioned drawings, and will be described in more detail hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application by any means, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0034] The present application will be further described in detail below in combination with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, but not all the structures.
[0035] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description, but cannot be understood as indicating or implying relative importance. The acquisition, storage, use, processing, etc. of data in the technical solution of the present application all comply with the relevant provisions of the national laws and regulations. It should be noted that, in the embodiments of the present application, some industry existing solutions, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the related content of the solution.
[0036] Figure 1 A flow chart of a 3D model loading method provided by the embodiment of the present application. The embodiment can be applicable to the case of loading 3D model by browser, and the method can be executed by a 3D model loading device, which can be realized in the form of software and / or hardware, and is preferably configured in an electronic device, such as a computer device, a smart terminal or a server, etc. As shown in the figure, the method specifically includes: Figure 1
[0037] S101. Perform spatial grid division on the 3D model to obtain a plurality of components.
[0038] S102. Determine the multi-dimensional data of each component, wherein the multi-dimensional data at least includes semantic units.
[0039] S103. Obtain the current component loading queue of the 3D model, and the initial weight value of each component to be loaded in the component loading queue.
[0040] S104. Determine the scene to which the 3D model belongs, and calculate the fine-tuning weight value of the component to be loaded in the scene based on the semantic unit of the component to be loaded, wherein the fine-tuning weight value is used to measure the importance of the component to be loaded in the scene.
[0041] S105. Calculate the target weight value according to the initial weight value and the fine-tuning weight value.
[0042] S106. Sort the components to be loaded in the component loading queue according to the target weight value, and load the components to be loaded according to the sorting result.
[0043] Specifically, the octree method can be used to perform spatial grid division on the 3D model, and the 3D model can be divided into a plurality of independent components. The octree is a tree data structure that can perform recursive and detailed division on three-dimensional space. The specific operation process is as follows: first, starting from the three-dimensional space occupied by the entire 3D model, it is initially divided into eight sub-regions of equal size. Then, for each sub-region, check the number of model elements contained therein. If the number of model elements in a sub-region exceeds a pre-set threshold, continue to recursively divide the sub-region, and further subdivide it into eight smaller sub-regions, and repeat the element number checking step. Through continuous recursive division, the number of model elements in each sub-region is less than the set threshold. Each sub-region that meets the condition corresponds to an octree node, which determines an independent spatial range. This space is the smallest sub-node, and the model elements contained in the sub-node are elements. Traverse the database table and query the target element leaf node and its 26 adjacent nodes (6 faces + 12 lines + 8 points). Extract all elements in these nodes to form a candidate set of potential adjacent elements. Based on the relationship between the leaf nodes, merge the spatially continuous element groups around the sub-nodes to form initial spatially associated groups, and the elements between the spatial relationship groups are merged into components. The file size, geometry (number of points / lines / surfaces) information of each component can be obtained, and the web browser resource loading requirements can be inferred (related parameters can be pre-set in advance).
[0044] With the help of the splitting method based on the octree method, the originally huge and complex 3D model can be systematically and orderly disassembled into a plurality of relatively independent components, and the spatial information of the model is effectively organized, thereby providing a convenient basis and clear structure for subsequent operations such as loading, deleting, and weight adjustment of components based on spatial positions in the web-3D model browser.
[0045] Next, the multi-dimensional data of each component is determined, and the multi-dimensional data at least includes semantic units of the component. The components of the 3D model can be pre-disassembled into the smallest identifiable units corresponding to semantics, i.e., the indivisible basic structures with independent functions or geometric characteristics, such as components such as gears and bearings in mechanical models. A component semantic unit library can also be pre-set, i.e., each component has pre-set semantic unit information. After the 3D model is disassembled into components, the corresponding semantic unit information in the component semantic unit library can be found through the component.
[0046] When the browser loads the model, the current component loading queue of the 3D model and the initial weight value of each component to be loaded in the component loading queue are obtained. Then, the scene to which the 3D model belongs is determined, and the fine-tuning weight value of the component to be loaded in the scene is calculated based on the semantic unit of the component to be loaded, wherein the fine-tuning weight value is used to measure the importance of the component to be loaded in the scene. Then, the target weight value is calculated according to the initial weight value and the fine-tuning weight value, and the component to be loaded in the component loading queue is sorted according to the target weight value, and finally the component to be loaded is loaded according to the sorting result.
[0047] The multi-dimensional data can also include the neighborhood relationship, the preset path, and the perspective trajectory of the component. The initial weight value can be calculated according to the neighborhood relationship, the preset path, and the perspective trajectory of each component to be loaded.
[0048] The model components can be marked with a spatial index, and a two-dimensional array can be used to represent the adjacency relationship between the components. Specifically, when the model is divided based on the octree method, according to the set partitioning conditions such as spatial size, depth, and the number of elements in the node, based on the partitioning result, the relevant information of all nodes is obtained to establish a spatial index structure storage, records the node center coordinate value, the node cubic edge length, the index information of the node containing elements and the information of the 8 child nodes, creates a global database table, maps the elements to the leaf node list where they are located, and realizes fast reverse query. By traversing the database table, the leaf node where the model component is located and its 26 adjacent nodes (up and down, left and right, front and back neighborhood) are traversed, the adjacency relationship is recorded in the model component metadata, and stored. Then, the neighborhood relationship expression is given according to the adjacency relationship of the model component. For example, assuming that there are n components, an n x n array adjacency_matrix can be created. For the element adjacency_matrix[i][j] in the array, if component i and component j are adjacent in space, set its value to 1, otherwise set it to 0. Thus, the neighborhood relationship of the components can be obtained.
[0049] A one-dimensional array can be used to represent the user's operation path. Each element in the array represents the sequential order of the components visited by the user. By recording the user's operation path, the user's browsing habits and behavior patterns can be analyzed to determine the preset path of the components. Specifically, the system can be preconfigured with the operation path accessible to the user, and then the user's operation is monitored to capture the user's operation events such as mouse clicks, dragging, rotating, keyboard keys, etc. to obtain the access order of the model components. Finally, through composite calculation, the up and down access order number of the same model component in different user operation paths is obtained. For example, path L[0,1,2] represents that the user visited component 0, component 1 and component 2 in turn.
[0050] In an embodiment, the properties of the to-be-loaded components entering the component loading queue, i.e. neighborhood relationship, preset path and perspective trajectory, can be superimposed and calculated, and the initial weight value of the to-be-loaded component is given by multi-dimensional superimposed weight. Specifically, a starting weight value is assigned to each to-be-loaded component, which can be set to 0 for example. Then, according to the neighborhood relationship between components, a fixed value (e.g. 10) is added to the weight of the adjacent components to strengthen the priority of spatial proximity. That is, the weight of adjacent components will be relatively high, and they are more likely to be loaded first. Next, the weight is adjusted based on the preset path or movement trajectory. If there is a preset path, the next component in the preset path is found according to the current user's component position, and a larger value (e.g. 50) is added to the weight of the component to ensure continuity of preloading. Then, according to the movement trajectory of the model perspective, the next component that may be reached is determined, and additional weight is added to the component. Finally, one or more components adjacent to the model are found according to the neighborhood relationship, and thus the initial weight value of the to-be-loaded component is obtained by superimposing the weight values according to the three properties (neighborhood relationship, preset path and perspective trajectory).
[0051] In addition, in an embodiment, regarding the entry method of components entering the component loading queue, the components can be obtained according to the three static properties of neighborhood relationship, preset path and perspective trajectory. For example, one or more components are obtained according to the preset path, and their weights are increased by 50. Then, one or more components are obtained according to the perspective trajectory, and their weights are increased by 20 respectively. Then, one or more components are obtained according to the neighborhood relationship, and their weights are increased by 10 respectively. The above components form the current component loading queue. If a component meets multiple static properties described above, the weight values corresponding to the multiple static properties are added together as the initial weight. The components in the queue are sorted in descending order according to the size of the initial weight. If the weight values of the components are the same, they are sorted according to the attribute priority, i.e. according to the order of preset path, preset perspective and neighborhood relationship. If the weight values are the same and the attributes are also the same, the components with the same weight are sorted randomly. At the same time, in order to consider performance, the queue length can be set to a threshold value in advance. If the threshold is exceeded, the components will be discarded, otherwise they will be entered.
[0052] Figure 2A flowchart of component queuing is shown. After the flow starts, the current user's component position is obtained, then the next component in the preset path is found according to the component position where the current user is located, and a larger value (for example, 50) is added to the weight of the component to ensure continuous preloading; then according to the movement trajectory of the model view angle, the next component that can be reached is judged, and an additional weight value (for example, 20) is added to the component; finally, according to the model neighborhood relationship, one or more adjacent components are found, and a weight value (for example, 10) is added. Thus, according to the three attributes (preset path, view angle trajectory and neighborhood relationship), the initial weight value of the to-be-loaded component is obtained by superimposing the weight values. Then enter the sorting and queuing stage. First, judge whether the initial weight values are the same, if the same, sort according to the attribute priority, if different, sort in descending order of weight. Among them, if the attributes are completely consistent, then randomly sort within the group and sort in descending order of weight, if not, sort directly in descending order of weight. Then, prepare to join the queue. If the queue length does not exceed the threshold, directly enter the queue, otherwise discard.
[0053] Next, the initial weight value is fine-tuned according to the scene. First, determine the scene to which the 3D model belongs, and then calculate the fine-tuned weight value of the to-be-loaded component in the scene based on the semantic unit of the to-be-loaded component. In one embodiment, a corresponding relationship between the importance of components of different semantics in different scenes can be constructed in advance, so as to calculate the fine-tuned weight value based on the corresponding relationship. The importance of the to-be-loaded component in the scene is measured by the fine-tuned weight value, so that the same component has different weights in different scenes, thereby realizing that the importance of the component in the scene is considered as one of the factors for loading the component in different scenes, and the more important components in the scene are preferentially loaded, thereby improving the loading efficiency. For example, the target weight value of the component with semantic unit "metal patch" in the "industrial field / product details / surface treatment / ampere" application scene is 80, and the target weight value in the "virtual museum scene / display facility / cabinet / metal cabinet" application scene is 30. Since the component with semantic unit "metal patch" is more important in the 3D model of the industrial field, it has a higher weight in the industrial field scene than in the virtual museum scene, and will be preferentially loaded.
[0054] The final target weight value can be obtained by adding the initial weight value and the fine-tuned weight value. Then, according to the target weight value, the to-be-loaded components in the component loading queue are sorted in descending order, and the to-be-loaded components are loaded according to the sorting result.
[0055] The technical scheme of the embodiments of the present disclosure obtains the fine-tuning weight value of the component in different scenes based on the semantics of the component, measures the importance of the to-be-loaded component in the scene through the fine-tuning weight value, and therefore, when the to-be-loaded component is loaded according to the sorting result, the component semantics can be dynamically associated with the scene, the component with a greater weight is preferentially loaded based on the sorting of the target weight value in different scenes, and on the basis of meeting the model display effect requirement, the efficiency of model loading is improved.
[0056] Figure 3a The flowchart for calculating the fine-tuning weight value in the 3D model loading method provided by the embodiments of the present disclosure is shown in the figure. As shown in the figure, the method comprises:
[0057] S301, a semantic tree is obtained, wherein the semantic tree comprises a plurality of semantic nodes, the semantic tree is used for multi-level structured description of the component, and the semantic unit is a semantic node on the semantic tree.
[0058] S302, a relationship network of the semantic unit and the label is obtained, wherein the label is used for multi-dimensional description of the semantic unit.
[0059] S303, a scene tree of the scene is obtained, wherein the scene tree comprises a plurality of scene nodes, and the scene tree is used for multi-level structured description of the scene.
[0060] S304, a mapping matrix of each scene node and the label in the scene tree is obtained, in the mapping matrix, one scene node maps at least one label, and the label is also used as attribute information of the scene node mapped therewith.
[0061] S305, the target path from the root node of the scene tree to the target semantic node of the semantic unit of the to-be-loaded component in the semantic tree is obtained through traversal according to the mapping matrix and the relationship network.
[0062] S306, the fine-tuning weight value of the to-be-loaded component in the scene is calculated according to the target path.
[0063] The semantic tree, the relationship network, the scene tree and the mapping matrix can be constructed in advance and stored in the database.
[0064] The minimum semantic units of different components are first obtained, and then a tree-shaped semantic structure is constructed on this basis to form a hierarchical semantic organization. Therefore, the semantic tree includes multiple semantic nodes for multi-level structured description of the components. For example, the functional level is taken as the parent node (such as “transmission system → gear set → single gear”), and the geometric features are taken as the child nodes (such as “number of teeth” and “module”), forming a multi-level tree-shaped classification. Cross-granularity semantic reasoning is achieved through the tree node path (such as root node → mechanical device → rotating part → bearing). Among them, the semantic unit is a semantic node on the semantic tree (such as bearing). A semantic unit can belong to one semantic tree or multiple semantic trees.
[0065] Next, a relationship network between the semantic units and the labels is constructed to describe the semantic units in multiple dimensions through the labels. Specifically, a multi-dimensional label system is first constructed to give each basic semantic unit multiple pairs of attribute associations, forming a many-to-many association relationship between the minimum semantic units and the labels, and forming an entity-relationship network. The same semantic unit can correspond to multiple labels, and the same label can correspond to multiple semantic units. The labels include, for example, functional labels (such as
load bearing
separate space
lighting
concrete
wood
glass
indoor
outdoor
top floor
[0066] The scene tree is constructed based on prior knowledge of the scene. Each scene tree includes multiple scene nodes, and the scene tree is used for multi-level structured description of the scene. Specifically, a multi-level hierarchical structure is used to describe the business scene. The root node can define the global application field (such as industrial manufacturing), the second-level branch can be divided according to the business stage (such as design, production, and operation and maintenance), and the leaf node binds specific tasks (such as “assembly simulation” and “bearing fault diagnosis”).
[0067] In addition, the mapping matrix between the scene nodes and the labels in the scene tree needs to be established. In the mapping matrix, one scene node maps at least one label, and the label is also used as attribute information of the scene node mapped thereto. Specifically, in the embodiments of the present application, a scene context perception mechanism is introduced. According to specific application scenes (such as design simulation, production and manufacturing, and operation and maintenance), the labels are dynamically clustered based on the scene, and the scene-related attribute subsets under different scenes are filtered, so as to construct the mapping matrix between the scene nodes and the labels. Each scene node can map multiple labels as attributes. For example, the labels mapped in the field of architectural design can include
scheme display
construction drawing review
construction simulation
battle scene
exploration scene
social scene
cultural relic display
historical scene restoration
interactive experience
[0068] In the embodiment of the present application, when fine-tuning the weight according to the scene, the target path from the root node of the scene tree to the target semantic node of the semantic unit of the to-be-loaded component in the semantic tree is obtained by traversing according to the mapping matrix and the relationship network, and the fine-tuning weight value of the to-be-loaded component in the scene is calculated according to the target path.
[0069] Specifically, starting from the root node of the scene tree, the label mapped by each scene node can be obtained according to the mapping matrix, and the semantic unit corresponding to each label can be obtained according to the relationship network, so that the target path from the root node of the scene tree to the target semantic node of the semantic unit of the to-be-loaded component in the semantic tree can be obtained by traversing. In the target path, the label is found through the scene, and the semantic is found through the label, that is, the target semantic node is found. The number of target paths can be multiple.
[0070] In an embodiment, considering that the depth of the semantic tree, the depth of the scene tree and the number of labels are related to the importance of the component in the current scene, the deeper the depth and the more the labels, the more detailed the dimension and condition for describing the component, and a higher weight should be given. Therefore, the fine-tuning weight value can be calculated according to the depth of the semantic tree, the depth of the scene tree and the number of labels corresponding to the scene node and the semantic node in the target path.
[0071] Specifically, the fine-tuning weight value of the to-be-loaded component in the scene can be calculated according to the number of labels mapped by the deepest scene node in the target path in the mapping matrix, the number of labels corresponding to the target semantic node of the semantic unit of the to-be-loaded component in the semantic tree in the relationship network, the depth of the deepest scene node in the scene tree and the depth of the target semantic node in the semantic tree. Specifically, it includes:
[0072] The number of labels mapped by the deepest scene node in the target path in the mapping matrix is recorded as a first weight;
[0073] The number of labels corresponding to the target semantic node in the relationship network in the target path is recorded as a second weight;
[0074] The depth of the deepest scene node in the target path in the scene tree is recorded as a first depth;
[0075] The depth of the target semantic node in the semantic tree is recorded as a second depth;
[0076] The fine-tuning weight value of the to-be-loaded component in the scene is calculated according to the first weight, the second weight, the first depth and the second depth.
[0077] Wherein, one scene node can map multiple tags, the more the number of tags, the more detailed the description of the scene node, and the more the dimension of the attribute information of the scene node, and thus the first weight is greater. The semantic node on the semantic tree and the tag are in a one-to-many correspondence relationship, that is, the same semantic unit can correspond to multiple tags. Therefore, the number of tags corresponding to the target semantic node in the relationship network is observed, and is recorded as the second weight. The more the number of tags, the greater the second weight. The tag is used to describe the semantic unit, and thus the more the number of tags corresponding to the target semantic node, the more the dimension of the description information of the component to be loaded, the more detailed the description, and the greater the importance, and thus the greater the natural weight.
[0078] Next, the depth of the deepest scene node in the target path in the scene tree is recorded as the first depth, and the depth of the target semantic node in the semantic tree is recorded as the second depth. The greater the first depth and the second depth, the more detailed the scene condition of the component to be loaded in the scene, the richer the semantic information, and the greater the importance, and thus the depth information is also considered in the calculation of the fine-tuning weight value.
[0079] Finally, the fine-tuning weight value of the component to be loaded in the scene is calculated according to the first weight, the second weight, the first depth and the second depth. In one embodiment, the first weight, the second weight, the first depth and the second depth can be multiplied, and the product is taken as the fine-tuning weight value of the component to be loaded in the scene.
[0080] Figure 3b An example of the scene tree, the tag and the semantic tree in the embodiments of the present application. Wherein, the regular circle represents the semantic tree and the semantic node thereof, the oval represents the scene tree and the scene node thereof, and the rhombus represents the tag group. Figure 3b In the example shown, starting from the root node of the scene tree, the tag B is found through the scene node A, and the semantic node C is found through the tag B. The semantic node C is the target semantic node corresponding to the semantic unit of the component to be loaded in the semantic tree, and thus the scene node A, the tag B and the semantic node C can constitute a path. In the path, the scene node A is the deepest scene node, the depth of which in the scene tree is 4, the depth of the semantic node C in the semantic tree is 2, the number of tags mapped by the scene node A is 4, and the number of tags corresponding to the semantic node C is 3. The product of the above numbers is 96, which is the fine-tuning weight value of the component to be loaded in the current scene.
[0081] In addition, it also needs to be explained that, in the embodiment of the application, the importance of the to-be-loaded component in the current scene is measured according to the depth of the scene node and the semantic node and the number of labels corresponding to each of them, so as to determine the fine-tuning weight value. However, the specific calculation method is not limited in the embodiment of the application, and the fine-tuning weight value can be calculated by multiplication, addition or other specific calculation methods.
[0082] In summary, in the embodiment of the application, according to the current scene, the target path of the target semantic node of the semantic unit of the to-be-loaded component from the root node of the scene tree via the label in the semantic tree is found in the scene, label and semantic database by searching the label according to the scene and then searching the semantic according to the label. Then the fine-tuning weight value is calculated according to the target path. In this way, the application scene, the association strength between the label and the semantic can be combined to calculate and generate the scene-specific model component weight, to realize the differentiated weight of the same model component in different application scenes, so as to realize the dynamic model loading according to different scenes and improve the effect and efficiency of model loading.
[0083] For example, in the building park scene, it is first confirmed that the currently loaded 3D model belongs to the building park scene, and then the scene tree of the building park scene is searched through the database, and the semantic tree is obtained. The labels of the scene nodes in the scene tree are traversed, for example, the labels in the scene can include “building main structure”, “floor” and “room” and the like. Then the semantic is searched through the label, and finally the node of the semantic unit of the to-be-loaded component in the semantic tree is found. The semantic in the scene can include “load-bearing wall”, “frame” and “room on a certain floor” and the like. When the target path is obtained, the fine-tuning weight value of the to-be-loaded component can be calculated according to the depth of the scene node, the semantic depth and the mapping relationship between the scene and the label, and the corresponding relationship between the label and the semantic in the target path. For the building main structure component such as load-bearing wall and frame, it is essential to the basic form of the building in any browsing process, so the weight is relatively high and can be loaded preferentially.
[0084] When determining the semantic node depth, the distance of the semantic node corresponding to the semantic unit of the to-be-loaded component from the root node of the semantic tree is searched in the database, and is taken as the semantic depth. For example, “building park” is taken as the root node with a depth of 1, “building as a whole” is taken as the child node of “building park” with a depth of 2, “floor” is taken as the child node of “building as a whole” with a depth of 3, and “room” is taken as the child node of “floor” with a depth of 4. If the current concerned semantic is a component in a certain room, the semantic depth is 4.
[0085] When calculating the scene depth, the distance of the deepest scene node in the target path from the root node of the scene tree is found in the database and taken as the scene depth. If the user starts from the root node of the "building park scene" and enters a "certain building scene" with a depth of 2, and then enters a "certain floor scene" with a depth of 3. When the user is currently at a certain floor, the scene depth of the floor is 3.
[0086] For example, in a game scene, the mapped tags can include "mainline task", "copy", and "town center". The corresponding semantics include, for example, "monster on the mainline task path", "copy entrance area prop", and "town center NPC", etc. When calculating the semantic node depth, for example, "game world" is the root node with a depth of 1, "mainline task area" is the child node with a depth of 2, and "task target small area" is the child node of "mainline task area" with a depth of 3. If the currently focused component semantics is the monster in the task target small area, its depth is 3. When calculating the scene depth, for example, if the player starts from the root node of the "game world scene" and enters a "certain area scene" child node with a depth of 2, and then approaches a "copy entrance scene" child node with a depth of 3. When the player approaches a certain area (such as a copy entrance), the scene depth of the area is 3.
[0087] When the player approaches a certain area (such as a copy entrance), the model components of the area and adjacent areas (such as the preparation area outside the copy) have initial weights combined with semantic tree depth and scene tree depth to calculate the maximum weight. Based on the adjacency relationship and the possible player movement direction, the maximum weight is greater than that of other irrelevant area components. For scenes where the player often stays or frequently interacts (such as the town center), key buildings, NPCs, and other components in the scene have high initial weights, and the maximum weights are also high when combined with semantic tree depth and scene tree depth, so as to quickly load and improve game fluency.
[0088] In a virtual museum scene, tags such as "popular exhibits", "tour routes", and "auxiliary display components" can be included, and corresponding semantics such as "popular exhibit model", "next exhibit on the route", and "introduction panel" can be found. When calculating the semantic node depth, for example, "virtual museum" is the root node with a depth of 1, "exhibition area" is the child node with a depth of 2, and "exhibit small area" is the child node of "exhibition area" with a depth of 3. If the currently focused component semantics is the introduction panel of a certain exhibit, its depth is 3. When calculating the scene depth, if the user starts from the root node of the "virtual museum scene" and enters a "certain exhibition area scene" child node with a depth of 2, and then enters a "certain exhibit scene" child node with a depth of 3. When the user stops at a certain exhibit, the scene depth of the exhibit is 3.
[0089] When the user browses along the preset visiting route, the next exhibit and its component in the area on the route, the initial weight of which is combined with the semantic tree depth and the scene tree depth to calculate the maximum weight, is increased. If the user stays in front of an exhibit for a long time, the auxiliary display components (such as introduction boards, background decorations, etc.) around the exhibit, based on the adjacent relationship and the current focus of the user, combined with the semantic tree depth and the scene depth, the maximum weight is increased to provide a more complete display. For the division of different period or theme exhibition areas, if the user is browsing a theme exhibition, the exhibit components (such as the areas where the works of the same artist in different periods are located) in the adjacent theme exhibition area that have relevance, combined with their semantic tree depth and the current scene tree depth, the maximum weight is appropriately increased to facilitate the user to expand the browsing.
[0090] In the industrial design and manufacturing scene, tags such as "product core architecture", "design module", "frequently modified parts" can be included, and corresponding semantics such as "product core architecture component", "certain design module component", "frequently modified part model" are searched. When calculating the semantic node depth, for example, "industrial product design" is the root node with a depth of 1, "product overall architecture" is the child node with a depth of 2, and "detailed design module" is the child node of "product overall architecture" with a depth of 3. If the currently focused component semantics is a component in a certain detailed design module, its depth is 3. When calculating the scene depth, if the engineer starts from the "industrial design scene" root node, enters the "product overall architecture design scene" child node with a depth of 2, and then enters the "certain module design scene" child node with a depth of 3. When the engineer is designing a certain module, the module scene depth is 3.
[0091] When the engineer is designing a certain module, the initial weight of the adjacent module components of the module, combined with the semantic tree depth and the scene tree depth, is calculated to the maximum weight, and the maximum weight is increased according to the adjacent relationship. If there is a design standard process or a common design habit path (such as from power system design to transmission system design), the next design module component along this path, combined with its semantic tree depth and the current scene tree depth, the maximum weight is significantly increased, which facilitates quick switching of design focus and quick loading of related models. For frequently modified or adjusted parts, because their initial weight is high, combined with the semantic tree depth and the scene tree depth, the maximum weight is also high, which accelerates the loading speed and improves the design efficiency.
[0092] Figure 4 The 3D model loading method provided by the embodiment of the present application includes a flowchart for loading the to-be-loaded components. As shown in the figure, it includes:
[0093] S401, according to the target weight value, the to-be-loaded components in the component loading queue are sorted in descending order to obtain an initial loading queue.
[0094] S402, obtaining a current to-be-loaded component according to an order of the to-be-loaded components in the initial loading queue.
[0095] S403, if the current to-be-loaded component is already contained in the cache, then a next to-be-loaded component in the initial loading queue is taken as a new current to-be-loaded component.
[0096] S404, if the current to-be-loaded component is not contained in the cache, then it is determined whether the cache meets loading requirements of the current to-be-loaded component, if yes, S405 is executed, if not, S406 is executed.
[0097] S405, loading the current to-be-loaded component, and returning to execute the step of obtaining the component loading queue of the 3D model.
[0098] S406, loading the current to-be-loaded component after reducing the precision of the current to-be-loaded component.
[0099] Specifically, the target weight value is taken as a basis for ordering the to-be-loaded components in the component loading queue, and the to-be-loaded components with greater target weight values are preferentially loaded through descending ordering. For example, the first to-be-loaded component in the initial loading queue is taken as the current to-be-loaded component. It is first determined whether the cache already contains the component, if yes, repeated loading is not necessary, and the next to-be-loaded component in the initial loading queue is taken as a new current to-be-loaded component. If not, it is first determined whether the current cache meets loading requirements of the current to-be-loaded component, for example, it is determined whether there is sufficient cache space resource in the current cache for loading the current to-be-loaded component. If the current cache space is sufficient, the current to-be-loaded component can be directly loaded, and the step of obtaining the component loading queue of the 3D model is returned to be executed. Otherwise, the current to-be-loaded component is loaded after reducing the precision of the current to-be-loaded component. For example, the precision of the current to-be-loaded component is adjusted according to scene requirements, that is, a medium / low-precision model component instance is replaced.
[0100] Further, the current to-be-loaded component is loaded after reducing the precision of the current to-be-loaded component, which can specifically include:
[0101] reducing the precision of the current to-be-loaded component, and determining whether the cache meets loading requirements of the current to-be-loaded component after reducing the precision;
[0102] if yes, loading the current to-be-loaded component after reducing the precision, and returning to execute the step of obtaining the component loading queue of the 3D model;
[0103] if not, cleaning useless components in the cache before loading the current to-be-loaded component after reducing the precision.
[0104] Specifically, in the embodiment of the present application, after reducing the precision of the model component, a second cache verification is performed, that is, it is judged whether the cache meets the loading requirements of the current to-be-loaded component after reducing the precision. If yes, the current to-be-loaded component after reducing the precision can be directly loaded, and the step of obtaining the current component loading queue of the 3D model is returned to be executed. If no, the current to-be-loaded component after reducing the precision is loaded after cleaning the useless components in the cache.
[0105] Further, the current to-be-loaded component after reducing the precision is loaded after cleaning the useless components in the cache, which can specifically include:
[0106] obtaining and cleaning the useless components in the cache;
[0107] judging whether the cleaned cache meets the loading requirements of the current to-be-loaded component after reducing the precision;
[0108] if yes, loading the current to-be-loaded component after reducing the precision, and returning to execute the step of obtaining the current component loading queue of the 3D model;
[0109] if no, moving the current to-be-loaded component after reducing the precision to the tail of the initial loading queue, and setting the target weight value thereof to 0;
[0110] taking the next to-be-loaded component in the initial loading queue as a new current to-be-loaded component.
[0111] Specifically, the useless component can be a component not in the preloading queue, or a component with medium / low precision in the preloading queue, or a component with the largest file size, and the cache space is released by cleaning the useless components. If the current loading requirements are still not met after cleaning, the current to-be-loaded component after reducing the precision is moved to the tail of the initial loading queue, and the target weight value thereof is set to 0. If the target weight values of all to-be-loaded components in the initial loading queue are 0, the current process is ended. That is, when all components are loaded or degraded, the queue is globally traversed to check the weight state. If the weight is 0, the browser loading of the 3D model component is terminated.
[0112] It can be seen that, in the embodiment of the present application, after the sorting of the to-be-loaded queue is completed, the available cache, the component size, the precision version of a single component and the browser cache space cleaning are adjusted to realize the dynamic loading of the 3D model component and ensure the effective loading of the model.
[0113] Figure 5The flowchart of the component loading decision in the 3D model loading method provided by the embodiment of the present application is shown in the figure. As shown in the figure, firstly, the prediction queue and the weight of each component in the queue are obtained, and the current loading component is obtained according to the weight. If the current component is contained in the cache, it is not necessary to load, and the component with the next weight in the queue is selected to make the judgment again. If the current component is not contained in the cache, it is further judged whether the available cache can meet the loading requirement of the current component. If yes, the component is loaded normally, and the step of obtaining the prediction queue is returned to execute. If no, the model precision is reduced, and it is judged again whether the available cache can meet the loading requirement of the component after the precision is adjusted. If yes, the component is loaded, and if no, the useless component in the cache is found out, and the useless components are sorted according to the file size. The largest useless component in the file is deleted, the cache is released, and it is judged whether the available cache after the resource is released can meet the loading requirement. If yes, the component is loaded, and if no, the current component is moved to the end of the queue, and the weight of the current component is reduced to 0, and then the step of judging whether the cache contains the current component is returned to execute. When the weight of each component in the queue is 0, the flowchart ends.
[0114] Figure 6 The flowchart of cleaning the useless components in the 3D model loading method provided by the embodiment of the present application is shown in the figure. As shown in the figure, it includes:
[0115] S601, the initial cleaning score is calculated according to the size of each component in the cache.
[0116] S602, the initial cleaning score is adjusted to obtain the target cleaning score according to the model precision, activity and scene requirement of each component, and the real-time space usage rate of the cache.
[0117] S603, the useless components in the cache are determined according to the target cleaning score and the preset threshold, and the useless components are cleaned.
[0118] When the page containing the 3D model is opened for a long time in the browser, the page is often stuck or the browser crashes due to cache overflow. According to the page preview requirement, the model components need to be automatically cleaned to release the cache.
[0119] Specifically, before cleaning, the available cache capacity and total quota of the current browser can be obtained by using the storage interface provided by the browser to determine the size of the available cache space. Then, a dynamic threshold is set, that is, a dynamic threshold T is set according to the business scenario and device type requirement, which is used to balance the cache utilization and reserved safety space to avoid overflow caused by excessive use. For example, for mobile terminals, T = 1-30%, more space is reserved to prevent sudden lag. For PC terminals, T = 1-10%, higher cache occupancy is allowed to make full use of the cache. T is also the maximum available cache threshold, which is a percentage, that is, T = total cache - reserved cache ratio. The above logic is that mobile terminals need conservative strategy due to memory limitation, while PC terminals can aggressively load.
[0120] Real-time monitoring of cache usage, when the cache occupancy approaches or reaches the available threshold, the system automatically triggers an alarm mechanism to prompt developers to take measures such as cleaning redundant data and optimizing cache strategy to prevent cache overflow from affecting application performance. Specifically, a three-level response can be set, including a safe zone, a warning zone and a danger zone. The safe zone indicates that the current component can be normally loaded without triggering the cache release process. The warning zone indicates that the loading priority of non-critical components is reduced, and low-precision components are marked as candidate components for cleaning. The danger zone indicates that the forced cache release process should be started immediately, and new resource loading is suspended.
[0121] When it is determined that the useless components need to be cleaned, that is, when the cache release process is executed, the initial cleaning score of each component in the cache is calculated first, the larger the file size of the component, the higher the initial cleaning score, and the component is less likely to be cleaned, so that the component with large file size can be displayed preferentially. Then, the initial cleaning score is adjusted according to the model accuracy, activity and scene demand of each component, and the real-time usage rate of the cache space, to obtain the target cleaning score. Finally, the components with a target cleaning score less than a preset threshold in the cache are cleaned as useless components.
[0122] Among them, the higher the model accuracy, the higher the cleaning score. For example, the cleaning score of a high-precision component can be multiplied by 2, and the cleaning score of a low-precision component can be multiplied by 0.3. In this way, the priority of large files can be retained while suppressing low-precision resources from occupying high positions.
[0123] The activity is determined according to the number of accesses of the component in a historical time period and the time of the last access. In this embodiment, the frequency of access of the component in 72 hours and the latest use time interval are tracked, the short-term use intensity and the idle decay trend are quantified, and the high-frequency core component and the low-frequency to-be-released resource are identified. For example, the number of accesses of each component in the past 72 hours is recorded. The higher the access frequency, the more frequently the component is used, and a higher cleaning score should be given. For example, it can be set that for each additional access of the component in 72 hours, the score of the component is increased by 5. For another example, the time of the last access of each component is recorded, and the difference from the current time is calculated. The longer the time interval, the less frequently the component is used, and a lower cleaning score should be given. For example, it can be set that for each increase of 15 minutes from the time of the last access of the component, the cleaning score is reduced by 5.
[0124] The scenario demand is determined according to whether the component is located in the current perspective projection and the access path. In the embodiment of the application, it can be detected whether the component is in the visual area of the current user, and the spatial distance of the component from the next interaction node is calculated in combination with the preset navigation path, so as to strengthen the retention priority of the instant-use component and the path-adjacent component. Specifically, it is judged whether the component is currently in the perspective projection range of the user. If it is in the perspective, it means that the component is being used, and a higher score should be given. For example, the score of the component is increased by 100. The path distance between the component in the current perspective and the next component in the preset access path can also be calculated. The closer the distance, the more likely the component is to be accessed next, and a higher score should be given. For example, for the next component of the preset path, the score of the component is increased by 50, and the score is reduced by 5 for each additional path.
[0125] In the embodiment of the application, the initial cleaning score is also adjusted according to the real-time usage rate of the cache space. Specifically, the global score is dynamically adjusted according to the real-time usage rate of the cache space, the score of the non-core component is reduced in high load, and the retention strategy is relaxed in low load. The usage of the cache is monitored in real time, the usage rate of the current cache is calculated, and the high and low of the cache usage rate will affect the scores of all components. The score can be adjusted accordingly according to different usage rate ranges. For example, if the usage rate of the available cache is between 0-30%, the score of all components is reduced by 30; if it is between 30%-50%, the score of all components is reduced by 20; if it is between 50%-70%, the score of all components is reduced by 10; and if it is above 70%, the score of all components is increased by 10.
[0126] Therefore, the embodiment of the present application modifies the initial cleaning score by comprehensively considering the recent access frequency of the component, whether it is in the current visible area, the idle time decay, and the degree of association with the preset navigation path, and superimposing the real-time cache load state. The dynamic score is generated according to the component activity and the scene demand, the high-frequency use, the in-view and the path key resources are preferentially guaranteed, the components with lower target cleaning score are released as the cleaning objects, the cache is released, the situation of page freezing or browser crash is reduced on the basis of guaranteeing the model display effect, and the efficiency of model loading is improved.
[0127] Figure 7 The flowchart of the process of releasing the cache in the 3D model loading method provided by the embodiment of the present application is shown in the figure. As shown in the figure, first, the available cache of the browser is obtained, and it is judged whether the available cache is less than the threshold value. If yes, it can be directly ended, and if no, the cache release process is entered. First, the file amount of the components in the cache is obtained, and the order of the components is sorted according to the file size. At this time, a component queue can be obtained, the components in the queue are calculated based on the file size, and the score is arranged in descending order according to the score. Then, the sorting is adjusted according to the component precision, for example, the high-precision components are moved forward in the queue, and the low-precision components are moved backward. Then, according to the access time, every time the component is accessed more than once within 72 hours, the score is increased by 5. Then, it is judged whether the component is in the current visual angle projection. If yes, the score is increased by 100. Then, the length of time since the last access of the component is confirmed, and the score is reduced by 5 every 15 minutes. If the component is the next component of the preset path, the score is increased by 50; and the score is reduced by 5 every deviation from the path. Finally, the score is adjusted according to the cache. Thus, the final score is obtained by multi-dimensional adjustment. If the component score is lower than the preset threshold value, such as 70, it means that the component is a useless component, and enters the cleaning queue for cleaning, until the length of the component queue is 0. If there is no component with a score less than 70 at present, the score is adjusted, the process of "every time the component is accessed more than once within 72 hours, the score is increased by 5" is returned to execute, and the following processes are repeatedly executed.
[0128] Figure 8 The structural schematic diagram of a 3D model loading device provided by the embodiment of the present application is shown in the figure. Figure 8 As shown in the figure, the 3D model loading device 80 comprises:
[0129] A model division module 810 is configured to divide a 3D model into a plurality of components by spatial grid division.
[0130] A data determination module 820 is configured to determine multi-dimensional data of each of the components, wherein the multi-dimensional data at least comprises semantic units.
[0131] The queue obtaining module 830 is configured to obtain a current component loading queue of the 3D model and initial weight values of components to be loaded in the component loading queue;
[0132] The fine-tuning weight value calculating module 840 is configured to determine a scene to which the 3D model belongs, and calculate a fine-tuning weight value of the component to be loaded in the scene based on the semantic unit of the component to be loaded, where the fine-tuning weight value is used to measure an importance of the component to be loaded in the scene.
[0133] The target weight value calculating module 850 is configured to calculate a target weight value according to the initial weight value and the fine-tuning weight value.
[0134] The component loading module 860 is configured to sort the components to be loaded in the component loading queue according to the target weight value, and load the components to be loaded according to a result of the sorting.
[0135] In some embodiments, the fine-tuning weight value calculating module 840 includes:
[0136] The semantic tree obtaining unit is configured to obtain a semantic tree, where the semantic tree includes a plurality of semantic nodes, the semantic tree is used for a multi-level structured description of the components, and the semantic unit is used as a semantic node on the semantic tree.
[0137] The relationship network obtaining unit is configured to obtain a relationship network of the semantic unit and a label, where the label is used for a multi-dimensional description of the semantic unit.
[0138] The scene tree obtaining unit is configured to obtain a scene tree of the scene, where the scene tree includes a plurality of scene nodes, and the scene tree is used for a multi-level structured description of the scene.
[0139] The mapping matrix obtaining unit is configured to obtain a mapping matrix of each scene node in the scene tree and the label, where one scene node maps at least one label in the mapping matrix, and the label is also used as attribute information of the scene node mapped thereto.
[0140] The target path obtaining unit is configured to traverse according to the mapping matrix and the relationship network to obtain a target path from a root node of the scene tree to a target semantic node of the semantic unit of the component to be loaded in the semantic tree.
[0141] The fine-tuning weight value calculating unit is configured to calculate the fine-tuning weight value of the component to be loaded in the scene according to the target path.
[0142] In some embodiments, the fine-tuning weight value calculating unit includes:
[0143] a first weight obtaining subunit, configured to record a number of labels of a scene node with a deepest depth in the target path in the mapping matrix as a first weight;
[0144] a second weight obtaining subunit, configured to record a number of labels of a label corresponding to the target semantic node in the relationship network in the target path as a second weight;
[0145] a first depth obtaining subunit, configured to record a depth of the scene node with the deepest depth in the target path in the scene tree as a first depth;
[0146] a second depth obtaining subunit, configured to record a depth of the target semantic node in the semantic tree as a second depth;
[0147] a fine-tuning weight value calculating subunit, configured to calculate a fine-tuning weight value of the component to be loaded in the scene according to the first weight, the second weight, the first depth, and the second depth.
[0148] In some embodiments, the fine-tuning weight value calculating subunit is specifically configured to:
[0149] multiply the first weight, the second weight, the first depth, and the second depth, and take a product as the fine-tuning weight value of the component to be loaded in the scene.
[0150] In some embodiments, the multi-dimension data further comprises neighborhood relations, preset paths, and perspective trajectories of the components.
[0151] The initial weight value is calculated according to the neighborhood relations, preset paths, and perspective trajectories of the components to be loaded respectively.
[0152] In some embodiments, the target weight value calculating module 850 is specifically configured to:
[0153] add the initial weight value and the fine-tuning weight value, and take a sum value obtained as the target weight value.
[0154] In some embodiments, the component loading module 860 comprises:
[0155] a descending order sorting unit, configured to sort the components to be loaded in the component loading queue in descending order according to the target weight value, to obtain an initial loading queue;
[0156] a current component to be loaded obtaining unit, configured to obtain a current component to be loaded according to an order of the components to be loaded in the initial loading queue.
[0157] the first branch processing unit is configured to, if the current component to be loaded is contained in the cache, take the next component to be loaded in the initial loading queue as a new current component to be loaded;
[0158] the second branch processing unit is configured to, if the current component to be loaded is not contained in the cache, determine whether the cache meets loading requirements of the current component to be loaded;
[0159] the third branch processing unit is configured to, if the second branch processing unit determines that the cache meets the loading requirements of the current component to be loaded, load the current component to be loaded, and return to the step of obtaining the component loading queue of the 3D model at present;
[0160] the third branch processing unit is configured to, if the second branch processing unit determines that the cache does not meet the loading requirements of the current component to be loaded, load the current component to be loaded after reducing the precision of the current component to be loaded.
[0161] In some embodiments, the third branch processing unit is specifically configured to:
[0162] reduce the precision of the current component to be loaded, and determine whether the cache meets loading requirements of the current component to be loaded after the precision is reduced;
[0163] if yes, load the current component to be loaded after the precision is reduced, and return to the step of obtaining the component loading queue of the 3D model at present;
[0164] if no, clean up useless components in the cache, and then load the current component to be loaded after the precision is reduced.
[0165] In some embodiments, the third branch processing unit is specifically further configured to:
[0166] obtain useless components in the cache and clean up the useless components;
[0167] determine whether the cache after the cleaning meets the loading requirements of the current component to be loaded after the precision is reduced;
[0168] if yes, load the current component to be loaded after the precision is reduced, and return to the step of obtaining the component loading queue of the 3D model at present;
[0169] if no, move the current component to be loaded after the precision is reduced to the tail of the initial loading queue, and set a target weight value of the current component to be loaded to 0;
[0170] take the next component to be loaded in the initial loading queue as a new current component to be loaded.
[0171] In some embodiments, the apparatus further comprises:
[0172] an ending module configured to end the current process when the target weight value of all the components to be loaded in the initial loading queue is 0.
[0173] In some embodiments, the third branch processing unit is specifically further configured to:
[0174] calculate an initial cleaning score according to the size of each component in the cache;
[0175] adjust the initial cleaning score according to the model accuracy, activity and scene requirement of each component, and the real-time usage rate of the space of the cache, to obtain a target cleaning score;
[0176] determine the useless components in the cache according to the target cleaning score and a preset threshold, and clean up the useless components.
[0177] In some embodiments, the activity is determined according to the access times of the component in a historical time period and the time of the last access, and the scene requirement is determined according to whether the component is located in the current perspective projection and the access path.
[0178] The 3D model loading apparatus provided by the embodiments of the present application can be used to execute the technical solutions of the 3D model loading method in the above embodiments, and has similar implementation principles and technical effects, which will not be described here.
[0179] It should be noted that the division of each module of the above apparatus is only a logical functional division, and all or part of the modules can be integrated into one physical entity, or can be physically separated. These modules can all be implemented in the form of software called by a processing element; all can be implemented in the form of hardware; or part of the modules can be implemented in the form of software called by a processing element, and part of the modules can be implemented in the form of hardware. For example, the fine-tuning weight value calculation module 840 can be a separately established processing element, or can be integrated into a chip of the above apparatus, and in addition, the fine-tuning weight value calculation module 840 can be stored in the form of program code in the memory of the above apparatus, and the functions of the fine-tuning weight value calculation module 840 can be called and executed by a processing element of the above apparatus. The implementation of other modules is similar. In addition, all or part of the modules can be integrated together, or can be independently implemented. The processing element here can be an integrated circuit with signal processing capability. In the implementation process, each step of the above method or each of the above modules can be completed by the integrated logic circuit of hardware or the instruction of software in the processing element.
[0180] Figure 9 The structural schematic diagram of the electronic device provided by the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, the electronic device 100 includes a processor 110, a memory 120, a communication interface 130, and a power supply 140.Figure 9 As shown in the figure, the electronic device can include a transceiver 121, a processor 122, and a memory 123.
[0181] The processor 122 executes computer-executed instructions stored in the memory, so that the processor 122 executes the solutions in the above-mentioned embodiments. The processor 122 can be a general-purpose processor, including a central processing unit CPU, a network processor NP, etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0182] The memory 123 is connected with the processor 122 through a system bus and completes mutual communication, and the memory 123 is used for storing computer program instructions.
[0183] The transceiver 121 can be used to obtain a to-be-run task and configuration information of the to-be-run task.
[0184] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries and read-only libraries). The memory can include random access memory (RAM), and can also include non-volatile memory.
[0185] The electronic device provided by the embodiments of the present application can be the terminal device of the above-mentioned embodiments.
[0186] The embodiments of the present application further provide a computer readable storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer executes the technical solutions of the 3D model loading method of the above-mentioned embodiments.
[0187] The embodiments of the present application further provide a computer program product, which includes a computer program stored in a computer readable storage medium, at least one processor can read the computer program from the computer readable storage medium, and when the at least one processor executes the computer program, the technical solutions of the 3D model loading method in the above-mentioned embodiments can be realized.
[0188] In one embodiment, the computer program code is executed using a computer program product. The computer program code can be executed using one or more computer processors that are part of a computing device. The computer program code can be executed using a plurality of different computer readable media including, but not limited to, one or more of machine-readable storage media and machine-readable transmission media. Machine-readable storage media can include, without limitation, non-transitory storage media and / or storage devices such as magnetic disks, optical disks, solid state memory devices, and the like. Machine-readable transmission media can include, without limitation, carrier waves and other propagating media that can be used to propagate computer program code through the Internet or other transmission media.
[0189] It is noted that the foregoing examples have been provided merely for the purposes of illustration and are not intended to limit the application of the application. Other variations of the examples described herein will be recognized by those of reasonable skill in the art and which are intended to be encompassed by the described examples. For example, elements of one example can be combined with elements of another example. Further, it will be recognized that variations of the examples described herein are possible and are contemplated to be within the scope of the application. For purposes of example, the examples described herein are described in the context of a single user. However, it will be recognized that the examples described herein can be used in the context of multiple users.
Claims
1. A 3D model loading method, characterized by, The method comprises the following steps: spatially meshing a 3D model to obtain a plurality of components; determining respective multi-dimensional data of the components, wherein the multi-dimensional data at least includes semantic units; obtaining a current component loading queue of the 3D model, and initial weight values of respective components to be loaded in the component loading queue; determining a scene to which the 3D model belongs, and calculating a fine-tuning weight value of the component to be loaded in the scene based on the semantic units of the component to be loaded, wherein the fine-tuning weight value is used to measure the importance of the component to be loaded in the scene; calculating a target weight value according to the initial weight value and the fine-tuning weight value; sorting the component to be loaded in the component loading queue according to the target weight value, and loading the component to be loaded according to the sorting result; wherein the fine-tuning weight value of the component to be loaded in the scene is calculated based on the semantic units of the component to be loaded, and comprises the following steps: obtaining a semantic tree, wherein the semantic tree includes a plurality of semantic nodes, the semantic tree is used for multi-level structured description of the components, and the semantic units are used as one of the semantic nodes on the semantic tree; obtaining a relationship network between the semantic units and labels, wherein the labels are used for multi-dimensional description of the semantic units; obtaining a scene tree of the scene, wherein the scene tree includes a plurality of scene nodes, and the scene tree is used for multi-level structured description of the scene; obtaining a mapping matrix between each scene node in the scene tree and the labels, wherein one scene node in the mapping matrix maps at least one label, and the label is also used as attribute information of the scene node mapped thereto; traversing the mapping matrix and the relationship network to obtain a target path from a root node of the scene tree to a target semantic node of the semantic unit of the component to be loaded in the semantic tree; calculating the fine-tuning weight value of the component to be loaded in the scene according to the target path.
2. The method of claim 1, wherein, The calculation of the fine-tuning weight value of the component to be loaded in the scene according to the target path comprises the following steps: taking the number of labels mapped by the deepest scene node in the target path in the mapping matrix as a first weight; taking the number of labels corresponding to the target semantic node in the relationship network as a second weight; taking the depth of the deepest scene node in the target path in the scene tree as a first depth; taking the depth of the target semantic node in the semantic tree as a second depth; calculating the fine-tuning weight value of the component to be loaded in the scene according to the first weight, the second weight, the first depth and the second depth.
3. The method of claim 2, wherein, The calculation of the fine-tuning weight value of the component to be loaded in the scene according to the first weight, the second weight, the first depth and the second depth comprises the following steps: multiplying the first weight, the second weight, the first depth and the second depth, and taking the product as the fine-tuning weight value of the component to be loaded in the scene.
4. The method of claim 1, wherein, The multi-dimensional data further comprises neighborhood relations, preset paths and perspective trajectories of the components. The initial weight values are calculated according to the neighborhood relations, preset paths and perspective trajectories of the components to be loaded.
5. The method of claim 1, wherein, The target weight values are calculated according to the initial weight values and the fine-tuned weight values, comprising: The initial weight values are added to the fine-tuned weight values, and the sum is taken as the target weight values.
6. The method of claim 1, wherein, The components to be loaded in the component loading queue are sorted according to the target weight values, and the components to be loaded are loaded according to the sorting results, comprising: The components to be loaded in the component loading queue are sorted in descending order according to the target weight values to obtain an initial loading queue; A current component to be loaded is obtained according to the order of the components to be loaded in the initial loading queue; If the current component to be loaded is already contained in the cache, the next component to be loaded in the initial loading queue is taken as a new current component to be loaded; If the current component to be loaded is not contained in the cache, it is determined whether the cache meets the loading requirements of the current component to be loaded; If yes, the current component to be loaded is loaded, and the step of obtaining the current component loading queue of the 3D model is executed again; If no, the current component to be loaded is loaded after its precision is reduced.
7. The method of claim 6, wherein, The current component to be loaded is loaded after its precision is reduced, comprising: The precision of the current component to be loaded is reduced, and it is determined whether the cache meets the loading requirements of the current component to be loaded after the precision is reduced; If yes, the current component to be loaded after the precision is reduced is loaded, and the step of obtaining the current component loading queue of the 3D model is executed again; If no, the current component to be loaded after the precision is reduced is loaded after useless components in the cache are cleaned up.
8. The method of claim 7, wherein, The current component to be loaded after the precision is reduced is loaded after useless components in the cache are cleaned up, comprising: Useless components in the cache are obtained and cleaned up; It is determined whether the cache after cleaning up meets the loading requirements of the current component to be loaded after the precision is reduced; If yes, the current component to be loaded after the precision is reduced is loaded, and the step of obtaining the current component loading queue of the 3D model is executed again; If no, the current component to be loaded after the precision is reduced is moved to the tail of the initial loading queue, and its target weight value is set to 0; The next component to be loaded in the initial loading queue is taken as a new current component to be loaded.
9. The method of claim 8, wherein, Further comprising: If the target weight values of all the components to be loaded in the initial loading queue are 0, the current process is ended.
10. The method of claim 8, wherein, The useless components in the cache are obtained and cleaned up, comprising: Initial cleaning scores are calculated according to the sizes of the components in the cache; Target cleaning scores are obtained by adjusting the initial cleaning scores according to the model precision, activity and scene demand of the components, and the real-time space usage rate of the cache; Components in the cache with target cleaning scores less than a preset threshold are taken as useless components and cleaned up.
11. The method of claim 10, wherein, The activity is determined according to the access times of the components in a historical time period and the time of the last access, and the scene requirement is determined according to whether the components are located in the current perspective projection and the access path.
12. A 3D model loading apparatus characterized by comprising: Comprise: The model division module is used for spatial grid division of the 3D model, and a plurality of components are obtained. The data determination module is used for determining the respective multi-dimensional data of the components, wherein the multi-dimensional data at least comprises semantic units. The queue acquisition module is used for acquiring the current component loading queue of the 3D model and the respective initial weight values of the to-be-loaded components in the component loading queue. The fine-tuning weight value calculation module is used for determining the scene to which the 3D model belongs, and calculating the fine-tuning weight value of the to-be-loaded component in the scene based on the semantic unit of the to-be-loaded component, wherein the fine-tuning weight value is used for measuring the importance of the to-be-loaded component in the scene. The target weight value calculation module is used for calculating the target weight value according to the initial weight value and the fine-tuning weight value. The component loading module is used for sorting the to-be-loaded components in the component loading queue according to the target weight value, and loading the to-be-loaded components according to the sorting result. The fine-tuning weight value calculation module comprises: The semantic tree acquisition unit is used for acquiring a semantic tree, wherein the semantic tree comprises a plurality of semantic nodes, the semantic tree is used for multi-level structured description of the components, and the semantic unit serves as a semantic node on the semantic tree. The relationship network acquisition unit is used for acquiring a relationship network of the semantic unit and a label, wherein the label is used for multi-dimensional description of the semantic unit. The scene tree acquisition unit is used for acquiring a scene tree of the scene, wherein the scene tree comprises a plurality of scene nodes, and the scene tree is used for multi-level structured description of the scene. The mapping matrix acquisition unit is used for acquiring a mapping matrix of each scene node in the scene tree and the label, wherein one scene node maps at least one label in the mapping matrix, and the label is also used as attribute information of the scene node mapped therewith. The target path acquisition unit is used for acquiring a target path of a target semantic node of the semantic unit in the semantic tree from a root node of the scene tree to the to-be-loaded component according to the mapping matrix and the relationship network. The fine-tuning weight value calculation unit is used for calculating the fine-tuning weight value of the to-be-loaded component in the scene according to the target path.
13. An electronic device, comprising: Comprise: A processor and a memory connected with the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to realize the 3D model loading method in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to realize the 3D model loading method in any one of claims 1-11.
15. A computer program product, characterised in that, The computer program comprises a computer program which, when executed by a processor, implements the 3D model loading method of any one of claims 1-11.
Citation Information
Patent Citations
Three-dimensional scene data loading and displaying method and electronic equipment
CN119917687A
Digital twin integrated system
CN120107490A