A web-side model efficient rendering method, medium and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-20
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]有鉴于此,本发明提供一种Web端模型高效渲染方法、介质及系统,能够解决现有技术中存在Web端CAD模型在大规模装配体场景下无法同时兼顾拓扑语义保留、自适应精度离散化与高效流式加载渲染的技术问题
Smart Images

Figure CN122550779A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of efficient rendering methods, media and systems for web-based models. Specifically, it relates to an efficient rendering method, media and system for web-based models. Background Technology
[0002] In the field of industrial digitalization, web-based 3D CAD model rendering has been widely applied in scenarios such as online collaborative design, remote review, and digital twins. Currently, mainstream web-based rendering solutions typically preprocess parametric formats such as STEP into a universal graphics transmission format before transmitting them to the browser, relying on WebGL or WebGPU for real-time rendering. In the discretization stage, traditional methods use a globally uniform chord height difference to triangulate all B-Rep surfaces, failing to adaptively allocate sampling density based on curvature distribution differences. In the transmission stage, downloads are usually done in static chunks or as a single, complete file, lacking a dynamic scheduling mechanism that links with user perspective and network bandwidth. In the interaction stage, the universal graphics format loses the B-Rep topological semantics, resulting in surface-level picking and measurement operations failing to accurately reconstruct the original topological surface.
[0003] In existing technologies, due to the independence of discretization accuracy schemes and topology structures, static and fixed transmission scheduling strategies, and the lack of topological semantic support in the rendering pipeline, web-based CAD rendering systems struggle to achieve low-latency streaming loading and efficient instantiation rendering of large-scale assemblies while ensuring engineering-level surface selection and measurement accuracy. In other words, existing technologies present a technical challenge in web-based CAD models for large-scale assembly scenarios: they cannot simultaneously achieve topological semantic preservation, adaptive precision discretization, and efficient streaming loading and rendering. Summary of the Invention
[0004] In view of this, the present invention provides a web-based model high-efficiency rendering method, medium and system, which can solve the technical problem in the prior art that web-based CAD models cannot simultaneously take into account topological semantic preservation, adaptive precision discretization and high-efficiency streaming loading and rendering in large-scale assembly scenarios.
[0005] The present invention is implemented as follows: The first aspect of the present invention provides an efficient method for rendering models on a web platform, comprising the following steps:
[0006] The system parses the input STEP file, extracts the assembly hierarchy and B-Rep topology data, converts each parametric surface into a triangular mesh using a topology-preserving curvature adaptive discretization algorithm, writes the original topology surface identifier for each triangular facet, and outputs the assembly structure file and geometric data file.
[0007] Input the geometric data and topological surface identifiers into the topology-aware accuracy prediction model to obtain the chord height difference suggested value for each B-Rep surface. Calculate the accuracy adjustment coefficient based on the chord height difference adjustment function and divide the interval. Adjust the discretization accuracy parameters of each surface according to the interval results, re-execute the triangulation of the corresponding surface, and update the geometric data file.
[0008] The program performs deduplication on duplicate geometries in the geometry data file, merges and stores identical geometries and appends them with a list of instance transformation matrices, performs quantization compression on vertex coordinate data, performs transmission compression on the final binary data, and outputs a custom lightweight format file.
[0009] Based on the minimum spanning tree-based geometric block dependency graph scheduling algorithm, the custom lightweight format file is divided into geometric blocks, a directed dependency graph between blocks is established, and the loading queue is arranged according to visual importance priority. The front end requests the blocks through the Hypertext Transfer Protocol and decodes them in parallel in the Web worker thread pool. The decoding result is passed to the main thread with zero copy.
[0010] The main thread uploads the received geometric data to the graphics processor buffer, constructs scene-level objects based on the assembly structure file, merges duplicate instances into a single draw call using instantiated mesh objects, and establishes a bidirectional index mapping table from triangular patches to topological surfaces based on topological surface identifiers.
[0011] When a user performs a click operation, the topological face identifier of the corresponding pixel in the frame buffer is read by the pick shader, and the topological face is highlighted by looking up the bidirectional index mapping table. When a user performs a slicing operation, the scene is clipped with a clipping plane, and the clipping result is updated in conjunction with the topological relationship to update the highlighting state. When the user's viewpoint changes, the visual importance of geometric blocks is recalculated in real time and the unloaded queue is reordered.
[0012] Specifically, the topology-preserving curvature adaptive discretization algorithm calculates the principal curvature of each sampling point in the surface parameter domain. and With Gaussian curvature The absolute value is used as the local sampling density weight, and the maximum spacing is taken for the flat region spacing. The spacing of the high curvature region shrinks to The Rupert-Schuck refinement algorithm is used to ensure the quality of the triangulated mesh.
[0013] Specifically, the Rupert-Shuker refinement algorithm detects whether the minimum interior angle of a triangle is lower than a quality threshold, inserts a new vertex into the circumcenter of the unqualified triangle, and iterates until all triangles meet the quality constraints. The quality threshold is determined through visual evaluation experiments on rendering scenes with different interior angles. The experiments invite no fewer than 10 engineers to score the rendering results, and the interior angle value corresponding to the score mutation point is taken as the threshold.
[0014] Specifically, the topology-aware accuracy prediction model uses the face, edge, and vertex elements of the B-Rep topology as a heterogeneous graph. The feature vectors of face nodes are seven-dimensional, the feature vectors of edge nodes are four-dimensional, and the feature vectors of vertex nodes are four-dimensional. The graph attention mechanism is used as the basic message passing unit, and the attention weights are constrained by the topological adjacency relationship. The attention weights between non-adjacent nodes are forced to zero.
[0015] The topology-aware accuracy prediction model includes a topology consistency iteration layer that checks whether the number of face nodes, edge nodes, and vertex nodes satisfy Euler's formula constraint after each round of message passing. If the condition is not met, a correction jump is performed on the node characteristics that violate the constraint. After a maximum of 5 iterations, the next message passing round begins.
[0016] The topology-aware accuracy prediction model consists of four graph attention layers, each with eight attention heads and a hidden dimension of 128. Finally, two fully connected layers are connected to output the chord height difference proposal value corresponding to each face node. During training, the mean squared error is used as the loss function, the Adam optimizer is used, the initial learning rate is 0.001, the batch size is 32 model graphs, and early stopping is performed when the validation set loss does not decrease for 20 consecutive rounds.
[0017] Specifically, the chord height difference adjustment function is denoted as the average of all B-Rep surface chord height difference recommendations. The global maximum value of the absolute value of Gaussian curvature is denoted as The current estimated network transmission bandwidth is denoted as The reference transmission bandwidth is denoted as Calculation accuracy adjustment coefficient Reference transmission bandwidth The value is 20Mbps.
[0018] Among them, the precision adjustment coefficient The interval division, specifically when Multiply the recommended value of the chord height difference for all curved surfaces by 0.5; when Keep the recommended value of chord height difference unchanged; when For flat surfaces with curvature below the global mean, the recommended chord height difference value is multiplied by 2; when Multiply the recommended value of the chord height difference of all surfaces by 3 and enable the low-precision level of detail scheme for priority loading.
[0019] Specifically, the custom lightweight format file is a binary format for web-based CAD scenarios. It structurally stores triangular mesh vertex coordinates, normals, topological surface identifier integer buffers, instance transformation matrix lists, assembly level node trees, and material properties, and supports incremental block loading and multi-level detail mechanisms. Quantization compression stores floating-point vertex coordinates as fixed-precision integer encoding, and transmission compression uses the Brotli algorithm to perform lossless compression on the binary data.
[0020] Specifically, the geometric block dependency graph scheduling algorithm based on minimum spanning tree models the geometric blocks as a directed dependency graph, uses the ratio of the projected area of each geometric block under the current viewpoint to the viewing distance as the visual importance weight of the node, runs a variant of the Prim minimum spanning tree algorithm on the directed dependency graph, and selects the node with the highest visual importance from the set of nodes that meet the dependency loading condition and adds it to the loading queue each time.
[0021] Specifically, the Web worker thread pool consists of multiple worker threads created outside the browser's main thread, used to perform CPU-intensive operations such as Draco geometry decoding and custom lightweight format file deserialization in parallel; the decoded array buffer is passed to the main thread as a transferable object, and no memory copying occurs during the transfer process.
[0022] The zero-copy transfer specifically refers to a memory ownership transfer method based on the transferable object mechanism in the browser. When the sender posts a message, it marks the array buffer as transferable. After the transfer is completed, the sender thread's access to the memory immediately expires, and the receiver thread gains full ownership.
[0023] Specifically, the instance transformation matrix list is generated by the server identifying duplicate instances by comparing the hash values of the geometric objects, storing only one copy of the geometric data, and appending the 4×4 transformation matrix of each instance in the assembly coordinate system to the geometric block in list form; the front end uses an instantiated mesh object to read the list and merges the same parts into a single drawing call.
[0024] The picker shader is specifically an off-screen rendering program running on the graphics processor. It encodes the topological face identifier of each triangle in the scene into the color value of the frame buffer for off-screen rendering. When the user clicks the screen, it reads the color value of the corresponding pixel in the off-screen frame buffer and decodes it back into an integer topological face identifier. After looking up the bidirectional index mapping table, it obtains the index of all the corresponding triangles and performs highlight shading.
[0025] Specifically, the clipping plane is defined in the shader by determining the signed distance between each fragment and the clipping plane. Fragments with negative distances are discarded, thus enabling real-time segmentation of any plane in the 3D scene. When the position of the clipping plane changes, the spatial relationship between each topological surface and the clipping plane is reassessed, and the highlight state and visibility of the measured annotations of the clipped topological surface are updated.
[0026] A second aspect of the present invention provides a computer-readable storage medium storing program instructions that, when executed in a computer, perform the above-described efficient rendering method for a web-based model.
[0027] A third aspect of the present invention provides a high-efficiency rendering system for web-based models, comprising the aforementioned computer-readable storage medium, wherein the system is a computer, the computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor for executing program instructions stored in the computer-readable storage medium.
[0028] This invention proposes an efficient rendering method for web-based models, encompassing a complete closed-loop process from STEP file parsing, topology-aware adaptive discretization, lightweight format generation, visual priority streaming loading, to GPU rendering and topology interaction. By introducing a topology-aware accuracy prediction model and curvature adaptive sampling during the discretization stage, this invention ensures that the accuracy allocation of adjacent faces is constrained by the topological context, fundamentally eliminating the accuracy waste and visual gaps caused by globally uniform chord height differences. Through a geometric block dependency graph scheduling algorithm based on minimum spanning trees, loading priority is linked in real-time with user perspective and network bandwidth, ensuring that limited bandwidth first serves the geometric content that contributes the most to visual perception. By fully preserving topological face identifiers and establishing bidirectional indexes in a custom lightweight format, the picking shader can directly reproduce engineering-level face selection semantics at the GPU level. In summary, this invention solves the technical problem mentioned in the background art of web-based CAD models being unable to simultaneously achieve topological semantic preservation, adaptive accuracy discretization, and efficient streaming loading and rendering in large-scale assembly scenarios. Attached Figure Description
[0029] Figure 1 This is a flowchart of the method of the present invention.
[0030] Figure 2 This is a schematic diagram illustrating the linkage effect between the sectioning operation and the highlighting of the topological surface.
[0031] Figure 3 This is a schematic diagram of the directed dependency graph of geometric blocks and the loading queue scheduling process. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.
[0033] like Figure 1 The diagram shown is a flowchart of an efficient web-based model rendering method provided by the first aspect of this invention. This method includes the following steps:
[0034] S01. Parse the input STEP file, extract the assembly hierarchy and B-Rep topology data, convert each parametric surface into a triangular mesh using the topology-preserving curvature adaptive discretization algorithm, write the original topology surface identifier for each triangular facet, and output the assembly structure file and geometric data file.
[0035] S02. Input the geometric data and topological surface identifiers output from S01 into the topology-aware accuracy prediction model to obtain the chord height difference suggested value for each B-Rep surface. Calculate the accuracy adjustment coefficient according to the chord height difference adjustment function and divide the interval. Adjust the discretization accuracy parameters of each surface according to the interval results, re-execute the triangulation of the corresponding surface, and update the geometric data file.
[0036] S03. Perform deduplication identification on duplicate geometries in the geometric data file, merge and store identical geometries and attach an instance transformation matrix list, perform quantization compression on vertex coordinate data, perform transmission compression on the final binary data, and output a custom lightweight format file.
[0037] S04. Based on the minimum spanning tree-based geometric block dependency graph scheduling algorithm, the custom lightweight format file is divided into geometric blocks, a directed dependency graph between blocks is established, and the loading queue is arranged according to visual importance priority. The front end requests the blocks through the Hypertext Transfer Protocol and decodes them in parallel in the Web worker thread pool. The decoding result is passed to the main thread with zero copy.
[0038] S05. The main thread uploads the received geometric data to the graphics processor buffer, constructs scene-level objects based on the assembly structure file, merges duplicate instances into a single drawing call using instantiated mesh objects, and establishes a bidirectional index mapping table from triangular patches to topological surfaces based on the topological surface identifier.
[0039] S06. When the user performs a click operation, the topological face identifier of the corresponding pixel in the frame buffer is read by the pick shader, and the topological face is highlighted by looking up the bidirectional index mapping table. When the user performs a slicing operation, the scene is clipped with the clipping plane, and the highlighting state is updated in conjunction with the topological relationship. When the user's viewpoint changes, the visual importance of the geometric blocks is recalculated in real time and the unloaded queue is reordered.
[0040] The principle and specific implementation of the topology-preserving curvature adaptive discretization algorithm are as follows: Based on the relationship between Gaussian curvature and local surface morphology in differential geometry, the principal curvature of each sampling point is calculated in the surface parameter domain. and With Gaussian curvature The absolute value is used as the local sampling density weight. A Riemannian metric tensor is constructed in the parameter domain, and the sampling point spacing is controlled by the curvature-weighted geodesic distance. The maximum spacing is taken in flat regions. The spacing of the high curvature region shrinks to Precision coefficient The algorithm employs gradient experiments on surfaces with different curvature levels and analyzes the trade-off between measurement error and the number of facets. Experimental samples cover three categories: low-curvature planes, medium-curvature cylindrical surfaces, and high-curvature small fillets. For each category, the optimization objective is to minimize the chord-to-height difference error to less than 0.01 mm and the total number of facets. This is determined after at least 50 parameter combinations. The Ruppert-Shewchuk refinement algorithm ensures the quality of the triangulated mesh. During the discretization process, each generated triangular facet is appended with an integer identifier representing its original B-Rep facet, stored in an independent integer attribute buffer, thus forming a bidirectional index structure from triangular facets to topological faces and from topological faces to sets of triangular facets. The algorithm achieves dense sampling in high-curvature regions to ensure visual and measurement accuracy, while extremely sparse sampling in flat regions significantly reduces the total number of vertices. Overall, it adaptively balances accuracy and performance. Furthermore, by fully preserving the topological facet identifiers, engineering-level facet selection and measurement operations can be accurately reconstructed to the original B-Rep topological faces on the triangular mesh.
[0041] The Ruppert-Shewchuk thinning algorithm is a mesh quality optimization algorithm based on Delaunay triangulation. It detects whether the minimum interior angle of a triangle is lower than a quality threshold (usually 20 degrees), inserts a new vertex into the circumcenter of the unqualified triangle, and iterates until all triangles meet the quality constraints. The quality threshold is determined through visual evaluation experiments on game and engineering rendering scenes with different interior angles. The experiments invited no less than 10 engineers to score the rendering results, and the interior angle value corresponding to the score mutation point was taken as the threshold.
[0042] The specific structure of the topology-aware accuracy prediction model is as follows: The model uses the face, edge, and vertex elements of a B-Rep topology as a heterogeneous graph. The feature vector of a face node contains seven dimensions: the normalized surface area, three independent components of the Gaussian curvature tensor, and a three-dimensional unit vector of the normal direction. The feature vector of an edge node contains four dimensions: the cosine of the dihedral angle between the two sides of the edge and a one-hot encoding of curvature continuity (three types: continuous tangent plane, continuous curvature, and discontinuous). The feature vector of a vertex node contains four dimensions: the normalized number of faces clustered at the vertex and a three-dimensional vector of the vertex coordinates. The model uses a graph attention mechanism as the basic message passing unit. The attention weights are constrained by topological adjacency relationships; that is, the attention weights between non-adjacent nodes are forced to zero before calculation, and information is only allowed between adjacent nodes to avoid interference between distant topologically unrelated nodes. The model internally designs a topology consistency iteration layer. After each round of message passing, it checks whether the current number of face nodes, edge nodes, and vertex nodes satisfies the Euler formula constraint. (in , , , The model uses the number of vertices, edges, faces, and Euler characteristic of the reference topology (for dimensionless representation). If the constraints are not met, the model performs a correction jump on the characteristics of the node that violates the constraints within the same layer. After a maximum of 5 iterations, the model enters the next message passing round. The iteration limit of 5 iterations has been verified experimentally. The experiment statistically analyzed the constraint satisfaction rate and computation time for iteration limits from 1 to 10, and the number of iterations corresponding to the turning point where the constraint satisfaction rate gain tends to flatten out was taken. The model contains a total of 4 graph attention layers, each with 8 attention heads and 128 hidden dimensions. Finally, two fully connected layers are connected to output the chord height difference suggestion value (a single real number) for each face node. The steps for establishing the training dataset of the topology-aware accuracy prediction model specifically include: collecting no less than 5,000 STEP models from industrial scenarios; performing triangulation on each B-Rep surface of each model with multiple sets of chord height differences ranging from 0.001 mm to 1 mm; recording the measurement error and the number of facets under each set of chord height differences; determining the optimal chord height difference of each facet as a label based on the criterion that the measurement error is less than 0.01 mm and the number of facets is minimized; and constructing a supervised dataset with the input being the surface topology feature map and the output being the chord height difference label values of each facet; and dividing the dataset into training set, validation set, and test set in an 8:1:1 ratio. The specific steps for training the topology-aware accuracy prediction model include: using mean squared error as the loss function, employing the Adam optimizer, setting the initial learning rate to 0.001, setting the batch size to 32 model graphs, and limiting the training rounds to no more than 200 rounds. Early stopping is performed when the loss on the validation set does not decrease for 20 consecutive rounds. After training, the error distribution between the predicted chord height difference and the labeled chord height difference is evaluated on the test set. A 90th percentile error of less than 0.005 mm is considered acceptable. If the error is unacceptable, the dataset is expanded and the model is retrained.
[0043] The topology-aware accuracy prediction model structures the topological relationships of B-Rep into a graph, so that the accuracy decision of each surface depends not only on its own geometric properties, but also on the constraints and corrections of the topological context such as the curvature continuity of adjacent surfaces and edges. The topology consistency iteration layer further ensures the consistency of the discretization scheme at the global topology level, avoiding visual gaps and measurement errors caused by accuracy jumps of adjacent surfaces. Thus, it automatically outputs an adaptive accuracy scheme with global topology consistency without the need for manual setting of accuracy parameters for each surface.
[0044] The specific definition of the chord height difference adjustment function is as follows: The average of the suggested chord height difference values for all B-Rep surfaces in the model is denoted as... The global maximum value of the absolute value of Gaussian curvature is denoted as The current estimated network transmission bandwidth is denoted as The reference transmission bandwidth is denoted as Calculation accuracy adjustment coefficient Reference transmission bandwidth The value was set to 20 Mbps, determined through the median value of no fewer than 100 transmission experiments conducted under different network environments. At that time, the recommended value for the chord height difference of all surfaces is uniformly multiplied by 0.5 for densification, further improving accuracy; when When, the chord height difference suggested by the topology sensing accuracy prediction model output remains unchanged; when When the curvature is lower than the global mean, it is recommended to multiply the chord height difference by 2 to sparsify it and reduce the transmission burden; when At that time, it is recommended to multiply the chord height difference of all surfaces by 3 and prioritize loading with a low-precision detail level scheme. The boundary values of 0.1, 0.5, and 1.0 for each interval are determined by Pareto front analysis of the first frame loading time and measurement error through experiments with no less than 200 combinations of different model sizes and network conditions. The coefficient value corresponding to the inflection point of the front is taken as the interval boundary.
[0045] The custom lightweight format file is a binary format for web-based CAD scenarios. It structurally stores triangular mesh vertex coordinates, normals, topological surface identifier integer buffers, instance transformation matrix lists, assembly level node trees, and material properties. Compared to general graphics transmission formats, this format retains B-Rep topological semantic information and supports incremental block loading and multi-level detail mechanisms.
[0046] The quantization compression refers to storing floating-point vertex coordinates using fixed-precision integer encoding to reduce the number of bytes stored for each vertex; the transmission compression uses the Brotli algorithm to perform lossless compression on binary data before transmitting it via the Hypertext Transfer Protocol.
[0047] The instance transformation matrix list is for identical geometric shapes that appear repeatedly in the assembly. During the format conversion stage, the server identifies duplicate instances by comparing the hash values of the geometric shapes, stores only one copy of the geometric data, and appends the 4×4 transformation matrix of each instance in the assembly coordinate system to the geometric block in list form. The front end uses an instantiated mesh object to read the list and merges thousands of identical parts into a single drawing call, so that identical geometric data occupies only one copy in the graphics processor's video memory, thereby significantly reducing video memory usage and the amount of data uploaded from the central processing unit to the graphics processor.
[0048] The Web worker thread pool refers to multiple worker threads created outside the browser's main thread, used to perform CPU-intensive operations such as Draco geometry decoding and custom lightweight format file deserialization in parallel. After decoding, the array buffer is passed to the main thread as a transferable object. No memory copying occurs during the transfer process. After receiving the data, the main thread directly uploads it to the graphics processor buffer, so that the CPU decoding time and the graphics processor rendering time overlap in a pipeline.
[0049] The zero-copy transfer refers to a memory ownership transfer method based on the transferable object mechanism in the browser. When the sender posts a message, it marks the array buffer as transferable. After the transfer is completed, the sender thread’s access to the memory is immediately invalidated, and the receiver thread obtains full ownership. No memory copying operation is performed throughout the process.
[0050] The principle and specific implementation of the geometric block dependency graph scheduling algorithm based on minimum spanning tree are as follows: The geometric blocks of the custom lightweight format file are modeled as a directed dependency graph, where nodes are geometric blocks and directed edges represent assembly reference dependencies between blocks. The ratio of the projected area of each geometric block under the current viewpoint to the viewing distance is used as the visual importance weight of the node, and the inverse of the current network transmission bandwidth estimate multiplied by the block volume is used as the transmission cost weight of the edge. A variant of the Prim minimum spanning tree algorithm is run on the directed dependency graph. Each time, the node with the highest visual importance is selected from the set of nodes that satisfy the dependency loading condition and added to the loading queue, prioritizing the download of the geometric block that contributes the most to the current viewpoint. When the user's viewpoint changes, the visual importance of nodes in the queue that have not yet started transmission is recalculated and reordered in real time. Block data that has been transmitted is not discarded, achieving viewpoint-aware adaptive prefetching scheduling. The algorithm enables the front end to prioritize the geometric content with the highest visual weight in the user's current viewpoint under the condition of limited network bandwidth. It dynamically adjusts the loading priority according to the viewpoint, significantly improving the visual integrity of the first visible frame without increasing the total transmission volume. At the same time, the directed dependency graph ensures the correct loading order of assembly reference relationships, avoiding the incorrect placement of sub-assemblies before the parent assembly transformation matrix arrives.
[0051] The pick shader refers to an off-screen rendering program that runs on a graphics processor. It encodes the topological face identifier of each triangle in the scene into the color value of the frame buffer for off-screen rendering. When the user clicks the screen, it reads the color value of the corresponding pixel in the off-screen frame buffer and decodes it back into an integer topological face identifier. After looking up the bidirectional index mapping table, it obtains all the triangle face indices corresponding to the topological face and performs highlighting shading on it.
[0052] The clipping plane is Three.js, a graphics processor-based planar clipping function provided by the graphics framework. It achieves real-time sectionalization of any plane in a 3D scene by determining the signed distance between each fragment and the clipping plane in the shader, discarding fragments with negative distances. The linkage update between the sectionalization operation and the topological relationship refers to re-evaluating the spatial relationship between each topological face and the clipping plane when the clipping plane's position changes, and updating the highlight state and measurement annotation visibility of the clipped topological face.
[0053] The Draco algorithm is an open-source 3D geometry compression algorithm from Google. It performs quantization and entropy encoding on attribute data such as vertex coordinates, normals, and texture coordinates, and performs prediction-based compression on mesh connectivity. The decompressed data is equivalent to the original data within the quantization accuracy range.
[0054] The specific implementation of step S01 is as follows: Perform structured parsing on the input STEP file. First, traverse the PRODUCT and NEXT_ASSEMBLY_USAGE_OCCURRENCE entities in the file, recursively construct the assembly hierarchy node tree, and record the parent-child relationship and transformation matrix of each node, outputting the assembly structure file. For each B-Rep entity, extract its topological adjacency relationships of faces, edges, and vertices, assign a unique integer topological surface identifier to each surface, and write it to an independent integer attribute buffer. Subsequently, perform topology-preserving curvature adaptive discretization on each parametric surface: calculate the principal curvature at regular sampling points in the surface parameter domain. and With Gaussian curvature The absolute value is used to construct a curvature-weighted Riemannian metric tensor, and the sampling point spacing is controlled by the geodesic distance. The spacing in flat regions is taken as... The spacing of the high curvature region shrinks to Precision coefficient The target triangles are determined by covering three types of samples: low-curvature planes, medium-curvature cylindrical surfaces, and high-curvature small fillets. Each type undergoes at least 50 parameter combinations, with the goal of minimizing the chord-to-height difference error to less than 0.01 mm and the total number of facets. After sampling, the Rupert-Schuck refinement algorithm is used to perform Delaunay triangulation. This algorithm checks if the minimum interior angle of a triangle is below a quality threshold (reference value is 20 degrees). For triangles that do not meet the condition, a new vertex is inserted at the center of its circumcircle, and the refinement is iteratively repeated until all triangles meet the quality constraints. The quality threshold is determined by inviting at least 10 engineers to score the rendering results and taking the interior angle value corresponding to the score mutation point. Each generated triangular facet is appended with an integer identifier for its corresponding B-Rep face, thus forming a bidirectional index structure from triangular facets to topological faces and from topological faces to sets of triangular facets. Finally, the vertex coordinates, normals, topological facet identifier integer buffers, and assembly structure are output as geometric data files and assembly structure files.
[0055] The specific implementation of step S02 is as follows: Using the geometric data file output from step S01 and the topological surface identifier as input, a B-Rep topological heterogeneous graph is constructed. The surface node feature vector contains seven dimensions: normalized surface area, three independent components of the Gaussian curvature tensor, and a three-dimensional unit vector of the normal direction. The edge node feature vector contains four dimensions: the cosine of the dihedral angle and a one-hot encoding of curvature continuity. The vertex node feature vector contains four dimensions: normalized number of clustered surfaces and a three-dimensional vector of vertex coordinates. The topology-aware accuracy prediction model contains four graph attention layers, each with eight attention heads and a hidden dimension of 128. Attention weights between non-adjacent nodes are forced to zero. After each round of message passing, the topology consistency iteration layer checks the Euler constraint. The default node features are corrected and redirected, with a maximum of 5 iterations. Finally, the chord height difference proposal value for each face node is output through two fully connected layers. The training dataset contains no fewer than 5000 industrial STEP models. For each B-Rep face, multiple sets of chord height differences within the range of 0.001mm to 1mm are triangulated. Labels are determined based on the criterion of measurement error less than 0.01mm and the minimum number of facets. The training, validation, and test sets are divided in an 8:1:1 ratio. The mean squared error is used as the loss function, with the Adam optimizer, an initial learning rate of 0.001, and a batch size of 32. The validation set stop early if the loss does not decrease for 20 consecutive rounds, and the 90th percentile error of the test set must be less than 0.005mm. After obtaining the chord height difference proposal value, the accuracy adjustment coefficient is calculated. Reference transmission bandwidth Take 20Mbps, based on The intervals are each multiplied by the suggested chord height difference by the corresponding coefficient, and the affected surfaces are triangulated again and the geometric data file is updated.
[0056] The specific implementation of step S03 is as follows: Traverse all geometric bodies in the geometric data file, calculate the hash value for the vertex coordinates, normals, and topological surface identifier arrays of each geometric body. Geometric bodies with the same hash value are identified as duplicate instances, and only one copy of the geometric data is retained. The 4×4 transformation matrix of each instance in the assembly coordinate system is appended to the corresponding geometric block in list form, forming an instance transformation matrix list. This ensures that the same part occupies only one copy of the geometric data in both storage and subsequent video memory. Subsequently, quantization compression is performed on the vertex coordinates, storing floating-point coordinates with fixed-precision integer encoding to reduce the number of bytes per vertex. Finally, the triangular mesh vertex coordinates, normals, topological surface identifier integer buffers, instance transformation matrix list, assembly level node tree, and material properties are serialized into a binary stream according to a custom lightweight format specification. Brotli lossless compression is then performed on the entire binary stream to output a custom lightweight format file. This format retains B-Rep topological semantic information and supports incremental block loading and multi-level detail mechanisms.
[0057] The specific implementation of step S04 is as follows: The custom lightweight format file is split according to geometric block boundaries. For each geometric block node, the ratio of its projected area under the current viewpoint to the viewing distance is used as the visual importance weight, and the inverse of the current estimated network transmission bandwidth is multiplied by the block volume as the edge transmission cost weight. A variant of Prim's minimum spanning tree algorithm is run on the directed dependency graph. Each time, the node with the highest visual importance is selected from the set of nodes that satisfy the dependency loading condition and added to the loading queue. The corresponding geometric blocks are requested sequentially through the Hypertext Transfer Protocol (HTTP). The front-end creates a Web worker thread pool outside the browser's main thread. Multiple worker threads execute Draco geometry decoding and custom lightweight format file deserialization in parallel. The decoded array buffer is passed to the main thread using a transferable object mechanism. The sending thread marks the array buffer as transferable during postMessage. After transfer, the sender's access permissions immediately expire, and the receiver gains full ownership. No memory copying is performed throughout the process. When the user's viewpoint changes, the visual importance of nodes in the queue that have not yet started transmission is recalculated and reordered in real time. Block data that has already been transmitted is not discarded.
[0058] The specific implementation of step S05 is as follows: After receiving the array buffer passed with zero copy, the main thread directly uploads the vertex coordinates, normals, and topological face identifier integer buffers to the graphics processor buffer. Based on the assembly structure file, it recursively constructs scene-level objects, with each assembly node corresponding to a transformation node. The transformation matrix is directly assigned from the records in the assembly structure file. For geometric blocks with an instance transformation matrix list, all 4×4 transformation matrices in the list are read. Thousands of identical parts are merged into a single drawing call using instantiated mesh objects, ensuring that identical geometric data occupies only one copy in the graphics processor's memory, significantly reducing memory usage and the amount of data uploaded from the central processing unit to the graphics processor. Simultaneously, a bidirectional index mapping table is established based on the topological face identifier integer buffer, connecting triangular faces to topological faces and topological faces to sets of triangular faces. This table is stored in the main thread's memory for subsequent interactive operations.
[0059] The specific implementation of step S06 is as follows: The picking operation uses an off-screen rendering program. An off-screen rendering channel runs on the graphics processor, encoding the integer topological face identifier of each triangle in the scene into the color channel value of the frame buffer for off-screen rendering. When the user clicks the screen, the color value of the corresponding pixel in the off-screen frame buffer is read and decoded back into an integer topological face identifier. All triangle face indices corresponding to that topological face are retrieved through a bidirectional index mapping table, and highlighting is performed on them. The slicing operation utilizes the clipping plane function provided by the graphics framework. In the shader, the signed distance between each fragment and the clipping plane is calculated. Fragments with negative distances are discarded. When the clipping plane position changes, the spatial relationship between each topological face and the clipping plane is reassessed, and the highlight state and visibility of the measured annotations of the clipped topological faces are updated. When the viewpoint changes, the visual importance of geometric blocks that have not yet started transmission in the loading queue is recalculated in real time and reordered. Geometric blocks that have already been transmitted are not discarded, achieving viewpoint-aware adaptive prefetching scheduling.
[0060] It should be noted that the key technologies of this invention include: First, a collaborative mechanism between a topology-aware accuracy prediction model and curvature adaptive discretization. This mechanism structures the B-Rep topology into a heterogeneous graph. Utilizing a graph attention mechanism, the accuracy decision of each surface is constrained and corrected by the curvature continuity of adjacent surfaces and edges. The topology consistency iteration layer ensures global topology self-consistency through forced Euler constraints, thereby eliminating visual gaps and measurement errors caused by accuracy jumps between adjacent surfaces in the traditional globally unified chord height difference method. Simultaneously, curvature-weighted sampling ensures extremely sparse sampling in flat areas and dense sampling in high-curvature areas, achieving an adaptive balance between accuracy and the total number of vertices. Second, a collaborative mechanism between a minimum spanning tree-based geometric block dependency graph scheduling algorithm and a zero-copy streaming loading pipeline. This mechanism couples visual importance weights with network bandwidth in real time as loading priorities, ensuring that limited bandwidth first serves the geometric content that contributes the most to the current viewpoint. Parallel decoding and zero-copy delivery using the Web worker thread pool cause pipeline overlap between the CPU decoding time and the GPU rendering time, reducing the first-frame visibility latency. The two key technologies work together to eliminate redundant vertices in the discretization stage, maximize bandwidth utilization in the transmission stage, and merge drawing calls through instantiation in the rendering stage. The optimization effects of the three stages are superimposed, thereby achieving efficient rendering of large-scale assemblies on the Web.
[0061] It should be noted that this invention also solves the following technical problem: In existing web-based CAD rendering systems, topological face identifiers are usually discarded during the format conversion stage, resulting in the front end only being able to manipulate triangular facets and unable to reverse-associate with the original B-Rep topological face. Engineering-level face selection and measurement operations can only rely on approximate ray picking results, and the face selection accuracy is directly affected by the triangulation density. This invention adds an integer topological face identifier to each triangular facet during the topology-preserving curvature adaptive discretization stage, independently stores this integer buffer in a custom lightweight format, establishes a bidirectional index mapping table in the main thread, and encodes the identifier as a framebuffer color value in the picking shader, forming a complete reverse lookup link from screen pixels to the original B-Rep topological face. Regardless of changes in triangulation density, the topological face identifier is strongly bound to the triangular facet, and the picking result is always accurately restored to the original topological face. The sectioning linkage operation can also correctly update the highlight state and measurement annotation visibility because the topological relationship is completely preserved, thus solving the technical problem in web-based CAD systems where face selection and measurement operations cannot be accurately restored to the original B-Rep topological face due to the loss of topological semantics.
[0062] A second aspect of the present invention provides a computer-readable storage medium storing program instructions that, when executed in a computer, perform the above-described efficient rendering method for a web-based model.
[0063] A third aspect of the present invention provides a high-efficiency rendering system for web-based models, comprising the aforementioned computer-readable storage medium. The system can be any one of a computer, a server, or a microcontroller. The computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes program instructions stored in the computer-readable storage medium.
[0064] Specifically, the principle of this invention is as follows: The fundamental reason why this invention can solve the aforementioned core technical problems lies in the fact that three mutually coupled mechanisms logically form a complete information link. First, the topology-aware accuracy prediction model models the faces, edges, and vertices of the B-Rep as heterogeneous graphs. Through a graph attention mechanism, the accuracy decision of each surface carries adjacent topological context information. The topology consistency iteration layer further enforces global Euler constraints, thereby ensuring that the discretization scheme is self-consistent at the topological level and avoiding accuracy jumps between adjacent surfaces. Second, the chord height difference adjustment function couples the prediction accuracy with global curvature characteristics and real-time network bandwidth into a unified adjustment coefficient, allowing the discretization granularity to adaptively scale with transmission conditions, rather than being statically fixed. Finally, the topological surface identifier serves as a semantic anchor connecting the discrete geometry and the original B-Rep, running through the entire process of custom lightweight format storage, streaming block scheduling, and GPU picker shader execution, ensuring that topological semantics are not lost at any processing stage, thus achieving engineering-level face selection and sectioning linkage on the rendering side. The synergy of these three mechanisms simultaneously satisfies the constraints of accuracy, bandwidth, and semantics.
[0065] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.
[0066] The specific implementation of step S01 is as follows: Parse the input STEP file, recursively traverse the assembly hierarchy, and extract the B-Rep topology data of each component, including faces, edges, vertices, and their adjacency relationships. Perform a topology-preserving curvature adaptive discretization algorithm on each parametric surface. Calculate the principal curvature at each sampling point in the surface parameter domain. and Gaussian curvature is defined as:
[0067] ;
[0068] In the formula, Gaussian curvature, in units of , These are the principal curvatures of the surface in the two principal directions at that point, in units of... .by As a local sampling density weight, a curvature-weighted Riemannian metric tensor is constructed in the parameter domain, and the sampling point spacing is controlled by the curvature-weighted geodesic distance. The maximum spacing is taken in flat regions. The spacing of the high curvature region shrinks to:
[0069] ;
[0070] In the formula, The minimum sampling interval for high curvature regions, in units of The maximum sampling interval for a flat area, in units of The precision coefficient, dimensionless, was determined through gradient experiments. The experimental samples covered three types: low-curvature planes, medium-curvature cylindrical surfaces, and high-curvature small fillets. The optimization objective was to minimize the chord-to-height difference error (less than 0.01 mm) and the total number of facets. This was determined after at least 50 parameter combinations. After sampling, the Rupert-Schwarz thinning algorithm was used to perform Delaunay triangulation on the parameter domain point set. The algorithm checked whether the minimum interior angle of the triangle was below a quality threshold (typically 20 degrees). For unqualified triangles, a new vertex was inserted at the circumcenter. This process was iterated until all triangles met the quality constraints. The quality threshold was determined by at least 10 engineers scoring the rendering results and taking the values corresponding to the points of significant score mutations. During discretization, an integer identifier for the original B-Rep facet was appended to each triangular facet. The data is stored in an independent integer attribute buffer, forming a bidirectional index structure from triangular facets to topological faces and from topological faces to sets of triangular facets, and finally outputting assembly structure files and geometric data files.
[0071] The specific implementation of step S02 is as follows: The geometric data output from S01 and the topological surface identifier are input into the topology-aware accuracy prediction model. This model models the B-Rep topology as a heterogeneous graph. ,in , , These are the set of face nodes, the set of edge nodes, and the set of vertex nodes, respectively. Let be the set of adjacent edges of the heterogeneous graph. The feature vectors of the face nodes are:
[0072] ;
[0073] In the formula, The 7-dimensional feature vectors of the face nodes are dimensionless. The surface area is expressed in units of 1000 ppm. ; Normalized reference area, unit: ; , , These are the three independent components of the Gaussian curvature tensor, with units of . , divided by Post-dimensionless input model , , These are the three components of the unit vector of the normal direction, and are dimensionless. The eigenvectors of the edge nodes are:
[0074] ;
[0075] In the formula, Let be the 4-dimensional feature vector of the edge node, which is dimensionless; The dihedral angle between the two lateral faces of a side is expressed in rad. , , This is a one-hot encoding for curvature continuity, corresponding to three classes: tangent plane continuity, curvature continuity, and discontinuity, with values of 0 or 1. The vertex node feature vector is:
[0076] ;
[0077] In the formula, The 4-dimensional feature vector of the vertex node is dimensionless. The number of faces clustered at the vertices Number of normalized reference surfaces , , These are the vertex coordinates, in units of . For reference length, the unit is... The model uses a graph attention mechanism to pass messages, forcing the attention weights between non-adjacent nodes to zero. After each round of message passing, the topology consistency iteration layer checks the Euler's formula constraints.
[0078] ;
[0079] In the formula, , , These represent the number of face nodes, edge nodes, and vertex nodes in the current graph. , , These represent the number of vertices, edges, and faces of the reference topology. Euler characteristic of the reference topology , , , All values are dimensionless. If the condition is not met, a correction jump is performed on the features of the node that violates the constraint, with a maximum of 5 iterations. The model consists of 4 graph attention layers, each with 8 attention heads and a hidden dimension of 128. Finally, two fully connected layers are connected to output the chord height difference proposal value for each face node. The unit is subscript Number the face nodes. The training dataset contains no fewer than 5000 industrial STEP models. The optimal chord height difference label for each face is determined based on the criteria of measurement error less than 0.01 mm and minimum number of face patches. The dataset is divided into training, validation, and test sets in an 8:1:1 ratio. The mean squared error is used as the loss function, and the Adam optimizer is employed with an initial learning rate of 0.001 and a batch size of 32 model graphs. The training epochs do not exceed 200. Early stopping is performed when the validation set loss does not decrease for 20 consecutive epochs. The 90th percentile error on the test set is less than 0.005 mm as the passing standard. After obtaining the suggested chord height difference values for each face, the mean of all B-Rep face chord height difference suggested values is calculated. And the global maximum value of the absolute value of Gaussian curvature. Combined with the current estimated network transmission bandwidth Calculation accuracy adjustment coefficient:
[0080] ;
[0081] In the formula, This is a precision adjustment coefficient, dimensionless. This is the average of all suggested values for the chord height difference, in units of... This represents the global maximum absolute value of the Gaussian curvature, in units of... This is an estimated value for the current network transmission bandwidth, in units of... The base transmission bandwidth is expressed in units of 1000 kilometres per second. Experience value: 20 It is determined by the bit values from no fewer than 100 sets of transmission experiments. When, the suggested values for all surface chord height differences are multiplied by 0.5 for encryption; when When, keep the recommended value unchanged; when When the curvature is below the global mean, the chord height difference of flat surfaces is suggested to be multiplied by 2 for sparsification; when At that time, the suggested values for chord height differences of all surfaces are multiplied by 3, and a low-precision detail level scheme is enabled for priority loading. The boundary values of 0.1, 0.5, and 1.0 for each interval are determined through at least 200 sets of combined experiments with different model sizes and network conditions, using Pareto front analysis of the first frame loading time and measurement error. Based on the adjusted chord height difference parameters, the triangulation of the corresponding surfaces is re-executed, and the geometric data file is updated.
[0082] The specific implementation of step S03 is as follows: perform hash comparison on the geometric objects in the geometric data file, identify duplicate instances, merge and store identical geometric objects, and attach the coordinate system of each instance in the assembly coordinate system. Transformation matrix Its formula is expressed as follows:
[0083] ;
[0084] In the formula, The homogeneous transformation matrix of the instance ( , ) represents the elements of the rotation submatrix, which are dimensionless. , , These are the translation vector components, in units of... Quantization compression is performed on the vertex coordinate data, storing floating-point vertex coordinates as fixed-precision integers to reduce the number of bytes stored per vertex. Brotter lossless compression is then performed on the final binary data, outputting a custom lightweight format file that structurally stores the triangular mesh vertex coordinates, normals, topological surface identifier integer buffers, instance transformation matrix list, assembly level node tree, and material properties.
[0085] The specific implementation of step S04 is as follows: The custom lightweight format file is divided into geometric blocks according to the geometric block dependency graph scheduling algorithm based on minimum spanning tree. The geometric blocks are modeled as a directed dependency graph, where nodes represent geometric blocks and directed edges represent assembly reference dependencies between blocks. The ratio of the projected area of each geometric block under the current viewpoint to the viewing distance is used as the visual importance weight of the node. Its formula is expressed as follows:
[0086] ;
[0087] In the formula, For the first Visual importance weights for each geometric block, dimensionless, subscripted. Number the geometric blocks For the first The projected area of a geometric block from the current viewpoint, in units of For the first The viewing distance of each geometric block, in units of The transmission cost weight of an edge is calculated by multiplying the inverse of the current estimated network bandwidth by the block size. Its formula is expressed as follows:
[0088] ;
[0089] In the formula, To start from the already loaded block To the block to be loaded The right to transmission cost, dimensionless For the first The volume of each geometric block, in units of This is an estimated value for the current network transmission bandwidth, in units of... In step S02 The meaning is the same. A variant of Prim's minimum spanning tree algorithm is run on the directed dependency graph. Each time, the node with the highest visual importance is selected from the set of nodes satisfying the dependency loading condition and added to the loading queue. Priority is given to downloading the geometric blocks that contribute the most to the current viewpoint. When the user's viewpoint changes, the queue nodes that have not yet started loading are recalculated in real time. Concurrent reordering. The front-end requests in chunks via the Hypertext Transfer Protocol, and performs Draco geometry decoding and custom format deserialization in parallel in a network worker thread pool. The decoded array buffer is then passed to the main thread as a transferable object, without memory copying during the transfer process.
[0090] The specific implementation of step S05 is as follows: the main thread uploads the received geometric data to the graphics processor buffer, constructs scene-level objects based on the assembly structure file, and reads the transformation matrix for repeated instances. The list merges thousands of identical parts into a single draw call, ensuring that identical geometric data occupies only one copy in video memory, based on topological surface identifiers. Establish a bidirectional index mapping table from triangular facets to topological faces and from topological faces to sets of triangular facets.
[0091] The specific implementation of step S06 is as follows: When the user performs a click operation, the picking shader stores the topological face identifier of each triangle in the off-screen frame buffer. The color value is encoded for off-screen drawing; the color value corresponding to the clicked pixel is read and decoded to restore it. The corresponding triangular facet index set is obtained by reverse lookup of the bidirectional index mapping table, and highlighting is applied to it. When the user performs a sectioning operation, the clipping plane in the shader determines the signed distance between each fragment and the clipping plane. Fragments with negative distances are discarded. When the clipping plane's position changes, the spatial relationship between each topological face and the clipping plane is reassessed, and the highlighting state and measurement label visibility of the clipped topological face are updated accordingly. When the user's viewpoint changes, the visual importance weights of each geometric block are recalculated in real time. It also reorders the unloaded queue to achieve view-aware adaptive prefetching scheduling.
[0092] To better understand and implement this invention, the following is a specific application scenario of the invention, Example 2: To verify the effect of the invention, the technicians set up a test environment and selected an industrial-grade automotive chassis assembly STEP model containing 2347 parts as input. The model has a total of 187632 B-Rep surfaces, including a large number of small rounded corner high curvature surfaces and large-area flat sheet metal surfaces. The original STEP file size is 2.3GB, the test network bandwidth is set to 12Mbps, the browser uses a standard environment that supports WebGL 2.0, and the Web worker thread pool is configured with 4 worker threads.
[0093] In step S01, the technician parses the STEP file, extracting 1243 nodes from the assembly-level node tree, identifying 187632 B-Rep surfaces, and assigning topological surface identifiers. The topology-preserving curvature adaptive discretization algorithm is used for Gaussian curvatures with absolute values exceeding 0.5. Dense sampling was applied to high-curvature surfaces (mainly rounded and chamfered areas, totaling 21,847 surfaces), with Gaussian curvature absolute values below 0.02. The flat surfaces (mainly sheet metal and mounting surfaces, totaling 103,215 surfaces) are allocated with extremely sparse sampling, resulting in a high accuracy coefficient. The reference value of 8.0 was determined through experiments, and the quality threshold of the Rupert-Schuck thinning algorithm was set to 20 degrees. The total number of triangular patches generated by the initial triangulation is shown in Table 1.
[0094] Table 1. Statistics on the number of initial triangulated face patches for each surface type
[0095]
[0096] In step S02, technicians input geometric data and topology surface identifiers into the topology-aware accuracy prediction model. The model outputs suggested chord height differences for each of the 187,632 B-Rep surfaces. Current test network bandwidth estimate. The base transmission bandwidth is 12Mbps. The recommended average value for global chord height difference is 20 Mbps. The maximum global Gaussian curvature is 0.042 mm. It is 1.87 Calculation accuracy adjustment coefficient It is 0.62, falling into For the interval, the chord height difference of the 103215 flat surfaces with curvature lower than the global mean is uniformly multiplied by 2 for sparsification. After re-triangulation, the total number of flat surface patches is reduced. The updated distribution of the number of surface patches for each surface is shown in Table 2.
[0097] Table 2 Comparison of the number of surface patches for each surface type after accuracy adjustment
[0098]
[0099] In step S03, technicians perform duplicate geometry identification on the geometric data file. By comparing hash values, 764 pairs of symmetrical parts were found to be duplicate instances. After instance deduplication, the number of independent geometries stored decreased from 2347 to 1583, and a 4×4 transformation matrix was added to each duplicate instance. After quantization compression of vertex coordinates, the number of bytes stored per vertex decreased from 48 bytes to 16 bytes. Finally, the binary data was compressed using Brotli and output as a custom lightweight format file with a size of 187MB.
[0100] In step S04, as Figure 3 As shown, the technicians divided the custom lightweight format file into 1583 geometric blocks, established a directed dependency graph based on a variant of Prim's minimum spanning tree algorithm, and arranged the loading queues accordingly. The front end requested the blocks in chunks via the Hypertext Transfer Protocol, and four web worker threads decoded them in parallel. The decoded array buffer was passed to the main thread as a transferable object, without any memory copying. During testing, the technicians simulated user rotation from the initial viewpoint. The scheduling algorithm recalculated the visual importance of the untransmitted geometric blocks in real time and rearranged the queues, prioritizing the transmission of high-priority geometric blocks visible in the current viewpoint. The time required for all visible geometric blocks (the top 200 in visual importance) in the first frame to load is recorded in Table 3.
[0101] Table 3. Statistics on the loading time of the first batch of high-priority geometry blocks under different network bandwidths.
[0102]
[0103] In step S05, the main thread uploads the received geometric data to the graphics processor buffer, constructs scene-level objects based on the assembly structure file, and merges 764 pairs of symmetrical parts into a single draw call by instantiating mesh objects, ensuring that identical geometric data occupies only one copy in the graphics processor's video memory. After the bidirectional index mapping table is established, the correspondence between the number of triangular faces and the topological face identifiers is completely stored in the main thread's memory.
[0104] In step S06, the technician performs a face selection operation on the rendered car chassis model. Clicking on a rounded face at the edge of a bolt hole, the shader reads the encoded color value of the corresponding pixel in the off-screen frame buffer and decodes it into an integer topological face identifier. After looking up the bidirectional index mapping table, all triangular faces corresponding to this topological face are highlighted. The highlighting result accurately restores the original B-Rep rounded face boundary, without any cross-face contamination. Subsequently, the technician performs a sectioning operation, using a horizontal clipping plane to section the chassis cross-section. The shader discards fragments with negative distances in real time. The sectioning result is updated in conjunction with the topological relationship. The highlighting state and measurement annotation visibility of the clipped topological faces correctly respond to changes in the clipping plane's position, such as... Figure 2 As shown.
[0105] Compared to traditional web-based CAD rendering solutions, this invention brings several fundamental advancements at the technical level. At the discretization level, traditional solutions use a globally uniform chord height difference, resulting in numerous redundant triangular patches in flat areas while accuracy remains insufficient in high-curvature areas. This invention, through a topology-aware accuracy prediction model, incorporates topological context information into the accuracy decision of each surface using a graph attention mechanism. This allows the sampling density to adapt synchronously with local curvature and the topological relationships of adjacent surfaces, fundamentally eliminating the problem of simultaneous accuracy redundancy and insufficiency. At the transmission level, traditional solutions download in static block order, with bandwidth utilization strategies independent of the user's viewpoint. This invention, through a variant of the Prim's minimum spanning tree algorithm, embeds visual importance into the scheduling priority in real time, ensuring that limited bandwidth serves the geometric content that contributes most to the current viewpoint at every moment, guaranteeing the visual integrity of the first frame through the scheduling mechanism. At the semantic level, traditional solutions discard topological face identifiers during format conversion, and the front end can only use triangular facets as the operation unit. This invention retains topological face identifiers throughout the process and establishes bidirectional indexes and off-screen picking channels, so that the semantic granularity of face selection and cutting operations is accurately restored to the original B-Rep topological face, thus solving the problem of engineering-level interactive accuracy from the underlying data structure.
[0106] It should be noted that the variables involved in this invention are explained in detail in Table 4.
[0107] Table 4. Variable Explanation Table
[0108]
[0109] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for efficient rendering of web-based models, characterized in that, Includes the following steps: The system parses the input STEP file, extracts the assembly hierarchy and B-Rep topology data, converts each parametric surface into a triangular mesh using a topology-preserving curvature adaptive discretization algorithm, writes the original topology surface identifier for each triangular facet, and outputs the assembly structure file and geometric data file. Input the geometric data and topological surface identifiers into the topology-aware accuracy prediction model to obtain the chord height difference suggested value for each B-Rep surface. Calculate the accuracy adjustment coefficient based on the chord height difference adjustment function and divide the interval. Adjust the discretization accuracy parameters of each surface according to the interval results, re-execute the triangulation of the corresponding surface, and update the geometric data file. The program performs deduplication on duplicate geometries in the geometry data file, merges and stores identical geometries and appends them with a list of instance transformation matrices, performs quantization compression on vertex coordinate data, performs transmission compression on the final binary data, and outputs a custom lightweight format file. Based on the minimum spanning tree-based geometric block dependency graph scheduling algorithm, the custom lightweight format file is divided into geometric blocks, a directed dependency graph between blocks is established, and the loading queue is arranged according to visual importance priority. The front end requests the blocks through the Hypertext Transfer Protocol and decodes them in parallel in the Web worker thread pool. The decoding result is passed to the main thread with zero copy. The main thread uploads the received geometric data to the graphics processor buffer, constructs scene-level objects based on the assembly structure file, merges duplicate instances into a single draw call using instantiated mesh objects, and establishes a bidirectional index mapping table from triangular patches to topological surfaces based on topological surface identifiers. When a user performs a click operation, the topological face identifier of the corresponding pixel in the frame buffer is read by the pick shader, and the topological face is highlighted by looking up the bidirectional index mapping table. When a user performs a cutting operation, the scene is clipped using a clipping plane, and the clipping result is updated in conjunction with the topology to update the highlighted state. When the user's perspective changes, the visual importance of geometry blocks is recalculated in real time and the unloaded queue is reordered.
2. The efficient rendering method for web-based models according to claim 1, characterized in that, The topology-preserving curvature adaptive discretization algorithm specifically calculates the principal curvature of each sampling point in the surface parameter domain. and With Gaussian curvature The absolute value is used as the local sampling density weight, and the maximum spacing is taken for the flat region spacing. The spacing of the high curvature region shrinks to The Rupert-Schuck refinement algorithm is used to ensure the quality of the triangulated mesh.
3. The efficient rendering method for web-based models according to claim 2, characterized in that, The Rupert-Shuker refinement algorithm specifically detects whether the minimum interior angle of a triangle is lower than the quality threshold. For unqualified triangles, a new vertex is inserted into the circumcenter. The algorithm is iterated until all triangles meet the quality constraints. The quality threshold is determined through visual evaluation experiments on rendering scenes with different interior angles. The experiments invite no fewer than 10 engineers to score the rendering results, and the interior angle value corresponding to the score mutation point is taken as the threshold.
4. The efficient rendering method for web-based models according to claim 3, characterized in that, The topology-aware accuracy prediction model specifically uses the face, edge, and vertex elements of the B-Rep topology to model a heterogeneous graph. The feature vectors of face nodes are seven-dimensional, the feature vectors of edge nodes are four-dimensional, and the feature vectors of vertex nodes are four-dimensional. The graph attention mechanism is used as the basic message passing unit. The attention weights are constrained by the topological adjacency relationship, and the attention weights between non-adjacent nodes are forced to zero.
5. The efficient rendering method for web-based models according to claim 4, characterized in that, The topology-aware accuracy prediction model has a topology consistency iteration layer inside. After each round of message passing, it checks whether the number of face nodes, edge nodes, and vertex nodes meet the Euler formula constraint. If not, it performs correction and jump on the node features that violate the constraint. After a maximum of 5 iterations, it enters the next round of message passing.
6. The efficient rendering method for web-based models according to claim 5, characterized in that, The topology-aware accuracy prediction model consists of four graph attention layers, each with eight attention heads and a hidden dimension of 128. Finally, two fully connected layers are connected to output the chord height difference proposal value corresponding to each face node. During training, mean squared error is used as the loss function, the Adam optimizer is used, the initial learning rate is 0.001, the batch size is 32 model graphs, and early stopping is performed when the validation set loss does not decrease for 20 consecutive rounds.
7. The efficient rendering method for web-based models according to claim 6, characterized in that, The geometric block dependency graph scheduling algorithm based on minimum spanning tree specifically models the geometric blocks as a directed dependency graph, uses the ratio of the projected area of each geometric block under the current viewpoint to the viewing distance as the visual importance weight of the node, runs a variant of the Prim minimum spanning tree algorithm on the directed dependency graph, and selects the node with the highest visual importance from the set of nodes that meet the dependency loading condition and adds it to the loading queue each time.
8. The efficient rendering method for web-based models according to claim 7, characterized in that, The Web worker thread pool consists of multiple worker threads created outside the browser's main thread, used to perform CPU-intensive operations such as Draco geometry decoding and custom lightweight format file deserialization in parallel; the decoded array buffer is passed to the main thread as a transferable object, and no memory copying occurs during the transfer process.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions, which, when executed in a computer, are used to perform the efficient web-based model rendering method according to any one of claims 1-8.
10. A high-efficiency model rendering system for a web application, characterized in that, The system comprises the computer-readable storage medium of claim 9, wherein the system is a computer, the computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes program instructions stored in the computer-readable storage medium.