Three-dimensional rendering method and system based on digital twinning
By optimizing the number of model patches and vertices, and using unified texture maps and parallel loading technology, the problem of inefficient rendering efficiency of high-performance digital twin systems on low-performance platforms is solved, achieving a smoother three-dimensional rendering effect.
Patent Information
- Application Number
- CN202411648037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is difficult to effectively run high-performance digital twin systems on low-performance digital platforms, resulting in inefficient rendering and lag problems.
By reducing the number of model patches and vertices, using a unified texture map for rendering, loading model and texture data in parallel, combining rendering call instructions, and optimizing the rendering process using WebGL and Web Assembly technology.
It significantly improves rendering efficiency and frame rate, reduces memory usage and CPU-GPU interactions, and adapts to the rendering needs of low-performance hardware platforms.
Smart Images

Figure CN119810284A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a three-dimensional rendering method based on digital twins, and also to a corresponding three-dimensional rendering system, belonging to the technical field of image data processing. Background Art
[0002] The hardware requirements of digital twin technology mainly involve CPU, GPU, memory and hard disk. As the core component of rendering, CPU is responsible for a large amount of calculation and processing. High-performance CPU usually has multiple cores, high main frequency and large cache, which can significantly improve rendering efficiency. GPU or graphics processing unit is responsible for graphics display and processing, providing real-time preview, anti-aliasing, mapping accuracy and other functions. GPU with high number of stream processors, video memory capacity and bit width can provide stronger graphics performance. Memory is used to temporarily store data and programs, which affects the data exchange and cache speed during the rendering process. Complex rendering tasks require more memory space. The speed and capacity of the hard disk are equally important for graphics rendering. Solid-state drives are hundreds or thousands of times faster than mechanical hard drives, which can significantly improve the software running speed and file processing speed.
[0003] In terms of software, the requirements of digital twin technology mainly include operating systems and browsers. However, high-performance digital twin systems require high-performance graphics cards to match them in order to achieve model rendering. If the graphics card performance is insufficient, it is impossible to directly port the high-performance digital twin system to a low-performance digital platform. Therefore, there is a need to develop a 3D rendering method that can combine a low-performance digital platform with a high-performance digital twin system to achieve effective operation on different performance platforms.
[0004] In the Chinese patent application with application number 202211017840.X, a method for implementing three-dimensional rendering based on an ARM instruction set CPU is disclosed. This method is based on the self-developed OS3 general operating system under the ARM architecture, uses the domestic Feiteng CPU hardware chip, and optimizes the self-developed i3D three-dimensional interactive application engine, breaking through the graphics card performance under the ARM instruction set CPU to more than 8GB of video memory, ensuring the possibility of real-time rendering of large three-dimensional scenes, smoothness and high-performance output; and solves the problem that the CPU under the ordinary ARM instruction set cannot meet the three-dimensional scene rendering effect, and there are freezes, black screens, and freezes; in addition, through the development of a graphics workstation with a domestic Feiteng CPU + 8GB independent graphics card, equipped with a self-developed OS3 general operating system, the process of perfectly running the i3D three-dimensional interactive application engine fills the gap that three-dimensional application software cannot be used on the domestic operating system architecture. Summary of the invention
[0005] The primary technical problem to be solved by the present invention is to provide a three-dimensional rendering method based on digital twins.
[0006] Another technical problem to be solved by the present invention is to provide a three-dimensional rendering system based on digital twins.
[0007] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0008] According to a first aspect of an embodiment of the present invention, a three-dimensional rendering method based on digital twins is provided, comprising the following steps:
[0009] Based on digital twin technology, obtain the model parameters of the model to be rendered;
[0010] Based on the model parameters of the model to be rendered, on the premise that the model appearance and appearance curvature meet the preset requirements, the initial model is constructed by reducing the number of model faces and vertices and reusing geometric data of the same appearance;
[0011] The initial model is texture rendered using the same texture map so that the color, brightness, texture structure, concave-convex feeling and appearance composition style of all sub-components of the initial model are consistent;
[0012] Separating the model binary data and texture file of the initial model after texture rendering;
[0013] Performing data compression on the model binary data to obtain model binary compressed data; and performing file compression on the texture file to obtain a texture compressed file;
[0014] Loading the model binary compressed data and the texture compressed file in parallel;
[0015] Based on the loaded binary compressed data of the model and the texture compressed file, encapsulate the buffer arrays of the meshes of the same material into a buffer set, and record the fragments of each mesh to draw different sub-components through a preset graphics drawing method, thereby forming an optimized model;
[0016] On a preset digital platform, the optimized model is presented in a WebGL manner.
[0017] Preferably, the method of reducing the number of model faces and vertices and reusing geometric data of the same appearance includes the following sub-steps:
[0018] Merge discrete vertices to reduce the number of vertices;
[0019] Adopt four-sided topology layout and reduce high-precision chamfers to reduce the number of model faces;
[0020] Reduce model subdivision, reuse models with the same appearance, and remove internal occlusion models, so that the number of facets and vertices of the model is reduced to a preset range.
[0021] Preferably, based on the model parameters of the model to be rendered, the type and model size of each sub-component are obtained;
[0022] The sub-components are grouped according to their types, models and sizes, so as to group the sub-components of the same type, model and size into one group; wherein each group of sub-components shares a set of appearance geometric data;
[0023] A corresponding model is generated according to the appearance geometry data of each group of sub-components, so as to complete the model construction of the same group of sub-components by reusing models with the same appearance, thereby reducing model subdivision.
[0024] Preferably, the texture map is formed by drawing, and all sub-components of the initial model share the same texture map.
[0025] Preferably, the model binary compressed data and texture compressed file are obtained in the following manner:
[0026] Using Draco compression, changing the indexing method of the mesh data of the model through a preset compression algorithm to reduce the original mesh order; and reducing the number of bits of vertex coordinates and vertex texture coordinate information to reduce the amount of data storage, thereby forming the model binary compressed data;
[0027] WebP texture compression is used to change the file format of the texture file to reduce the memory occupied by the file, thereby forming a texture compression file.
[0028] Preferably, the optimization model is formed by the following sub-steps:
[0029] Merge vertex and index data of multiple meshes with the same material into a single buffer set;
[0030] In the buffer area set, the starting position and length of each original grid data are recorded as a fragment of the original grid data;
[0031] Multiple rendering call instructions are merged into one by batching, so that multiple sub-components can be rendered by the same rendering call instruction;
[0032] Based on the same rendering call instruction, each grid part in the buffer area set is drawn respectively using a preset graphics drawing function, so as to render different sub-components and form the optimization model.
[0033] Preferably, the three-dimensional rendering method further comprises:
[0034] When uploading uniform variables, upload the same uniform variable again if the value is different to reduce the number of interactions between the CPU and GPU.
[0035] Preferably, before forming the optimization model, the following steps are also included:
[0036] Performing frustum culling optimization and occlusion culling optimization on the initial model after texture rendering to reduce the number of components that need to be rendered in the initial model;
[0037] The frustum culling optimization means: retaining components within the frustum and culling components outside the frustum; the occlusion culling optimization means: retaining visible components and culling invisible components.
[0038] Preferably, the three-dimensional rendering method further comprises:
[0039] The model binary compressed data and the texture compressed file are pre-stored on the browser side to reduce the secondary acceleration network loading time.
[0040] According to a second aspect of an embodiment of the present invention, a three-dimensional rendering system based on digital twins is provided, comprising:
[0041] A parameter acquisition unit, used to acquire model parameters of a model to be rendered based on digital twin technology;
[0042] A model building unit connected to the parameter acquisition unit, to build an initial model based on the parameters of the model to be rendered, by reducing the number of model faces and vertices and reusing geometric data of the same appearance, on the premise that the model appearance and appearance curvature meet preset requirements;
[0043] A texture rendering unit, connected to the model building unit and preset with a texture map, for rendering the initial model with the same texture map, so that the color, brightness, texture structure, concave-convex feeling and appearance composition style of all sub-components of the initial model are consistent;
[0044] A data separation unit, connected to the texture rendering unit, for separating the model binary data and the texture file of the initial model after texture rendering;
[0045] A data compression unit connected to the data separation unit, used for compressing the model binary data to obtain model binary compressed data; and compressing the texture file to obtain a texture compressed file;
[0046] A parallel loading unit, connected to the data compression unit, for loading the model binary compressed data and the texture compressed file in parallel;
[0047] a batch optimization unit connected to the parallel loading unit to encapsulate the cache arrays of meshes of the same material into a cache set based on the model binary compressed data and the texture compressed file, and record fragments of each mesh to draw different sub-components through a preset graphics drawing method, thereby forming an optimized model;
[0048] An output unit is connected to the batch optimization unit and is used to present the optimization model through a preset digital platform.
[0049] Compared with the prior art, the present invention achieves significant performance improvement and resource optimization through the following technical means: First, by reducing the number of facets and vertices of the model and reusing geometric data with the same appearance, the memory usage during WebGL rendering is effectively reduced. Secondly, by adopting a unified model texture, not only the consistency of all models in color, brightness, sub-component texture, concave and convex feeling and appearance composition style is achieved, but also the number of textures is reduced by sharing textures, thereby reducing the number of textures loaded during WebGL rendering, improving the texture loading speed and reducing memory usage. In addition, the model data is loaded using Web Assembly (Wasm) technology, and the binary data of the model is separated from the texture file, which realizes the parallel loading of resources and further improves the loading rate. Finally, multiple rendering call instructions are merged into one through batching technology, so that multiple sub-components can be rendered through a single rendering call instruction, reducing the number of times the CPU sends rendering commands to the GPU and improving rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flowchart of a three-dimensional rendering method based on digital twins provided in the first embodiment of the present invention;
[0051] Figure 2 A schematic diagram of parallel loading of resources in the first embodiment of the present invention;
[0052] Figure 3 This is a rendering of an electric energy cabinet in the first embodiment of the present invention;
[0053] Figure 4 This is another effect diagram of the electric energy cabinet in the first embodiment of the present invention;
[0054] Figure 5 A structural diagram of a three-dimensional rendering system based on digital twins provided in the second embodiment of the present invention;
[0055] Figure 6A structural diagram of a three-dimensional rendering system based on digital twins provided for the third embodiment of the present invention. DETAILED DESCRIPTION
[0056] The technical content of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0057] The embodiment of the present invention focuses on optimizing the digital model obtained through digital twin technology. Its core goal is to reduce the workload of the graphics card and CPU so as to significantly improve the frame rate in the domestic platform environment, thereby enhancing the rendering effect of the digital model on the predetermined digital platform. Through this optimization, it is possible to adapt to the low-performance domestic hardware platform while maintaining high-performance rendering, and achieve a smoother three-dimensional visual effect.
[0058] First embodiment
[0059] like Figures 1 to 4 As shown, a three-dimensional rendering method based on digital twins provided by the first embodiment of the present invention at least includes steps S1 to S8:
[0060] S1: Based on the digital twin technology, obtain the model parameters of the model to be rendered.
[0061] The model to be rendered is preferably a rectangular parallelepiped model, so that the number of facets and the number of vertices of the model can be optimized in the subsequent step S2. However, it should be noted that for those skilled in the art, if the model to be rendered is of other shapes (for example, cylindrical), the optimization steps for the number of facets and the number of vertices of the model need to be replaced with other optimization steps, and these contents can be adaptively adjusted by those skilled in the art according to actual needs.
[0062] For example, in one embodiment of the present invention, for the model to be rendered of the power cabinet, it is necessary to obtain model parameters such as the model size of the power cabinet, the model size of the power cabinet drawer (subcomponent), and photos of the power cabinet installed on site.
[0063] Because the shape of the cabinet is known, the minimum quadrilateral modeling method is used in the modeling process to ensure the minimum number of cabinet faces. However, the same power cabinet and sub-components have different rendering effects under different viewing angles, so different processing is required. Since the power cabinet and sub-components are usually rectangular bodies, and sub-components (such as drawers, display screens, etc.) are all fixed shapes (such as rectangles), the model parameters are used to construct the same geometric topological data for multiple sub-components with the same model parameters. Among them, the geometric data (Geometry) describes the specific position and shape of the model, including basic elements such as points, lines, and surfaces; and the topological data (Topology) describes the adjacency relationship between these elements. In the application scenario, sub-components with the same appearance shape use the same geometric topological data. In this way, the same sub-components are classified according to the model parameters, and each category uses a copy of geometric topological data.
[0064] Moreover, based on the same geometric topological data, data reuse can be performed, and calculations may be simplified when performing geometric transformations (such as translation, rotation, scaling, etc.), thereby reducing hardware performance requirements.
[0065] S2: Based on the parameters of the model to be rendered, and on the premise that the model appearance and appearance curvature meet the preset requirements, the initial model is constructed by reducing the number of model faces and vertices and reusing geometric data with the same appearance.
[0066] In this embodiment, the model is constructed by using a modeling method with a minimum number of faces and only modeling the participating business management model. Specifically, the following aspects are included:
[0067] (1) Merge discrete vertices
[0068] In digital twin modeling, if multiple vertices are on the same straight line or very close (less than a preset value), they can be merged into one or a few vertices, which can significantly reduce the number of vertices while maintaining the shape and features of the model.
[0069] In addition, mesh simplification algorithms are used to optimize the model as a whole, reducing the number of vertices in the model by reducing the number and complexity of the mesh. These algorithms are usually based on certain error control criteria to ensure that the geometric characteristics and visual effects of the model are maintained while reducing the number of vertices.
[0070] As an example, this step may include the following sub-steps:
[0071] S21: Calculate the error metric for each vertex.
[0072] This usually involves calculating how much the appearance of the model would be affected if the vertex was removed. This error metric can be based on a variety of factors, such as the vertex's position, normal, or texture coordinates.
[0073] S22: Sort the vertices according to the calculated error metrics, and select one or more vertices with the lowest error metrics.
[0074] Because the vertices with the lowest error metric are removed, the appearance of the model is less affected.
[0075] S23: Merge the vertices selected in step S22.
[0076] Gradually remove the vertices with the lowest error metric and merge them into the adjacent vertices. The new vertex coordinates can be determined by calculating the average value of the original vertex coordinates (the average value of the adjacent vertices and the removed vertices) to determine the update of the vertex coordinates and obtain the new vertex coordinates. This ensures the continuity and smoothness of the model.
[0077] S24: After the vertices are merged, the normals are recalculated or adjusted according to the new vertex coordinates.
[0078] Calculate the average normal of all faces adjacent to the new vertex and assign this average normal to the new vertex. Even better, skip this step and do not recalculate the normal, which can further reduce the amount of calculation.
[0079] S25: Update the texture coordinates according to the new vertex coordinates.
[0080] The texture coordinates determine how the texture is mapped on the model. After the vertices are merged, the new texture coordinates can be obtained by interpolating the texture coordinates of the original vertices. This can maintain the consistency of the texture on the surface of the model. As described later, the texture of the present invention uses the same texture map, so when the texture coordinates are recalculated based on the new vertex coordinates, the amount of calculation is not large, which can meet the real-time requirements.
[0081] Moreover, merging vertices may affect the accuracy of texture mapping, and the UV coordinates of the texture need to be adjusted appropriately to adapt to the new vertex positions. In order to ensure that the UV coordinates of the merged vertices can correctly reflect their positions on the texture image to maintain the continuity and consistency of the texture, the UV coordinates of each polygon are adjusted during the UV development process to ensure that no two or more quadrilaterals occupy the same UV space to avoid causing the texture to look incorrect; it can also ensure that the mapping of the texture on the model is accurate, so that the UV is evenly distributed overall. In addition, because the vertices of the quadrilaterals in the present invention can be accurately calculated (according to the model parameters in step S1), a simplified UV mapping strategy is adopted when merging vertices, using planar mapping. Planar mapping can create shared overlapping UVs that are similar in appearance to texture boundaries. Enabling texture boundary display can clearly display the texture boundaries, which is very important for ensuring the correct alignment and continuity of the texture when the cabinet is rendered.
[0082] Therefore, the present invention recalculates the positions and texture coordinates of the merged vertices and adopts plane mapping to maintain the continuity and smoothness of the model.
[0083] (2) Four-sided topological layout
[0084] First, it is necessary to clarify the modeling goals and requirements, including the purpose of the model, accuracy requirements, rendering performance, etc. Then, carry out conceptual design according to the requirements and determine the basic shape and structure of the model. In addition, the basic shape is meshed to increase the details and accuracy of the model. Topological optimization is performed on the basis of the mesh after subdivision, and triangles or other polygons in the mesh are converted into quadrilaterals. It should be noted that during the optimization process, the uniformity, continuity and consistency of the mesh should be maintained to avoid problems such as distortion, deformation or broken surfaces.
[0085] For example, by adding new vertices and reconnecting edges to triangles or other polygons in the mesh to create quadrilateral faces, and then parameterizing the entire input model to a 2D parameter domain, and then adjusting the distribution and position of the sampling points in this parameter domain, and finally restoring it to the 3D space, the uniformity and continuity of the mesh can be maintained. Since the model parameters related to the power cabinet have been obtained in step S1, the size of each face is fixed, so the relative position relationship of the four vertices of a face is fixed. Based on the perspective principle, the two vertices of one side strip are selected as the reference, and the positions of the remaining vertices can be calculated, so that new vertices can be added to create quadrilaterals and the uniformity, continuity and consistency of the mesh can be maintained.
[0086] In addition, the mesh can be further adjusted as needed to ensure that it meets the design requirements and aesthetic standards. In addition, more details such as textures, bumps, etc. are added to the key parts of the model to enhance the realism and expressiveness of the model. For example, the appearance is not distorted, the appearance is not deformed, and the texture is not blurred.
[0087] (3) Reuse models with the same appearance and remove internal occlusion models.
[0088] Specifically, multiple methods can be used to achieve the reuse of models with the same appearance. For example: First, establish a standardized model library that contains reusable models with the same or similar appearance. Then, use parametric modeling to create configurable model templates, and quickly generate variant models with different sizes, colors or materials by adjusting parameters, thereby reducing repeated modeling work. Another example: develop automated scripts to handle tasks such as model import, export, format conversion and optimization, thereby significantly improving the efficiency and accuracy of reused models.
[0089] It is understandable that through the above-mentioned multiple modeling methods, the number of model faces and vertices can be reduced to about 10,000 faces, thereby reducing the memory usage of WebGL rendering. As a result, the demand for memory performance of the digital platform is reduced, so that when rendering the model, a digital platform with lower memory can be used for rendering operations.
[0090] S3: Texture rendering of the initial model using the same texture map.
[0091] Conventional modeling methods use photos for texture drawing. Each model to be rendered corresponds to a real photo. Usually, the size of a real photo is about 2 to 3M, and the size after processing is 300 to 500KB. At the same time, using real photos as textures has problems such as inconsistent brightness and color when different photos are taken, and there may be other environmental contents in the photo besides the power cabinet, resulting in low texture utilization.
[0092] In this embodiment, since the cabinet structure of the sub-components of the model to be rendered is basically the same, the cabinet appearance is basically the same, but the cabinet drawers are different in size. Therefore, the common sub-components (such as drawers) are mapped to the same texture, and all sub-components in the model to be rendered share the same texture. It is only necessary to adjust the UV layout of the power cabinet to meet the texture production of all sub-components of the model to be rendered, thereby reducing the number of textures from N to 1, improving texture utilization. It can also reduce the GPU overhead of switching different textures during rendering. Texture atlases can be stored continuously in texture memory, thereby improving cache utilization and rendering efficiency.
[0093] It can be understood that in this embodiment, by drawing a texture, it is ensured that all models have similar colors, consistent brightness, the same sub-component textures, consistent concave and convex sense, and consistent appearance composition styles. In addition, by sharing textures, the number of textures is reduced, the number of textures loaded for WebGL rendering is reduced, the texture loading speed is improved, and the memory usage is reduced. As a result, not only the memory requirements of the digital platform are reduced in terms of the number of textures, but also the loading speed of the digital platform can be effectively improved. In addition, it should be noted that for the model to be rendered, the reason why the same texture is used to render the cabinet is because the functions of each cabinet are basically the same, and there is no need to render with redundant textures. This method is particularly suitable for scenes where power cabinets are rendered.
[0094] S4: Model compression and texture compression.
[0095] After the model is made, if the model is not compressed, the size of the model and the texture will be large. Therefore, in this embodiment, the model binary data and the texture file of the initial model after texture rendering are separated. In addition, the model binary data is compressed using Draco compression to obtain model binary compressed data; the texture file is compressed using WebP texture compression to obtain a texture compressed file.
[0096] Specifically, for the binary data of the model, Draco compression (an open source project developed by Google in the United States, specifically used for compressing and decompressing 3D geometric meshes and point cloud data) is used. The indexing method of the mesh data of the model is changed through a preset compression algorithm to reduce the original mesh order; and the number of bits of vertex coordinates and vertex texture coordinate information is reduced to reduce the amount of data storage, thereby forming model binary compressed data. For texture files, WebP texture compression technology (an image file compression technology developed by Google in the United States, designed to reduce file size while maintaining the same image quality as the JPEG format to reduce the transmission time of images on the network) is used to change the file format of the texture file to reduce the memory occupied by the file, thereby forming a texture compressed file. For example: Using WebP texture compression technology to compress texture files, the original png format image is converted into a lossless WebP format image, thereby reducing the size of the original png format image by 26%.
[0097] Since most of the application scenarios of this embodiment are static textures, a high compression ratio can be used. For example, for the cabinet elements of the power cabinet, a higher compression ratio X is selected to save memory and bandwidth; for important sub-component elements such as drawers, a lower compression ratio Y (Y < X) is selected to maintain high quality. However, when optimizing textures based on viewpoints, using lower resolution textures in areas farther away from the observer may cause texture blurring (for example, when the shared texture resolution is not enough to cover the display size of distant objects, the texture will be stretched or repeated, resulting in distortion and blurring of texture details). In particular, in the case of shared textures in this embodiment, this blurring problem requires special attention. Therefore, when compressing textures, it is necessary to adjust the textures of areas farther away from the observer. The adjustment method can be adjusted by level adjustment. Level 0 represents the maximum level (closest to the viewer), and as the distance increases, the corresponding level increases. By reducing the level of areas with a level greater than a predetermined value, the resolution of textures in areas farther away from the observer can be improved. The adjustment method can also be adjusted based on the number of power cabinets. For example, based on the model parameters of the power cabinet, the number of power cabinets and the oblique viewing angle, the distance between the power cabinets arranged in sequence and the observer can be determined, and the position or distance of each subcomponent of each power cabinet can be determined accordingly to obtain the corresponding level. The compression ratio of the texture of the subcomponent with a level greater than a predetermined value is reduced to improve the texture of the distant area.
[0098] S5: Load model binary compressed data and texture compressed files in parallel.
[0099] Specifically, in this embodiment, after the model binary data and texture file are compressed based on step S4, refer to Figure 2 As shown in the figure, Web Assembly (Wasm) is used to load model data and texture files, thereby supporting parallel loading of resources to increase the loading rate. In addition, caching can also increase the speed of network resource loading.
[0100] S6: Perform frustum culling optimization and occlusion culling optimization on the textured initial model to reduce the number of components that need to be rendered in the optimized model.
[0101] In this embodiment, based on the initial model rendered with textures, frustum culling optimization and occlusion culling optimization are performed on the initial model to reduce the number of components that need to be rendered in the optimized model, thereby reducing rendering calls and improving rendering efficiency.
[0102] Among them, the frustum culling optimization means: retaining the components within the frustum range and culling the components outside the frustum range; the occlusion culling optimization means: retaining the visible components and culling the invisible components. Specifically, in this embodiment, the number of faces of a single model is about 5000 to 10000, and the internal details of the model are retained. OpenGL will store the z value of the fragment in the depth buffer. If it does not pass the depth buffer, the fragment will be discarded.
[0103] S7: Build optimization model.
[0104] Specifically, it includes steps S71 to S74:
[0105] S71: Merge vertex data and index data of multiple meshes having the same material into a cache set.
[0106] Among them, in three-dimensional rendering, the mesh is the basic unit that constitutes a three-dimensional object, which is composed of vertices (Vertex) and the connection relationships between vertices (such as edges and faces).
[0107] A buffer array is a data structure stored in GPU memory that is used to store vertex data (such as position, color, texture coordinates, etc.) and possible index data.
[0108] Packaging into a buffer set means merging the vertex data and index data of multiple meshes with the same material into a larger buffer. The benefit of this is that it can reduce state changes during rendering because all these meshes can use the same material and shader program.
[0109] S72: In the buffer area set, the starting position and length of each original mesh data are recorded as a fragment of the original mesh data.
[0110] It is understandable that after recording each fragment of the original grid data, the data segment corresponding to each grid can be quickly located during rendering, thereby quickly completing the rendering of the sub-component.
[0111] S73: merging multiple rendering call instructions into one in a batching manner, so that multiple sub-components can be rendered by the same rendering call instruction.
[0112] It is understandable that batching refers to combining multiple draw calls into one to reduce the overhead in the rendering process. In this process, although the number of draw calls is not reduced, the rendering efficiency can be improved by reducing the multiple calls to the GPU. And the performance requirements for the digital platform are reduced.
[0113] In this embodiment, batching reduces the number of times the CPU sends rendering commands to the GPU, because multiple subcomponents can use the same rendering call process to render, and under the same conditions, the performance requirements of the digital platform can be further reduced. In addition, since multiple meshes are merged into one cache set, the number of cache objects that need to be managed independently in the GPU is reduced (that is, the creation of cache objects is reduced), thereby reducing memory usage and management work.
[0114] Furthermore, preferably, when uploading uniform variables, the same uniform value is uploaded again when it is different, so as to reduce the number of interactions between the CPU and GPU and reduce the pressure on the CPU. In addition, since post-production special effects will cause the scene to be rendered twice, the frame rate can be doubled by reducing the use of post-production special effects.
[0115] S74: Based on the same rendering call instruction, each grid part in the buffer area set is drawn respectively using a preset graphics drawing function, thereby rendering different sub-components to form an optimized model.
[0116] In this embodiment, the preset graphics drawing function is drawElements. DrawElements is a function in graphics APIs such as OpenGL, which is used to draw vertex data according to indexes to form graphics. It receives parameters such as offset and count, and is used to draw different subcomponents.
[0117] Among them, offset specifies the index position to start reading from the buffer, and count specifies the number of indexes to be drawn. Therefore, using the offset and count parameters of drawElements, different mesh parts in the merged buffer set can be drawn separately, thereby rendering different sub-components and forming an optimized model.
[0118] S8: Use WebGL to present the optimized model on the preset digital platform.
[0119] It can be understood that after the above steps S1 to S6, the burden on the graphics card and CPU can be greatly reduced, and the frame rate can be increased from 5 frames to 35 frames under the common hardware environment of the preset digital platform (the common hardware environment can be directly obtained according to the needs in this field, and will not be specifically described in this embodiment). Therefore, the optimized model can be presented on the preset digital platform in the WebGL manner.
[0120] In addition, more preferably, by pre-storing the model binary compressed data and texture compressed files in step S4 on the browser side, the secondary acceleration network loading time can be reduced, thereby effectively improving the rendering completion time.
[0121] Second embodiment
[0122] like Figure 5 As shown, a three-dimensional rendering system based on digital twins provided by the second embodiment of the present invention includes a parameter acquisition unit 1, a model building unit 2, a texture rendering unit 3, a data separation unit 4, a data compression unit 5, a parallel loading unit 6, a batch optimization unit 7 and an output unit 8.
[0123] Specifically, the parameter acquisition unit 1 is used to obtain the parameters of the model to be rendered under the power cabinet based on the digital twin technology.
[0124] The model building unit 2 is connected to the parameter acquisition unit 1 to build an initial model based on the model parameters to be rendered, by reducing the number of model faces and vertices and reusing geometric data of the same appearance, on the premise that the model appearance and appearance curvature meet preset requirements.
[0125] The texture rendering unit 3 is connected to the model building unit 2 and is preset with a texture map, so that the initial model is texture rendered through the same texture map, so that the color, brightness, texture structure, convexity and concaveness and appearance composition style of all sub-components of the initial model remain consistent.
[0126] The data separation unit 4 is connected to the texture rendering unit 3 and is used to separate the model binary data and the texture file of the initial model after texture rendering.
[0127] The data compression unit 5 is connected to the data separation unit 4 to use Draco compression to perform data compression on the model binary data to obtain model binary compressed data; and use WebP texture compression to perform file compression on the texture file to obtain a texture compressed file.
[0128] The parallel loading unit 6 is connected to the data compression unit 5 and is used for loading the model binary compressed data and the texture compressed file in parallel.
[0129] The batch optimization unit 7 is connected to the parallel loading unit 6 to encapsulate the cache array of meshes of the same material into a cache set based on the model binary compressed data and texture compressed file, and record fragments of each mesh to draw different sub-components through a preset graphics drawing method, thereby forming an optimized model.
[0130] The output unit 8 is connected to the batch optimization unit 7 and is used to present the optimization model through a preset digital platform.
[0131] It is understandable that based on the preset digital platform and digital twin technology, the three-dimensional rendering system can adapt to the software and hardware configuration of the domestic platform to improve the rendering effect of the digital model and avoid a significant drop in the real-time frame rate.
[0132] Third embodiment
[0133] Based on the above first embodiment, the third embodiment of the present invention further provides a three-dimensional rendering system based on digital twins. Figure 6 As shown, the three-dimensional rendering system includes one or more processors 21 and a memory 22. The memory 22 is coupled to the processor 21 and is used to store one or more programs. When the one or more programs are executed by the one or more processors 21, the one or more processors 21 implement the three-dimensional rendering method based on digital twins as in the above embodiment.
[0134] Among them, the processor 21 is used to control the overall operation of the three-dimensional rendering system to complete all or part of the steps of the three-dimensional rendering method based on digital twins. The processor 21 can be a central processing unit (CPU), a graphics processing unit (GPU), a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a digital signal processing (DSP) chip, etc. The memory 22 is used to store various types of data to support the operation of the three-dimensional rendering system, and these data may include, for example, instructions for any application or method for operating on the three-dimensional rendering system, and application-related data. The memory 22 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, etc.
[0135] In an exemplary embodiment, the three-dimensional rendering system can be implemented by a computer chip or entity, or by a product with a certain function, for executing the above-mentioned three-dimensional rendering method based on digital twins, and achieving the same technical effect as the above-mentioned method. A typical embodiment is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0136] In another exemplary embodiment, the present invention further provides a computer-readable storage medium including program instructions, which, when executed by a processor, implements the steps of the three-dimensional rendering method based on digital twins in any of the above embodiments. For example, the computer-readable storage medium may be the above-mentioned memory including program instructions, and the above-mentioned program instructions may be executed by a processor of a three-dimensional rendering system to complete the above-mentioned three-dimensional rendering method based on digital twins and achieve the same technical effect as the above-mentioned method.
[0137] In summary, a three-dimensional rendering method and system based on digital twins provided by an embodiment of the present invention has the following beneficial effects: First, by reducing the number of facets and vertices of the model and reusing geometric data with the same appearance, the memory usage during WebGL rendering is effectively reduced. Secondly, by adopting a unified model texture, not only the consistency of all models in color, brightness, sub-component texture, concave and convex feeling and appearance composition style is achieved, but also the number of textures is reduced by sharing textures, thereby reducing the number of textures loaded during WebGL rendering, improving the texture loading speed and reducing memory usage. In addition, the model data is loaded using Web Assembly (Wasm) technology, and the binary data of the model is separated from the texture file, which realizes the parallel loading of resources and further improves the loading rate. Finally, multiple rendering call instructions are merged into one through batch technology, so that multiple sub-components can be rendered through a single rendering call instruction, reducing the number of times the CPU sends rendering commands to the GPU and improving rendering efficiency.
[0138] It should be noted that the above embodiments are only examples, and the technical solutions of the various embodiments can be combined, all within the protection scope of the present invention.
[0139] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0140] The above is a detailed description of the three-dimensional rendering method and system based on digital twins provided by the present invention. For those skilled in the art, any obvious changes made to it without departing from the essence of the present invention will constitute an infringement of the patent right of the present invention and will bear corresponding legal responsibilities.
Claims
1. A three-dimensional rendering method based on digital twins, characterized in that The steps include: Based on digital twin technology, obtain the model parameters of the model to be rendered; Based on the model parameters of the model to be rendered, on the premise that the model appearance and appearance curvature meet the preset requirements, the initial model is constructed by reducing the number of model faces and vertices and reusing geometric data of the same appearance; The initial model is texture rendered using the same texture map so that the color, brightness, texture structure, concave-convex feeling and appearance composition style of all sub-components of the initial model are consistent; Separating the model binary data and texture file of the initial model after texture rendering; Compressing the model binary data to obtain model binary compressed data; And, compressing the texture file to obtain a texture compression file; Loading the model binary compressed data and the texture compressed file in parallel; Based on the loaded binary compressed data of the model and the texture compressed file, encapsulate the buffer arrays of the meshes of the same material into a buffer set, and record the fragments of each mesh to draw different sub-components through a preset graphics drawing method, thereby forming an optimized model; On a preset digital platform, the optimized model is presented in a WebGL manner.
2. The three-dimensional rendering method according to claim 1, characterized in that Reduce the number of model faces and vertices, and reuse geometric data with the same appearance, including: Merge discrete vertices to reduce the number of vertices; Adopt four-sided topology layout and reduce high-precision chamfers to reduce the number of model faces; Reduce model subdivision, reuse models with the same appearance, and remove internal occlusion models, so that the number of facets and vertices of the model is reduced to a preset range.
3. The three-dimensional rendering method according to claim 1, characterized in that Also includes: Based on the model parameters of the model to be rendered, obtaining the type and model size of each sub-component; The sub-components are grouped according to their types, models and sizes, so as to group the sub-components of the same type, model and size into one group; wherein each group of sub-components shares a set of appearance geometric data; A corresponding model is generated according to the appearance geometry data of each group of sub-components, so as to complete the model construction of the same group of sub-components by reusing models with the same appearance, thereby reducing model subdivision.
4. The three-dimensional rendering method according to claim 1, wherein: The texture map is formed by drawing, and all sub-components of the initial model share the same texture map.
5. The three-dimensional rendering method according to claim 1, characterized in that The model binary compressed data and texture compressed file are obtained in the following way: Using Draco compression, changing the indexing method of the mesh data of the model through a preset compression algorithm to reduce the original mesh order; and reducing the number of bits of vertex coordinates and vertex texture coordinate information to reduce the amount of data storage, thereby forming the model binary compressed data; WebP texture compression is used to change the file format of the texture file to reduce the memory occupied by the file, thereby forming a texture compression file.
6. The three-dimensional rendering method according to claim 1, characterized in that The optimization model is formed by the following sub-steps: Merge vertex and index data of multiple meshes with the same material into a single buffer set; In the buffer area set, the starting position and length of each original grid data are recorded as a fragment of the original grid data; Multiple rendering call instructions are merged into one by batching, so that multiple sub-components can be rendered by the same rendering call instruction; Based on the same rendering call instruction, each grid part in the buffer area set is drawn respectively using a preset graphics drawing function, so as to render different sub-components and form the optimization model.
7. The three-dimensional rendering method according to claim 1, characterized in that Also includes: When uploading uniform variables, upload the same uniform variable again if the value is different to reduce the number of interactions between the CPU and GPU.
8. The three-dimensional rendering method according to claim 1, characterized in that Before forming the optimization model, the following steps are also included: Performing frustum culling optimization and occlusion culling optimization on the initial model after texture rendering to reduce the number of components that need to be rendered in the initial model; The frustum culling optimization means: retaining components within the frustum and culling components outside the frustum; the occlusion culling optimization means: retaining visible components and culling invisible components.
9. The three-dimensional rendering method according to claim 1, characterized in that Also includes: The model binary compressed data and the texture compressed file are pre-stored on the browser side to reduce the secondary acceleration network loading time.
10. A three-dimensional rendering system based on digital twins, characterized in that include: A parameter acquisition unit, used to acquire model parameters of a model to be rendered based on digital twin technology; A model building unit connected to the parameter acquisition unit, to build an initial model based on the parameters of the model to be rendered, by reducing the number of model faces and vertices and reusing geometric data of the same appearance, on the premise that the model appearance and appearance curvature meet preset requirements; A texture rendering unit, connected to the model building unit and preset with a texture map, for rendering the initial model with the same texture map, so that the color, brightness, texture structure, concave-convex feeling and appearance composition style of all sub-components of the initial model are consistent; A data separation unit, connected to the texture rendering unit, for separating the model binary data and the texture file of the initial model after texture rendering; A data compression unit, connected to the data separation unit, and used to compress the model binary data to obtain model binary compressed data; And, compressing the texture file to obtain a texture compression file; A parallel loading unit, connected to the data compression unit, for loading the model binary compressed data and the texture compressed file in parallel; a batch optimization unit connected to the parallel loading unit to encapsulate the cache arrays of meshes of the same material into a cache set based on the model binary compressed data and the texture compressed file, and record fragments of each mesh to draw different sub-components through a preset graphics drawing method, thereby forming an optimized model; An output unit is connected to the batch optimization unit and is used to present the optimization model through a preset digital platform.
Citation Information
Patent Citations
Method for realizing three-dimensional rendering based on ARM instruction set CPU
CN115358913A
Cited By
3D map performance optimization method based on custom geometric figure one-sided structure
CN120612440A
Image real-time rendering processing method in digital twinborn scene
CN121259152A