Lightweight rendering method for webgl-based digital twin model of pipe network
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.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHONGRUIHENG (BEIJING) TECH CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-28
AI Technical Summary
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, traditional rendering methods cannot achieve smooth interaction and roaming on low-performance devices, making it difficult to achieve real-time visualization of both macro scenes and local details.
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, including resource pre-configuration, instance template generation, placeholder creation, visibility filtering and instance binding and unbinding management.
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.
Smart Images

Figure CN121527280B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital twin technology for building energy systems, and in particular to a lightweight rendering method for a WebGL-based digital twin model of a pipeline network. Background Technology
[0002] In the application of digital twins for building energy systems, web-based visualization of pipeline network models is a core component for achieving remote monitoring and operation and maintenance. Currently, pipeline digital twin models require manual modeling using external software such as 3ds Max and Revit, followed by importing and rendering on the web, which presents the following key problems:
[0003] 1. Memory usage grows linearly with the number of models: When loading large-scale 3D pipe network models on the web, each model entity corresponds to independent mesh data. When the number of models reaches tens of thousands, the browser's memory usage increases sharply, which can easily cause crashes or lag.
[0004] 2. Poor compatibility with low-performance devices: Traditional rendering methods are not optimized for low-performance devices such as ordinary PCs and mobile devices, and cannot achieve smooth interaction and roaming of large-scale pipeline models;
[0005] 3. Conflict between level of detail and loading efficiency: The model loading speed is slow and the level of detail is limited. If a high-definition model is used, the loading delay is high. If a simplified model is used, local details are missing, making it difficult to meet the real-time visualization needs of both macro scenes and local details.
[0006] To address the aforementioned issues, a lightweight rendering method is urgently needed to achieve smooth rendering and interaction of large-scale pipeline models while reducing memory consumption and hardware dependence. Summary of the Invention
[0007] To address the aforementioned technical issues, this invention proposes a lightweight rendering method for pipeline digital twin models based on WebGL. This method combines the advantages of constant memory consumption, optimized rendering frame rate, and multi-device universality, enabling lightweight rendering of pipeline digital twin models based on WebGL.
[0008] Firstly, to achieve the above-mentioned technical objectives, the present invention adopts the following technical solution:
[0009] This invention specifically relates to a lightweight rendering method for a WebGL-based digital twin model of a pipeline network, the method comprising:
[0010] Resource pre-configuration:
[0011] Generate corresponding instance templates from the mesh data of different 3D models;
[0012] Instances are generated from the instance template and stored in the instance pool;
[0013] Create a lightweight placeholder in the scene graph that contains call data and dynamic data. The call data is used to extract the instance, and the dynamic data is used to adjust the dynamic display of the instance.
[0014] Lightweight rendering:
[0015] The visibility filtering strategy for the placeholder is set, and the visibility of the current placeholder is determined by filtering conditions of level, distance and viewpoint, and intersection of view frustum in turn.
[0016] Set an instance management strategy. For placeholders that are filtered as visible, call the corresponding instance from the instance pool to bind them and record the binding relationship. For placeholders that are filtered as invisible, unbind them and mark the unbound instance as idle.
[0017] Placeholder for the instance bound to the rendering output.
[0018] Preferably, generating corresponding instance templates from the mesh data of different 3D models further includes dividing the same model into multiple versions with different levels of detail, encapsulating models of different precision into an instance template, and adding switching thresholds at different distances within the instance template.
[0019] Preferably, creating a lightweight placeholder containing both call data and dynamic data in the scene graph includes setting the model's unique identifier, resource path, and world transformation information as call data, and setting the bounding box and camera distance as dynamic data.
[0020] Preferably, the method further includes grouping placeholders according to model type, calculating the maximum capacity of the instance pool for each group of placeholders based on the memory limit, setting an instance preloading strategy, and starting the preloading strategy if the instance pool is not created or does not exceed the maximum capacity.
[0021] Preferably, the method for determining whether the current placeholder is visible by sequentially using filtering conditions of hierarchy, distance and viewing angle, and intersection of visual cones includes:
[0022] Recursively check the visibility of the current placeholder and its parent placeholders. If they are visible, proceed to the next step; otherwise, terminate.
[0023] Calculate the distance and viewing angle of the current placeholder, remove placeholders that exceed the camera's maximum viewing distance and maximum field of view, and keep the remaining placeholders for the next step;
[0024] Spatial intersection detection is performed using the camera's view frustum and the bounding box of the placeholders, and placeholders that intersect are retained as visible placeholders.
[0025] Preferably, the setting of the visibility filtering strategy for the placeholder further includes setting the execution frequency of the filtering strategy by identifying the device's memory capacity and scheduling the execution by timestamp.
[0026] Preferably, the method further includes prioritizing visible placeholders and binding instances according to their priority from highest to lowest. The priority prioritization method is as follows:
[0027] Calculate the distance and viewpoint offset angle between all visible placeholders and the camera;
[0028] The distance value and the offset angle value are weighted separately, and the visual importance score is calculated after weighting. The calculation formula is as follows:
[0029] S=(1-a / b)×△1+(1-c / d)×△2;
[0030] Where S is the visual importance score, a is the distance value, b is the maximum visible distance 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.
[0031] The visual importance scores are sorted from largest to smallest using a binary insertion algorithm, corresponding to the priorities from highest to lowest.
[0032] Preferably, the instance management strategy further includes a business status synchronization callback. When a placeholder is bound to an instance, the system checks whether the placeholder has defined a callback function. If so, the function is called, and the business data of the current placeholder is passed to the newly bound instance.
[0033] Thirdly, this invention also discloses a lightweight rendering system for a WebGL-based digital twin model of a pipeline network, comprising:
[0034] Resource pre-configuration unit:
[0035] The instance template generation module is used to generate corresponding instance templates from the mesh data of different 3D models;
[0036] The instance generation module is used to generate instances from the instance template and store them in the instance pool;
[0037] 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.
[0038] Lightweight rendering unit:
[0039] 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.
[0040] 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.
[0041] The rendering output module is used to render placeholders for bound instances.
[0042] Thirdly, 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 of the method described in the first aspect.
[0043] 1. This invention reuses instance pools, keeping only a fixed number of model mesh data in memory. The specific number is determined by the capacity of the instance pool. Regardless of whether the scene contains tens of thousands or hundreds of thousands of logical model entities, the memory usage remains constant. Compared with the traditional "one entity, one mesh" mode, memory usage is reduced by more than 90%, completely solving the problem of memory overflow in large-scale scenes on the Web.
[0044] 2. By utilizing visibility filtering strategies and dynamic settings for 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
[0045] 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:
[0046] 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.
[0047] Figure 2 A schematic diagram of the pipeline system model display interface from a distant perspective of the present invention is shown.
[0048] Figure 3 A schematic diagram of the pipeline system model display interface from a close-up perspective of the present invention is shown.
[0049] Figure 4 A flowchart illustrating the lightweight rendering method of the present invention is shown. Detailed Implementation
[0050] 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.
[0051] 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.
[0052] 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:
[0053] Resource pre-configuration:
[0054] Step S1: Generate corresponding instance templates from the mesh data of different 3D models;
[0055] Step S2: Generate an instance using the instance template and store it in the instance pool;
[0056] Step S3: Create a lightweight placeholder in the scene graph that contains call data and dynamic data. The call data is used to extract the instance, and the dynamic data is used to adjust the dynamic display of the instance.
[0057] Lightweight rendering:
[0058] Step S4: Set the visibility filtering strategy for the placeholder, and determine whether the current placeholder is visible by filtering conditions of level, distance and viewpoint, and intersection of the view frustum in sequence.
[0059] Step S5: Set the instance management strategy. For placeholders that are filtered as visible, call the corresponding instances from the instance pool to bind them and record the binding relationship. For placeholders that are filtered as invisible, unbind them and mark the unbound instances as idle.
[0060] Step S6: Render the placeholder for the bound instance.
[0061] The entire method consists of two parts. The first part is resource pre-configuration. The 3D model needs to be manually modeled using software such as 3DMax and Revit. In order to achieve lightweight rendering and display on the Web, it is necessary to perform pre-configuration of resources. In step S1, we know that the real entities of the 3D model are composed of mesh data. For example, a valve or a section of pipe is essentially rendered from mesh data. Mesh data can be in file formats such as xls, xlsx, and csv. Mesh data is the basic source of instance templates, and instance templates are the basis for creating instance pools. All reusable instances in the instance pool must be generated based on instance templates to ensure the consistency of attributes of instances of the same type. The above viewpoint is reflected 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 instances of the same type. Taking the HVAC network system as an example, the system contains components such as pipes, butterfly valves, gate valves, and supports. The number of components required in the entire system is enormous. If each component is added one by one, the efficiency is very low. Therefore, by using general configuration, the same type of model can be generated in batches, which will greatly save the model building time. The instance template is equivalent to a batch tool. An instance template for a pipe can generate all the pipes required by the system.
[0062] Step S3 involves the pre-configuration of placeholders. Taking the HVAC network system as an example again, for each network model entity (such as a valve or pipe segment), an empty `THREE.Object3D` object is created in the Three.js scene graph as a placeholder. No actual 3D mesh data is loaded. Since the placeholder contains no mesh data, it occupies less memory. The placeholder acts as an index to the instance, so the call data and dynamic data it contains are to find the corresponding instance and to accommodate the differences between each instance. The combination of placeholders and instances satisfies both the individual differences in the scene and achieves the goal of lightweight design. Therefore, there is a one-to-one correspondence between placeholders and instances. After explaining the resource pre-configuration, this is equivalent to the preparatory work before rendering, allowing subsequent rendering operations to proceed.
[0063] Since the camera's field of view is fixed in a 3D scene, it's unnecessary to render all placeholders, as this would violate the lightweight design principle. Therefore, it's necessary to determine whether a placeholder is visible. In step S4, the visibility determination is further explained. All placeholders are filtered from coarse to fine using criteria such as layer, distance and viewpoint, and intersection of view frustum. As mentioned in step S5, only visible placeholders can be bound to instances for rendering, thus significantly reducing the rendering pressure on the GPU. Through instance binding and unbinding in step S5, the cyclical use of instances is achieved. For example, with 1000 pipeline placeholders, there's no need to load models individually. Instead, instances in the instance pool are reused (e.g., 200 instances are cyclically allocated to 1000 placeholders). Only the mesh data of 200 model instances is retained in memory, instead of 1000, significantly reducing memory usage.
[0064] The above is a rough description of the entire rendering process. Now, we will further refine and expand each step to enhance the practical effect. Step S1, which involves generating corresponding instance templates from the mesh data of different 3D models, also includes dividing the same model into multiple versions with different levels of detail, encapsulating models of different precision levels into one instance template, and adding switching thresholds for different distances within the instance template. If all instances are rendered at the "highest resolution version," displaying details of components such as pipes, butterfly valves, gate valves, and supports regardless of distance, it will lead to "redundant face count calculations" for distant models. For example, a valve 100 meters away might have 1500 faces in the high-resolution version, but only occupies 1 pixel on the screen, resulting in a waste of GPU resources. If all instances are rendered at the "simplified version," nearby models will be blurry, losing key details. Therefore, when generating instance templates, it is necessary to encapsulate versions of different levels of detail into one instance template, generating different versions of instances, binding instances for rendering according to requirements, and generating different versions of instances based on distance. Figure 2 and Figure 3 The interfaces show the pipeline system from both distant and close-up perspectives. Figure 2 The panoramic view provides an overview of the entire pipeline system's distribution. Even if details such as the supports and hangers between pipes are not clearly shown, it does not affect the overall visual effect. Figure 3 In this scene, the details of the pipe supports and hangers are shown through a close-up view. Therefore, it is necessary to render the details of the supports and hangers. Figure 3 The scene rendering precision is higher than Figure 2 The rendering precision of the scene is important, so dividing the same model into multiple versions with different levels of detail can reduce rendering power consumption while meeting display requirements.
[0065] In step S3, creating a lightweight placeholder containing call data and dynamic data in the scene graph includes setting the model's unique identifier, resource path, and world transformation information as call data, and setting the bounding box and camera distance as dynamic data. The unique identifier is used to determine the uniqueness of the instance, because each instance will be bound to a placeholder later, which is a one-to-one correspondence to avoid confusion between the placeholder and the instance. The unique identifier determines the uniqueness of the instance, and the resource path can be used to find the desired instance from the instance pool. The world transformation information is used to show the differences between instances of the same type after rendering. For example, a building has 20 pipes in the east corridor on the 3rd floor, 30 pipes in the west machine room on the 5th floor, and 15 pipes in the basement pump room, for a total of 65 independent pipe instances. The world transformation information is used to record the position of each pipe, such as X=10m, Y=5m, Z=3m on the 3rd floor. Bounding boxes and camera distances are data used when users interact with 3D scenes. For example, bounding boxes can be used in subsequent visibility filtering strategies and collision detection during dynamic interactions. Camera distances are also used to facilitate user interactions, such as changing the viewpoint and zooming in and out of the scene.
[0066] This method also includes grouping placeholders according to model type, calculating the maximum capacity of the instance pool for each group of placeholders based on the memory limit, and setting an instance preloading strategy. If the instance pool is not created or does not exceed the maximum capacity, the preloading strategy is activated. A reasonable capacity for the instance pool is planned for each model type (grouped by resource URL). The system calculates the number of instances to be preloaded that satisfies both visual effects and memory safety by statistically analyzing global demand and considering the memory limit, thus achieving optimal load distribution within limited resources. Grouping also facilitates centralized instance management; for example, group 1 corresponds to the pipeline instance pool, and group 3 corresponds to the butterfly valve instance pool. This ensures centralized management of instances of the same model type and avoids reuse confusion caused by mixing different types of instances. For instance, a "butterfly valve instance" will not be assigned to a "pipeline placeholder." It also facilitates subsequent preloading and avoids resource waste: during preloading, the instance pool capacity is determined based on the "total demand" of each group. For example, group 1 requires 1500 placeholders, but an instance pool capacity of 800 is sufficient for reuse, eliminating the need to preload models separately for each placeholder, significantly reducing loading time and initial memory usage. Grouping can also simplify instance allocation and recycling: when dynamically binding and unbinding instances later, the corresponding instance pool can be quickly located directly based on the grouping of the placeholder, without having to traverse all instance pools, thus improving resource scheduling efficiency.
[0067] The specific filtering method of the visibility filtering strategy in step S4 is as follows: the method of determining whether the current placeholder is visible by sequentially using filtering conditions of hierarchy, distance and viewing angle, and intersection of visual cone includes:
[0068] The system recursively checks the visibility of the current placeholder and its parent placeholders. If they are visible, it proceeds to the next step; otherwise, it terminates. In a digital twin scenario of a pipeline network, placeholders naturally have a hierarchical tree structure, such as "building → floor → pipeline system → pipe section / valve → support". If a node (e.g., "3-layer pipeline system") is manually hidden by the user or becomes invisible due to scene switching, all its child nodes will inevitably be invisible. In this case, directly filtering the visible nodes reduces computational load.
[0069] The current placeholders are processed using distance and viewing angle calculations. Placeholders exceeding the camera's maximum viewing distance and maximum field of view are removed, and the remaining placeholders are retained for the next step. After hierarchical filtering, many of the remaining visible placeholders are still "visible at the visible level, but visually invisible due to excessive distance or remote location." Therefore, this step further filters out invisible placeholders using two dimensions: "distance" and "viewing angle." Specifically, a maximum viewing distance can be preset, such as 50 meters for a pipeline scene. The straight-line distance between the center of each placeholder's bounding box and the camera is calculated to see if it exceeds 50 meters, serving as the basis for removal. The same method applies to the viewing angle dimension.
[0070] Spatial intersection detection is performed using the camera's view frustum and the bounding boxes of placeholders. Placeholders with intersection are retained as visible placeholders. The view frustum is the camera's visible spatial range. An object is absolutely visible only when its bounding box intersects with the view frustum. Even within the visible distance and at the center of the field of view, an object may be invisible due to occlusion by other objects or its position outside the view frustum. Therefore, the final step uses spatial intersection detection to finely filter out visible placeholders, thus achieving the filtering objective. This coarse-to-fine layered filtering can quickly eliminate obviously invisible placeholders and then perform fine-grained judgment on potentially visible placeholders, significantly reducing the amount of subsequent computation.
[0071] Depending on device performance, visibility filtering strategies are not static. Setting the visibility filtering strategy for placeholders also includes determining the execution frequency of the filtering strategy based on the device's memory capacity and scheduling execution via timestamps. In a traditional scenario, execution might be once per frame (e.g., 60 times per second in a 60FPS scenario). However, in network scenarios, the number of placeholders can reach tens of thousands. Performing visibility filtering on all placeholders every frame would lead to a sustained high CPU load, especially on low-performance devices, directly causing a sharp drop in frame rate and stuttering. Therefore, by obtaining the browser's heap memory limit, device performance is indirectly determined (larger memory usually indicates stronger device performance), and the execution frequency is dynamically set. For example, for low-performance devices, the frequency is set to 4-6 times / second; for medium-to-high-performance devices, the frequency is set to 7-10 times / second. This ensures smooth operation. Execution scheduling via timestamps means that after setting the execution frequency, the visibility filtering strategy is triggered after the last updated timestamp has elapsed.
[0072] This method also includes prioritizing visible placeholders and binding instances in descending priority order. The priority prioritization method is as follows:
[0073] Calculate the distance and viewpoint offset angle between all visible placeholders and the camera;
[0074] The distance value and the offset angle value are weighted separately, and the visual importance score is calculated after weighting. The calculation formula is as follows:
[0075] S=(1-a / b)×△1+(1-c / d)×△2;
[0076] Where S is the visual importance score, a is the distance value, b is the maximum visible distance of the camera, c is the viewing angle, is the maximum viewing angle, △1 is the first weight, and △2 is the second weight.
[0077] The visual importance scores are sorted from largest to smallest using a binary insertion algorithm, corresponding to the priorities from highest to lowest.
[0078] 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.
[0079] 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.
[0080] 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.
[0081] 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.
[0082] This invention also discloses a lightweight rendering system for a WebGL-based digital twin model of a pipeline, comprising:
[0083] Resource pre-configuration unit:
[0084] The instance template generation module is used to generate corresponding instance templates from the mesh data of different 3D models;
[0085] The instance generation module is used to generate instances from the instance template and store them in the instance pool;
[0086] 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.
[0087] Lightweight rendering unit:
[0088] 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.
[0089] 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.
[0090] The rendering output module is used to render placeholders for bound instances.
[0091] 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.
[0092] 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 lightweight rendering method for a WebGL-based digital twin model of a pipeline network, characterized in that, The method includes: Resource pre-configuration: Generate corresponding instance templates from the mesh data of different 3D models; Instances are generated from the instance template and stored in the instance pool; Create a lightweight placeholder in the scene graph that contains call data and dynamic data. 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: The visibility filtering strategy for the placeholder is set, and the visibility of the current placeholder is determined by filtering conditions of level, distance and viewpoint, and intersection of view frustum in turn. Set an instance management strategy. For placeholders that are filtered as visible, call the corresponding instance from the instance pool to bind them and record the binding relationship. For placeholders that are filtered as invisible, unbind them and mark the unbound instance as idle. Placeholders for the instance bound to the rendering output; The method for determining whether the current placeholder is visible by sequentially selecting based on the filtering conditions of hierarchy, distance and viewing angle, and intersection of the visual cone includes: Recursively check the visibility of the current placeholder and its parent placeholders. If they are visible, proceed to the next step; otherwise, terminate. Calculate the distance and viewing angle of the current placeholder, remove placeholders that exceed the camera's maximum viewing distance and maximum field of view, and keep the remaining placeholders for the next step; Spatial intersection detection is performed using the camera's view frustum and the bounding box of the placeholders, and placeholders that intersect are retained as visible placeholders.
2. The lightweight rendering method for WebGL-based digital twin models of pipelines according to claim 1, characterized in that, The process of generating corresponding instance templates from the mesh data of different 3D models also includes dividing the same model into multiple versions with different levels of detail, encapsulating models of different precision into an instance template, and adding switching thresholds at different distances within the instance template.
3. The lightweight rendering method for WebGL-based digital twin models of pipelines according to claim 1, characterized in that, The step of creating a lightweight placeholder containing both call data and dynamic data in the scene graph includes setting the model's unique identifier, resource path, and world transformation information as call data, and setting the bounding box and camera distance as dynamic data.
4. The lightweight rendering method for WebGL-based digital twin models of pipelines according to claim 1, characterized in that, The method also includes grouping placeholders according to model type, calculating the maximum capacity of the instance pool for each group of placeholders based on the memory limit, setting an instance preloading strategy, and starting the preloading strategy if the instance pool has not been created or has not exceeded the maximum capacity.
5. The lightweight rendering method for WebGL-based digital twin models of pipelines according to claim 1 or 4, characterized in that, The visibility filtering strategy for setting the placeholders also includes setting the execution frequency of the filtering strategy by identifying the device's memory capabilities and scheduling the execution by timestamps.
6. The lightweight rendering method for a WebGL-based digital twin model of a pipeline network according to claim 1, characterized in that, This method also includes prioritizing visible placeholders and binding instances in descending priority order. The priority prioritization method is as follows: Calculate the distance and viewpoint offset angle between all visible placeholders and the camera; The distance value and the offset angle value are weighted separately, and the visual importance score is calculated after weighting. 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 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. The visual importance scores are sorted from largest to smallest using a binary insertion algorithm, corresponding to the priorities from highest to lowest.
7. The lightweight rendering method for WebGL-based digital twin models of pipelines according to claim 1, characterized in that, The instance management strategy also includes business status synchronization callbacks. When a placeholder is bound to an instance, it checks whether the placeholder has defined a callback function. If so, the function is called and the business data of the current placeholder is passed to the newly bound instance.
8. A lightweight rendering system for a WebGL-based digital twin model of a pipeline network, characterized in that, include: 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. The method for determining whether the current placeholder is visible by sequentially selecting based on the filtering conditions of hierarchy, distance and viewing angle, and intersection of the visual cone includes: Recursively check the visibility of the current placeholder and its parent placeholders. If they are visible, proceed to the next step; otherwise, terminate. Calculate the distance and viewing angle of the current placeholder, remove placeholders that exceed the camera's maximum viewing distance and maximum field of view, and keep the remaining placeholders for the next step; Spatial intersection detection is performed using the camera's view frustum and the bounding box of the placeholders, and placeholders that intersect are retained as visible placeholders.
9. A terminal, comprising a processor and a storage medium; characterized in that, The storage medium is used 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-7.
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