WebGL-based pipe network digital twin model lightweight rendering method

By using a lightweight rendering method based on WebGL and leveraging instance pool reuse and visibility filtering strategies, the memory consumption problem of large-scale pipeline models on the Web client is solved, enabling smooth rendering and interaction on low-performance devices while maintaining real-time visualization of scene details.

CN121527280AActive Publication Date: 2026-02-13ZHONGRUIHENG (BEIJING) TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202610044297.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-14
Publication Date
2026-02-13
Estimated Expiration
2046-01-14

AI Technical Summary

Technical Problem

In existing technologies, when loading large-scale 3D models on the web, the memory usage of digital twin models of pipeline networks increases sharply, causing browser crashes or lag. Furthermore, it is impossible to achieve smooth interaction and roaming on low-performance devices, making it difficult to achieve real-time visualization of both macro scenes and local details.

Method used

A lightweight rendering method based on WebGL is adopted, which reduces memory consumption and optimizes rendering frame rate through instance pool reuse, visibility filtering strategy and instance management strategy. This includes resource pre-configuration, instance template generation, placeholder creation and visibility filtering, combined with dynamic adjustment of detail level.

Benefits of technology

It achieves smooth rendering and interaction of large-scale pipeline models on the Web, reduces memory usage by more than 90%, maintains a smooth interactive frame rate of 30-60 FPS on low-performance devices, and takes into account both macro scenes and local details in real-time visualization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121527280A_ABST
    Figure CN121527280A_ABST
Patent Text Reader

Abstract

The invention relates to a network digital twinborn model lightweight rendering method based on WebGL. The method comprises the steps of resource pre-configuration, wherein grid data of different three-dimensional models are used for generating corresponding instance templates; generating instances through the instance template and storing the instances in an instance pool; a lightweight placeholder containing calling data and dynamic data is created in the scene graph, the calling data is used for extracting the instance, and the dynamic data is used for adjusting dynamic display of the instance; light-weight rendering: setting a visibility screening strategy of placeholders, and judging whether the current placeholders are visible or not according to screening conditions of intersection of levels, distances, viewing angles and visual cones in sequence; setting an instance management strategy, binding placeholders screened to be visible and corresponding instances called from an instance pool, recording a binding relationship, unbinding placeholders screened to be invisible, and marking the unbound instances as idle; and rendering and outputting placeholders of the bound instances. And the memory occupation during rendering is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of building energy system digital twinning, in particular to a pipe network digital twinning model lightweight rendering method based on WebGL. BACKGROUND

[0002] In the application of building energy system digital twinning, the Web-side visualization of the pipe network model is the core link to realize remote monitoring and operation and maintenance. In the prior art, the pipe network digital twinning model needs to be manually modeled by external software such as 3DMax and Revit, and then imported into the Web-side for rendering. There are the following key problems: 1. Linear growth of memory occupation and model quantity: when loading large-scale three-dimensional pipe network models on the Web-side, each model entity corresponds to independent mesh data. When the number of models reaches tens of thousands, the browser memory occupation increases sharply, which easily causes crashes or stalls; 2. Poor adaptability to low-performance devices: the traditional rendering method is not optimized for ordinary PCs, mobile devices and other low-performance devices, and cannot realize smooth interaction and roaming of large-scale pipe models; 3. Conflict between detail level and loading efficiency: the model loading speed is slow, and the detail level is single. If a high-definition model is used, the loading delay is high, and if a simplified model is used, the local details are missing, which is difficult to meet the real-time visualization needs of macro scenes and local details.

[0003] To solve the above problems, a lightweight rendering method is needed to reduce memory consumption and hardware dependence while realizing smooth rendering and interaction of large-scale pipe network models. SUMMARY

[0004] To solve the above technical problems, the present application provides a pipe network digital twinning model lightweight rendering method based on WebGL. This method combines the advantages of constant memory consumption, rendering frame rate optimization and multi-device universality, and can realize lightweight rendering of pipe network digital twinning models based on WebGL.

[0005] In the first aspect, to achieve the above technical purpose, the present application adopts the following technical solution: The present application specifically relates to a pipe network digital twinning model lightweight rendering method based on WebGL, which comprises: Resource pre-configuration: Generate instance templates corresponding to the mesh data of different three-dimensional models; Generate instances from the instance templates and store them in an instance pool; Create lightweight placeholders containing call data and dynamic data in the scene graph, the call data is used to extract the instances, and the dynamic data is used to adjust the dynamic display of the instances; Lightweight rendering: Setting a visibility filtering strategy of the placeholder, judging whether the current placeholder is visible or not by filtering conditions of level, distance and view angle, and view pyramid intersection in turn; Setting an instance management strategy, calling corresponding instances from the instance pool to bind with the placeholder filtered as visible, and recording the binding relationship, and unbinding the placeholder filtered as invisible, and marking the unbound instance as idle; Rendering the placeholder of the bound instance.

[0006] Preferably, the generating of the grid data of different three-dimensional models into corresponding instance templates further comprises dividing the same model into multiple versions of different levels of detail, encapsulating the models of different versions of precision into an instance template, and adding switching thresholds at different distances in the instance template.

[0007] Preferably, the creating of the lightweight placeholder containing calling data and dynamic data in the scene graph comprises setting the unique identifier, resource path and world transformation information of the model as the calling data, and setting the bounding box and camera distance as the dynamic data.

[0008] Preferably, the method further comprises grouping the placeholders according to the model type, calculating the maximum capacity of the instance pool of each group of placeholders according to the upper limit of memory, setting an instance preloading strategy, and starting the preloading strategy if the instance pool is not established or does not exceed the maximum capacity.

[0009] Preferably, the method of judging whether the current placeholder is visible or not by filtering conditions of level, distance and view angle, and view pyramid intersection in turn comprises: Recursively checking the visibility of the current placeholder and the placeholder of the previous level, if it is visible, then proceed to the next step, otherwise end; Calculating the distance and view angle of the current placeholder, eliminating the placeholders beyond the maximum visible distance and the maximum field of view of the camera, and reserving the remaining placeholders for the next step; Using the camera view pyramid and the bounding box of the placeholder to perform spatial intersection detection, and reserving the placeholders with intersection as visible placeholders.

[0010] Preferably, the setting of the visibility filtering strategy of the placeholder further comprises setting the execution frequency of the filtering strategy by identifying the memory capacity of the device, and scheduling the execution by timestamp.

[0011] Preferably, the method further comprises arranging the visible placeholders in priority, and binding the instances according to the priority arrangement order from high to low, and the priority arrangement method is: Calculating the distance and view angle offset angle values of all visible placeholders and the camera; Weighting the distance value and the offset angle value respectively, and calculating the visual importance score after weighting, and the calculation formula is as follows: S=(1-a / b) x delta1+(1-c / d) x delta2; Wherein S is a visual importance score, a distance value, b is a maximum visible distance value of the camera, c is an angle of view offset angle, d is a maximum angle of view offset angle, delta1 is a first weight, delta2 is a second weight; The visual importance scores are sorted in descending order by a bisection insertion algorithm, and the priorities are in descending order.

[0012] Preferably, the setting instance management strategy further comprises a business state synchronization callback, when a placeholder binds an instance, checking whether the placeholder defines a callback function, if yes, calling the function and passing the business data of the current placeholder to the newly bound instance.

[0013] In a third aspect, the present application further discloses a WebGL-based pipe network digital twin model lightweight rendering system, comprising: A resource pre-configuration unit: An instance template generation module, configured to generate corresponding instance templates from mesh data of different three-dimensional models; An instance generation module, configured to generate instances from the instance templates and store the instances in an instance pool; A placeholder creation module, configured to create lightweight placeholders containing calling data and dynamic data in a scene graph, the calling data being used to extract the instances, and the dynamic data being used to adjust dynamic display of the instances; A lightweight rendering unit: A visibility screening module, configured to set a visibility screening strategy of the placeholders, and determine whether a current placeholder is visible by screening conditions of hierarchy, distance and angle of view, and view volume intersection in sequence; An instance management module, configured to set an instance management strategy, bind corresponding instances from the instance pool to the placeholders screened as visible, and record the binding relationship, and unbind the placeholders screened as invisible, and mark the unbound instances as idle; A rendering output module, configured to render and output the placeholders of the bound instances.

[0014] In a third aspect, the present application further discloses a terminal comprising a processor and a storage medium; the storage medium is used for storing instructions; the processor is used for operating according to the instructions to perform the steps of the method in the first aspect.

[0015] 1、The present application reuses the instance pool, only a fixed number of model mesh data is retained in the memory, the specific number is determined by the capacity of the instance pool, whether the scene contains tens of thousands or hundreds of thousands of logical model entities, the memory occupation is constant; compared with the traditional "one entity one grid" mode, the memory occupation is reduced by more than 90%, and the memory overflow problem of the Web end large-scale scene is completely solved.

[0016] 2. By utilizing visibility filtering strategies and dynamically setting update frequency, a smooth interactive frame rate of 30-60 FPS can be maintained on low-performance devices such as ordinary PCs and mobile devices, while high-end devices can achieve even higher frame rates. Attached Figure Description

[0017] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings: Figure 1 A flowchart of the lightweight rendering method for a WebGL-based digital twin model of a pipeline network according to the present invention is shown.

[0018] Figure 2 A schematic diagram of the pipeline system model display interface from a distant perspective of the present invention is shown.

[0019] Figure 3 A schematic diagram of the pipeline system model display interface from a close-up perspective of the present invention is shown.

[0020] Figure 4 A flowchart illustrating the lightweight rendering method of the present invention is shown. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0022] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0023] like Figure 1 As shown, this invention provides a lightweight rendering method for a WebGL-based digital twin model of a pipeline network, which specifically includes: Resource pre-configuration: Step S1: Generate corresponding instance templates from the mesh data of different 3D models; Step S2: Generate an instance using the instance template and store it in the instance pool; Step S3, creating a lightweight placeholder containing calling data for extracting the instance and dynamic data for adjusting the dynamic display of the instance in the scene graph; Lightweight rendering: Step S4, setting the visibility filtering strategy of the placeholder, judging whether the current placeholder is visible through the filtering conditions of hierarchy, distance and perspective, and view volume intersection in sequence; Step S5, setting the instance management strategy, for the placeholder filtered as visible, calling the corresponding instance from the instance pool for binding, and recording the binding relationship, and for the placeholder filtered as invisible, unbinding and marking the unbound instance as idle; Step S6, rendering and outputting the placeholder of the bound instance.

[0024] The whole method is composed of two parts, the first part is resource pre-configuration, three-dimensional models need to be manually modeled through 3DMax, Revit and other software, and in order to realize lightweight rendering display on the Web side, pre-prepared resource configuration is needed, in step S1, we know that the real entities of three-dimensional models are composed of grid data, such as a valve and a section of pipe, which are essentially rendered by grid data, and the grid data can be in the format of xls, xlsx, csv and other file formats, the grid data is the basic source of instance template, and the instance template is the basis for creating instance pool, all reusable instances in instance pool must be generated based on instance template to ensure the consistency of properties of the same type of instance. The above points are embodied in step S2, all instances in the instance pool must be generated based on the general configuration of the instance template to ensure the standardization of the same type of instance. Taking the heating pipe network system as an example, the system contains pipes, butterfly valves, gate valves, hangers and other components, so the components needed in the whole system are massive, if each component is added one by one, the efficiency is very low, so through general configuration, the same type of model can be generated in batches, which will greatly save the model construction time, and the instance template is equivalent to a batch tool, an instance template of a pipe can generate all the pipes needed in the system.

[0025] Step S3 is the pre-configuration of the placeholder, or take the warm pipe network system as an example, for each pipe network model entity (such as valve, pipe section), create a THREE.Object3D empty object as a placeholder in the Three.js scene graph, do not load the real three-dimensional grid data, because there is no grid data in the placeholder, so the occupied memory space is small, the placeholder is equivalent to the index of the instance, so the placeholder contains the calling data and dynamic data to find the corresponding instance, and to meet the difference of each instance, through the combination of placeholder and instance, both the individual differentiation needs of the scene and the lightweight goal are met, so the placeholder and the instance are one-to-one. After the above explanation of resource pre-configuration, it is equivalent to the preparation work before rendering, so as to perform the subsequent rendering operation.

[0026] Because the camera field of view size in the three-dimensional scene is certain, all placeholders do not need to be rendered, otherwise it violates the essence of lightweight, so it is necessary to determine whether the placeholder is in a visible state, in step S4, the visible state is further explained, and the filtering conditions of level, distance and view angle, view volume intersection are sequentially executed, all placeholders are filtered from coarse to fine, as step S5 said, only the visible placeholder can bind the instance for rendering, thereby greatly reducing the rendering pressure of GPU, through step S5 instance binding and unbinding, the recycling of instances is realized, for example, 1000 pipe placeholders do not need to load models respectively, but reuse instances in the instance pool (such as 200 instances are recycled to 1000 placeholders), only 200 model instance grid data is retained in the memory, not 1000, which greatly reduces the memory occupation.

[0027] The above is a rough description of the entire rendering process, now each step is further detailed and expanded to achieve the purpose of enhancing practical effect, in step S1, the generation of the corresponding instance template from the grid data of different three-dimensional models also includes dividing the same model into multiple versions of different levels of detail, encapsulating models of different versions of precision into an instance template, and adding switching thresholds at different distances in the instance template. If all instances are rendered according to the "highest resolution version", such as displaying the details of pipe, butterfly valve, gate valve, support and hanger regardless of the distance, it will cause "redundant face calculation" of the model far away, such as the valve 100 meters away, the high-definition version has 1500 faces, but only occupies one pixel on the screen, rendering 1500 faces causes waste of GPU resources; if all are rendered according to the "simplified version", the model near the place will be blurred and lose key details, so when generating the instance template, different versions of different levels of detail need to be encapsulated into an instance template, different versions of instances are generated, and instances are bound for rendering according to the requirements, different versions of instances are generated through distance, such as Figure 2 and Figure 3The pipe network system display interface under the far view and the close view perspective in sequence, in Figure 2 The picture under the far view perspective can overview the distribution of the whole pipe network system pipe, even if the detail picture of the support hanger between the pipes is not clearly displayed, it does not affect the whole overview effect, while in Figure 3 The picture under the close view perspective displays the details of the support hanger between the pipes, so the support hanger needs to be rendered in detail, therefore Figure 3 The rendering precision of the scene is higher than Figure 2 The rendering precision of the scene, so dividing the same model into multiple versions of different levels of detail can meet the display requirements while reducing the rendering power consumption.

[0028] In step S3, the creation of the lightweight placeholder containing the calling data and the dynamic data in the scene graph includes setting the unique identifier of the model, the resource path and the world transformation information as the calling data, setting the bounding box and the camera distance as the dynamic data, determining the uniqueness of the instance through the unique identifier, because it can be seen in the subsequent that each instance is bound with a placeholder, which is a one-to-one correspondence relationship, avoiding the confusion between the placeholder and the instance, determining the uniqueness of the instance through the unique identifier, finding the desired instance from the instance pool through the resource path, the world transformation information is used to show the difference of the same type of instance after rendering, for example, a 3-story east corridor has 20 pipe sections, a 5-story west machine room has 30 pipe sections, and a basement pump room has 15 pipe sections, a total of 65 independent pipe instances, the world transformation information is used to record the position of each pipe, such as 3-story X=10m, Y=5m, Z=3m. The bounding box and the camera distance are data used when the user interacts with the three-dimensional scene, for example, the bounding box can be used in the subsequent visibility screening strategy, collision detection during dynamic interaction, and the camera distance is also used to facilitate user interaction, such as converting the perspective, zooming in and out, and other operations.

[0029] The method further comprises grouping the placeholders according to the model types, calculating the maximum capacity of the instance pool of each group of placeholders according to the upper limit of the memory, setting an instance preloading strategy, and starting the preloading strategy if the instance pool is not established or does not exceed the maximum capacity. Reasonable capacity of the instance pool is planned for each model type (grouped according to the resource URL). The system calculates the number of instance preloads that can meet the visual effect and ensure the safety of the memory by counting the global demand in combination with the upper limit of the memory, thereby realizing optimal load distribution within limited resources. Grouping is also for the convenience of centralized management of instances. For example, group one corresponds to the pipeline instance pool, and group three corresponds to the butterfly valve instance pool, which ensures centralized management of instances of the same type and avoids the confusion caused by the mixing of different types of instances, such as not assigning "butterfly valve instances" to "pipeline placeholders". Grouping also facilitates subsequent preloading and avoids resource waste. When preloading, the capacity of the instance pool is determined according to the "total demand" of each group. For example, group one needs 1500 placeholders, but the capacity of the instance pool can be set to 800 to meet the reuse, and there is no need to preload models for each placeholder separately, which greatly reduces the loading time and initial memory usage. Grouping can also simplify instance allocation and recycling. When dynamically binding and unbinding instances subsequently, the corresponding instance pool can be quickly located according to the grouping of the placeholders without the need to traverse all instance pools, thereby improving the efficiency of resource scheduling.

[0030] The screening method of the visibility screening strategy in step S4 is as follows. The method for judging whether the current placeholder is visible by sequentially screening the conditions of the level, the distance and the perspective, and the intersection of the perspective cone comprises: The visibility of the current placeholder and the last level placeholder thereof is recursively checked. If the visibility is yes, the next step is performed, otherwise the process is ended. In the digital twin scene of the pipe network, the placeholders naturally have a tree level relationship, such as the level relationship of "building→floor→pipe network system→pipe section / valve→support hanger". If a node, such as "3-layer pipe network system", is hidden manually by a user or is invisible due to scene switching, all child nodes under the node are necessarily invisible. At this time, the subsequent screening is directly performed on the visible nodes, which can reduce the calculation amount.

[0031] The distance and perspective of the current placeholder are calculated. The placeholders beyond the maximum visible distance and the maximum field of view of the camera are removed, and the remaining placeholders are reserved for the next step. After the level screening, there are still a large number of placeholders that are "in the visible level, but completely invisible in vision due to too far distance or too biased position" in the remaining visible placeholders. Therefore, this step further screens out the invisible placeholders in two dimensions of "distance" and "perspective". The specific way is to calculate whether the straight-line distance between the bounding box center of each placeholder and the camera exceeds the preset maximum visible distance, such as 50 meters in the pipe network scene, as the basis for removal, and the same is true for the perspective dimension.

[0032] The space intersection detection is performed between the camera view frustum and the bounding box of the placeholder, and the placeholder with intersection is reserved as a visible placeholder. The view frustum is the visual space range of the camera, and an object is absolutely visible only when the bounding box of the object has intersection with the view frustum. Even if the object is within the visual distance and the center of the field of view, the object can be invisible due to being blocked by other objects or being out of the view frustum. Therefore, the last step is to finely screen the visible placeholders through the space intersection detection, so as to achieve the screening purpose. The layered screening from coarse to fine can quickly eliminate the obviously invisible placeholders, and then finely judge the possibly visible placeholders, thereby greatly reducing the subsequent calculation amount.

[0033] According to different device performance, the visibility screening strategy is not fixed, and the setting the visibility screening strategy of the placeholder further includes setting the execution frequency of the screening strategy by identifying the device memory capacity and executing by time stamp scheduling. If it is executed once per frame as in the traditional method, for example, 60 FPS, the execution is performed 60 times per second, but in the pipe network scene, the number of placeholders can reach tens of thousands, and the visibility screening is performed on all placeholders per frame, which can cause continuous high load of CPU, especially for low-performance devices, which can directly cause frame rate to drop and lag. Therefore, by obtaining the upper limit of the browser heap memory, the device performance is indirectly judged (the larger the memory, the stronger the device performance), and then the execution frequency is dynamically set, for example, for low-performance devices, the frequency is set to 4-6 times per second, and for medium and high-performance devices, the frequency is set to 7-10 times per second. The smoothness of running is ensured, and the execution by time stamp scheduling is performed after the execution frequency is set, and the visibility screening strategy is triggered to execute after the time reaches according to the time stamp of the last update.

[0034] The method further includes prioritizing the visible placeholders, and binding instances according to the high-to-low priority arrangement order. The priority arrangement method is as follows: The distance and the angle of view offset of all visible placeholders from the camera are calculated. The distance value and the offset angle value are weighted respectively, and the visual importance score is calculated after weighting. The calculation formula is as follows: S=(1-a / b)×△1+(1-c / d)×△2; Wherein S is the visual importance score, a is the distance value, b is the maximum visual distance value of the camera, c is the angle of view offset, is the maximum angle of view offset, △1 is the first weight, and △2 is the second weight. The visual importance scores are sorted in descending order according to the high-to-low priority by using the binary insertion algorithm.

[0035] Even after visibility filtering, the number of placeholders may still exceed the maximum capacity of the instance pool. For example, if the instance pool can only hold 1000 instances, but there are 1500 visible placeholders, it's necessary to determine which visible objects are more important and prioritize rendering resources to avoid missing critical objects. Using the weighted algorithm described above, instances are first bound to the placeholders with the highest scores, ensuring that nearby, central, and critical objects are rendered first. Low-priority placeholders, such as distant or edge auxiliary components, are not rendered if the instance pool capacity is insufficient. Even with limited resources, the core objects that users are most visually concerned with can still be displayed smoothly, avoiding the unreasonable situation where critical valves are not rendered while distant supports are rendered, thus balancing resource efficiency and visual experience.

[0036] The instance management strategy described in step S5 also includes business status synchronization callbacks. When a placeholder is bound to an instance, it checks whether the placeholder defines a callback function. If so, the function is called, and the business data of the current placeholder is passed to the newly bound instance. This ensures that the visual appearance of the instance is completely consistent with the logical entity of the placeholder it is currently bound to. Therefore, each time a new placeholder is bound, the identity is refreshed through a callback function to avoid business status confusion caused by instance reuse. For example, when an instance is reused, if the previous frame is bound to P1 and the current frame is bound to P2, without updating the business data, the instance will display the identity of P2 while carrying the state of P1. For example, the instance might be green when it is in P1, but red when it is in P2, which would lead to visual errors and disrupt the consistency between the virtual and real worlds in the digital twin.

[0037] In summary, this method completely solves the problem of memory overflow on the web application by reusing instance pools. Figure 4 The diagram shows the entire method's execution flow, as follows: Figure 4 As shown, instances are first preloaded to determine if a placeholder has a corresponding instance. If so, it is loaded and used; otherwise, it is generated using an instance template and saved in the instance pool for later reuse. Then, the entire scene is dynamically updated, and the update frame rate is dynamically adjusted according to device performance. Placeholder visibility is also filtered according to this frame rate. Visible placeholders are selected and bound to instances according to priority. When a placeholder is not visible, it is unbound from the instance. State synchronization callbacks are used during binding and unbinding to ensure consistency between instances and placeholders. Finally, the rendering output forms a 3D scene on the web.

[0038] In a preferred embodiment, the method can automatically generate piping system models such as HVAC and water supply and drainage by parsing Excel spreadsheet data, and uses instance pooling reuse, dynamic view frustum clipping and dynamic adjustment of detail level technology to solve the problems of high memory consumption and rendering lag in browsers for massive pipe fitting models.

[0039] This invention also discloses a lightweight rendering system for a WebGL-based digital twin model of a pipeline, comprising: Resource pre-configuration unit: The instance template generation module is used to generate corresponding instance templates from the mesh data of different 3D models; The instance generation module is used to generate instances from the instance template and store them in the instance pool; The placeholder creation module is used to create lightweight placeholders containing call data and dynamic data in the scene graph. The call data is used to extract the instance, and the dynamic data is used to adjust the dynamic display of the instance. Lightweight rendering unit: The visibility filtering module is used to set the visibility filtering strategy for the placeholder, and to determine whether the current placeholder is visible by filtering conditions of level, distance and viewing angle, and intersection of the view frustum in sequence. The instance management module is used to set instance management policies, call the corresponding instance from the instance pool to bind the placeholders that are filtered as visible, and record the binding relationship; unbind the placeholders that are filtered as invisible, and mark the unbound instance as idle. The rendering output module is used to render placeholders for bound instances.

[0040] The present invention also discloses a terminal, including a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps according to the method described above.

[0041] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A WebGL-based lightweight rendering method for a digital twin model of a pipe network, characterized in that, The method comprises: Resource pre-configuration: Generate instance templates corresponding to the grid data of different three-dimensional models; Generate instances from the instance templates and store them in an instance pool; Create lightweight placeholders containing call data and dynamic data in a scene graph, the call data being used to extract the instances, and the dynamic data being used to adjust the dynamic display of the instances; Lightweight rendering: Set the visibility filtering strategy of the placeholders, and determine whether the current placeholder is visible by sequentially filtering the placeholders according to the filtering conditions of the level, distance and viewing angle, and the intersection of the viewing frustum; Set the instance management strategy, bind the corresponding instances for the placeholders filtered as visible from the instance pool, and record the binding relationship, and unbind the placeholders filtered as invisible, and mark the unbound instances as idle; Render the placeholders of the bound instances.

2. The WebGL-based light-weight rendering method of pipe network digital twin model according to claim 1, characterized in that, The generation of the instance templates corresponding to the grid data of different three-dimensional models further comprises dividing the same model into multiple versions of different levels of detail, encapsulating models of different versions of precision into an instance template, and adding switching thresholds at different distances in the instance template.

3. The WebGL-based light-weight rendering method of pipe network digital twin model according to claim 1, characterized in that, The creation of the lightweight placeholders containing call data and dynamic data in the scene graph comprises setting the unique identifier, resource path and world transformation information of the model as the call data, and setting the bounding box and camera distance as the dynamic data.

4. The WebGL-based light-weight rendering method of pipe network digital twin model according to claim 1, characterized in that, The method further comprises grouping the placeholders according to the model type, calculating the maximum capacity of the instance pool for each group of placeholders according to the upper limit of the memory, setting the instance preloading strategy, and starting the preloading strategy if the instance pool is not established or does not exceed the maximum capacity.

5. The WebGL-based light-weight rendering of pipe network digital twin model method according to claim 1, wherein, The method of determining whether the current placeholder is visible by sequentially filtering the placeholders according to the filtering conditions of the level, distance and viewing angle, and the intersection of the viewing frustum comprises: Recursively check the visibility of the current placeholder and the placeholder of the previous level, if it is visible, proceed to the next step, otherwise end; Perform distance and viewing angle calculation on the current placeholder, remove the placeholders that exceed the maximum visible distance and the maximum field of view range of the camera, and retain the remaining placeholders for the next step; Use the camera frustum and the bounding box of the placeholder to perform spatial intersection detection, and retain the placeholders with intersection as visible placeholders.

6. The WebGL-based light-weight rendering method of pipe network digital twin model according to claim 1 or 5, characterized in that, The setting of the visibility filtering strategy of the placeholders further comprises setting the execution frequency of the filtering strategy by identifying the memory capacity of the device, and scheduling the execution by timestamp.

7. The WebGL-based light-weight rendering of pipe network digital twin model method according to claim 1, wherein, The method further comprises prioritizing the visible placeholders, and binding instances according to the priority arrangement order from high to low, the priority arrangement method being: Calculate the distance and viewing angle offset angle values of all visible placeholders and the camera; Weight the distance value and the offset angle value respectively, calculate the visual importance score after weighting, and the calculation formula is as follows: S=(1-a / b)×△1+(1-c / d)×△2; Where S is the visual importance score, a is the distance value, b is the maximum visible distance value of the camera, c is the viewing angle offset angle, d is the maximum viewing angle offset angle, △1 is the first weight, and △2 is the second weight; Sort the visual importance scores in descending order according to the high-to-low priority by using the binary insertion algorithm.

8. The WebGL-based light-weight rendering of pipe network digital twin model method according to claim 1, wherein, The setting instance management strategy further includes a business state synchronization callback, when a placeholder binding instance, checking whether the placeholder defines a callback function, if yes, calling the function, and passing the business data of the current placeholder to the newly bound instance.

9. A WebGL-based lightweight rendering system for digital twin model of pipe network, characterized in that, Comprise: Resource pre-configuration unit: Instance template generation module, for generating corresponding instance templates from mesh data of different three-dimensional models; Instance generation module, for generating instances from the instance templates and storing them in an instance pool; Placeholder creation module, for creating lightweight placeholders containing call data and dynamic data in a scene graph, the call data being used to extract the instances, and the dynamic data being used to adjust dynamic display of the instances; Lightweight rendering unit: Visibility screening module, for setting a visibility screening strategy of the placeholders, and judging whether a current placeholder is visible by screening conditions of level, distance and viewing angle, and viewing frustum intersection in sequence; Instance management module, for setting an instance management strategy, binding corresponding instances from the instance pool to the placeholders screened as visible, and recording the binding relationship, and unbinding the placeholders screened as invisible, and marking the unbound instances as idle; Rendering output module, for rendering and outputting the placeholders of the bound instances. 10.A terminal, comprising a processor and a storage medium; characterized in that, The storage medium is configured to store instructions; The processor is configured to operate according to the instructions to perform the steps of the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • BIM model display and rendering method based on WebGL

    CN110309458A

  • Web three-dimensional visualization technology based on synchronous rendering of client and server

    CN114513520A

  • Digital twin loading method and related device

    CN115994450A

  • Hyper-fusion visualization processing method and system based on three-dimensional digital twinning

    CN118485756A

  • Urban building group energy flexible management digital platform and method

    CN119849884A