CN114155337A - A large-scale digital workshop rendering system and method based on Unity platform - Google Patents

A large-scale digital workshop rendering system and method based on Unity platform Download PDF

Info

Publication number
CN114155337A
CN114155337A CN202111287289.6A CN202111287289A CN114155337A CN 114155337 A CN114155337 A CN 114155337A CN 202111287289 A CN202111287289 A CN 202111287289A CN 114155337 A CN114155337 A CN 114155337A
Authority
CN
China
Prior art keywords
rendering
model
scene
texture
digital workshop
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111287289.6A
Other languages
Chinese (zh)
Inventor
尤长虹
吴晖
魏斌
蔡力
黎伟雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Tobacco Hubei Industrial Co Ltd
Original Assignee
China Tobacco Hubei Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Tobacco Hubei Industrial Co Ltd filed Critical China Tobacco Hubei Industrial Co Ltd
Priority to CN202111287289.6A priority Critical patent/CN114155337A/en
Publication of CN114155337A publication Critical patent/CN114155337A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a large-scale digital workshop rendering system and method based on a Unity platform, and the system comprises an application stage, a geometric stage and a rasterization stage; the application stage receives a user input instruction to output a rendering primitive, the geometry stage receives the rendering primitive and then outputs vertex information of a screen space, and the rasterization stage outputs images in various expression forms to the client; the invention provides a platform-level rendering optimization component, which is used for realizing efficient real-time rendering of tens of thousands of high-precision models in a real-time application environment according to environmental changes, ensuring smooth operation of the whole digital workshop system, achieving the purpose of online visual monitoring of a production process and considering diversity of platform applications.

Description

Large-scale digital workshop rendering system and method based on Unity platform
Technical Field
The invention belongs to the technical field of digital workshop modeling, relates to a large-scale digital workshop rendering system and method, and particularly relates to a large-scale digital workshop rendering system and method based on a Unity platform.
Background
With the advent of the information-oriented era, the demand for digital workshop and digital factory construction based on the digital twin technology is increasing day by day, and with the increasing popularization of Building Information Modeling (BIM) technology and Internet of things technology, more and more large production workshops have the basis of three-dimensional digital modeling. However, the scale of the workshop is larger and larger, the number of models after three-dimensional modeling is increased by geometric multiples, meanwhile, the three-dimensional visual monitoring in the operation and maintenance process of the digital workshop puts a high requirement on the precision of the models, and the existing three-dimensional rendering engine cannot well give consideration to both performance and effect under the condition of limited economic investment.
The Unity (real-time 3D content production and operation platform of Unity corporation) as a commercial software can provide a whole set of solution, but it is more used for the development of the game field, and for example, the system provides rendering components which cannot meet the requirements of real-time rendering of tens of thousands of models, and most of the provided shader components are game-customized and cannot meet the requirements of rendering effects in the industrial field.
Disclosure of Invention
As a rendering engine for supporting the operation of a large-scale digital workshop, the three-dimensional real-time rendering engine is required, namely various solid substances in reality are abstracted in the form of various curves or polygons, and an algorithm realization set for outputting a final image through a computer in real time can be realized according to the change of the environment and an observation point. Under the condition, the invention provides a large-scale digital workshop rendering system and method based on a Unity platform.
The technical scheme adopted by the system of the invention is as follows: a large-scale digital workshop rendering system based on a Unity platform is subjected to modular reconstruction on the basis of a Unity engine architecture and comprises a low-order renderer subsystem, a scene graph/elimination optimization subsystem and a visual effect subsystem;
the low-order renderer subsystem optimizes rendering geometric primitives as many as possible in the same GPU calling process on the basis of a Unity rendering engine to realize real-time rendering of tens of thousands of models in a digital workshop;
the scene graph/rejection optimization subsystem realizes model rejection in a large-scale digital workshop scene through a space analysis method, a logic and potential visible set method and a fine degree method on the basis of the Unity engine shielding rejection function;
the visual effect subsystem adopts a CG shader to support cross-platform capability.
The method adopts the technical scheme that: a large-scale digital workshop rendering method based on a Unity platform comprises an application stage, a geometric stage and a rasterization stage; the application stage receives a user input instruction to output a rendering primitive, the geometry stage receives the rendering primitive and then outputs vertex information of a screen space, and the rasterization stage outputs images in various expression forms to the client;
the rendering process is developed in parallel in a pipeline mode and comprises parallel processing on functions, data and time; the functional parallelism is that different stages of the rendering process are executed simultaneously on the same data stream, and each stage processes different data in sequence; the data parallelism is to distribute the data into a plurality of data streams and process the data by a plurality of rendering units simultaneously; the temporal parallelism is realized by utilizing temporal decomposition, each frame of the animation sequence is a basic unit of task allocation, and each processor independently completes a plurality of frames of images.
The invention provides a platform-level rendering optimization component, which solves the problem that tens of thousands of high-precision models are efficiently rendered in real time in a real-time application environment according to environmental changes, ensures the smooth operation of the whole digital workshop system, further achieves the purpose of online visual monitoring of the production process, and simultaneously considers the diversity of platform applications.
Drawings
FIG. 1 is a system framework diagram of an embodiment of the present invention;
FIG. 2 is a flow chart of a method of an embodiment of the present invention;
FIG. 3 is a flowchart of a dynamic merging batch process based on the number and number of vertices of the model mesh according to an embodiment of the present invention;
FIG. 4 is a flowchart of a same type model texture atlas dynamic and batch processing based on an embodiment of the invention;
FIG. 5 is a flowchart illustrating a scene management optimization procedure according to an embodiment of the present invention;
fig. 6 is a flowchart of optimizing the real-time illumination and shadow effects according to the embodiment of the present invention.
Detailed Description
In order to facilitate the understanding and implementation of the present invention for those of ordinary skill in the art, the present invention is further described in detail with reference to the accompanying drawings and examples, it is to be understood that the embodiments described herein are merely illustrative and explanatory of the present invention and are not restrictive thereof.
This embodiment will use the following terminology:
(1) digital workshop: the comprehensive application of digitalization and networking technology in production workshop integrates the information of numerical control equipment and process design system, production organization system and other management system to form integrated manufacturing system with integrated information flow automation.
(2) Visualization: the technical means for converting data into graphs.
(3) Three-dimensional modeling: the digital representation of the characteristic information of the real three-dimensional object is formed by hand or a certain computer algorithm.
(4) A rendering engine: and performing optimized traversal on the three-dimensional model loaded by the system, and displaying after adding contents such as colors, illumination, shadows, materials and the like, so that the three-dimensional model is closer to the combination of a series of functional modules of the physical visual effect of a real object.
(5) GPU (graphics processor) programming: in order to fully exert the polygon conversion and light source processing capacity of a graphic processor in a display card, the overall performance of a software and hardware system in the graphic processing process is improved by a computer programming technology.
Referring to fig. 1, the large-scale digital workshop rendering system based on the Unity platform provided by the invention performs modular reconstruction on the basis of a Unity engine architecture, and comprises a low-order renderer subsystem, a scene graph/culling optimization subsystem and a visual effect subsystem;
the rendering function of the Unity engine focuses on rendering geometric primitives as fast as possible, and is responsible for connecting and enumerating graphics devices and establishing a rendering surface. The low-order renderer subsystem of the embodiment optimizes rendering geometric primitives as many as possible in the same GPU calling process on the basis of a Unity rendering engine, and realizes real-time rendering of tens of thousands of models in a digital workshop.
The low-order renderer subsystem of the present embodiment comprises 6 optimization components:
(1) a geometric primitive submission component: and the method is responsible for merging the static model primitives and merging the texture atlas in the digital workshop scene.
(2) Texture and surface management component: the method is responsible for mapping used by the digital workshop model, establishing the mapping relation of the material balls, caching data, optimizing and managing dynamic cache and the like.
(3) Material and shader components: and the system is responsible for mapping relation management of the rendering shader.
(4) Static and dynamic illumination assemblies: and the system is responsible for managing the mapping relation between the digital workshop model and a real-time light source, the relation between the light source and a time shaft and the like.
(5) A camera assembly: is responsible for managing the various cameras in the scene.
(6) The character and font management component: the method is responsible for managing fonts and texts used in the system, dynamically combining the texts, generating a texture atlas of the texts, and solving the problem of efficiency of the Unity engine in processing the texts and the fonts. And meanwhile, reserving a skeleton network rendering component for three-dimensional roaming to support visual operation of the digital workshop.
The Unity engine mainly has three forms of occlusion rejection, namely, viewing cone rejection, occlusion rejection and far and near rejection, which are related to a camera in a scene. View frustum culling is the culling of objects that should not be displayed with the frustum matrix of the camera. And the shielding elimination is to eliminate the objects without the bound identifications by setting the shielding identifications. And the distance elimination is to calculate the distance between an object and the camera in real time through an algorithm and eliminate the object with unexpected distance. The three modes have better efficiency under the condition of small quantity of rendering models, and the rendering process of tens of thousands of models is not smooth in real time. On the basis of the Unity engine occlusion rejection function, the scene graph/rejection optimization subsystem of the embodiment realizes 3 methods for model rejection in large-scale digital workshop scenes.
(1) The space analysis method comprises the following steps: the method is suitable for static scenes, static model relative displacement information is established, when the camera is shielded and removed, the sequenced rendering geometric objects are rapidly obtained through the BSP tree according to the position of the camera, and then the model outside the set range is hidden according to the model relative displacement information. The BSP tree has the advantage that it can cut overlapping objects, thereby solving the problem of cyclic overlapping.
(2) Logic and latent methods: in the visible set method, by classifying and labeling models in the digital workshop, the models are removed according to categories, and all process-related models are displayed quickly in the digital workshop.
(3) The method for the degree of fineness comprises the following steps: and the system is responsible for managing the mapping relation between the high-precision model and the low-precision model and establishing model data cache. The LOD (level of detail) is used to determine which model to display in a digital plant scene based on the distance between the camera and the model, and generally displays a high-precision multi-detail model when the distance is close and displays a low-precision low-detail model when the distance is far. Through the detailed system mapping relation and the cache, the LOD can dynamically and quickly complete the conversion work of the high-precision model and the low-precision model.
The shader provided by the Unity engine is mainly suitable for the field of games and has insufficient customized support for the industrial field. The sharerlab shader native to the Unity engine is limited to Unity platform usage and lacks cross-platform capability. The visual effects subsystem of the present embodiment employs a CG shader to support cross-platform capabilities. A plurality of components are provided to improve visual effects, including illumination mapping and real-time shadows, particle special effects, high dynamic illumination, particle and mapping special effects, post-processing effects, environmental mapping, and the like.
Referring to fig. 2, the large-scale digital workshop rendering method based on the Unity platform provided by the invention comprises an application stage, a geometric stage and a rasterization stage; the application stage receives a user input instruction to output a rendering primitive, the geometry stage receives the rendering primitive and then outputs vertex information of a screen space, and the rasterization stage outputs images in various expression forms to the client;
in order to improve the efficiency, the rendering work developed in the whole pipeline mode of the embodiment must be developed in parallel, and the purpose of improving the efficiency is achieved through parallel processing decomposition on functions, data and time.
(1) Parallelization based on functional decomposition: different stages of the rendering process are performed simultaneously on the same data stream, each stage being capable of sequentially processing different data. If each processing unit performs a sub-function and a sequentially connected data path is established between the processing units, a rendering pipeline is in fact formed. The design based on the functional decomposition pipeline should avoid the occurrence of bottlenecks as much as possible, and in order to improve the number of stages of the pipeline and obtain a higher speed-up ratio, the functions which particularly consume resources need to be optimized in a key manner, and a more detailed scheme description is provided below.
(2) Parallelization based on data decomposition: the data is distributed into multiple data streams and processed simultaneously with multiple rendering units. The parallel algorithm based on data decomposition has the greatest advantage that the algorithm has better expandability and can obtain higher acceleration ratio.
(3) Parallelization based on temporal decomposition: although the number of graphics renderings increases during three-dimensional roaming, the animation effect of the roaming may not be the most important in terms of rendering speed per frame, and the rendering time of the entire animation is of concern. This allows parallelism to be achieved using temporal decomposition, with each frame of the animation sequence being the basic unit of task allocation and each processor performing several of the images separately.
The embodiment optimizes the application stage, the geometric stage and the rasterization stage:
(1) optimizing in an application stage: the attribution judgment of the application stage parallel graphic rendering system occurs before the geometric processing, and the image space of the final display screen is divided into a plurality of areas to be distributed to different rendering servers. Before each frame is rendered, a rendering server responsible for processing is confirmed according to the projection of the scene geometric data on the display screen, then the corresponding data is sent to the rendering server for processing, and the results of all the rendering servers are spliced into a final display image after rendering is completed. Each rendering pipeline is complete and independent, and the cluster type parallel graph rendering system is favorably constructed. The attribution determination is the major overhead and bottleneck of the parallel graphics rendering system at this stage.
(2) Geometric phase optimization: the geometry stage parallel graphics rendering system requires that intermediate results after geometric processing and before rasterization of a rendering pipeline are redistributed, and after customized GPU (vertex shader and fragment shader optimization) processing, geometric processing and rasterization functions are integrated together, so that the parallel operation efficiency of the link is improved.
(3) And (3) optimization of a rasterization stage: in the rasterization stage, the image space is not divided, only the scene data is equally divided into a plurality of subsets, the division of the subsets is not limited by the space range, and the number of the triangular patches is ensured to be approximately equal so as to keep the load balance. And (3) processing each data subset by a GPU (graphic processing unit) program, then entering a corresponding rendering pipeline, and performing geometric processing and synthesis to obtain a final display result.
On a processing flow line of a digital workshop, a scene is often encountered, the appearances of processing objects on the whole flow line have high similarity, and batch optimization can be established by utilizing the similarity.
The Unity engine supports both dynamic and static batch processing, but there is no universal approach to model mesh merging and texture atlas merging, which is dynamically implemented by the post-labeling system. When the number of models is small, the support of Unity dynamic partitioning is good. In a digital workshop scene with more models, the dynamic implementation mode is not flexible enough and cannot meet the requirement of optimizing GPU (DrawCall).
Therefore, according to the rendering requirement of the digital workshop scene, two kinds of batch optimization are developed on the Unity engine: carrying out dynamic merging and batch processing based on the number and the number of model mesh vertexes and carrying out dynamic merging and batch processing based on the same type of model texture atlas;
referring to fig. 3, in the rendering process, the embodiment is developed in parallel in a pipeline manner, and dynamic merging batch processing is performed based on the number and number of vertices of the model mesh;
in a digital workshop scenario, many identical models belong to the same family and the same type. The material of these models is the same but the mesh is different. The function of the Unity dynamic pool is applied to the model, and the reduction of GPU calling times (DrawCall) is not obvious. Therefore, the system component is realized, model meshes are automatically combined according to the rules of the same family, the same type and the same material ball under the condition that the maximum number of single model vertexes of the Unity engine is 64K, and the rendering efficiency is obviously improved. The realization process is as follows:
(1) in a digital workshop scene, models belonging to the same family and the same type are searched according to model attributes. Judging whether the material of the model is the same or not, and eliminating the model with different material balls;
(2) calculating the number of grid vertexes of each model;
(3) calculating a merged model batch to meet the models of the same batch, wherein the sum of the grid vertexes is less than 64K;
(4) the meshes of the model are merged according to the batches.
Referring to fig. 4, in the rendering process, the embodiment is developed in parallel in a pipeline manner, and dynamic and batch processing is performed based on the same type of model texture atlas;
the system can dynamically calculate the size of the pixels needing to process the model textures in batch, set the size of the texture atlas according to the system, and dynamically combine different textures into a large texture atlas, so that different materials and the same texture can be used, the GPU calling frequency (DrawCall) is reduced, and the rendering and running efficiency of a digital workshop is improved. The realization process is as follows:
(1) in a digital workshop scene, searching models which belong to the same family and are different in type according to model attributes;
(2) the model texture is divided into three classes of Albedo, Metallic and Normal. Respectively modeling different types of textures, and calculating the size of texture pixels;
(3) calculating texture merging batches according to the pixel size (2048 × 2048) of the texture atlas prefabricated by the system;
(4) and (4) merging the textures according to batches, wherein whether the merged textures have Alpha channels needs to be judged, and if the merged textures have the Alpha channels, the merged textures need to be processed independently. Generating texture image sets and texture UV coordinates after batch processing;
(5) and calculating the position of the model texture in the atlas according to the texture atlas and the texture UV coordinates, and updating the texture of the model.
Referring to fig. 5, in the rendering process, the models that do not need to be rendered are removed in a pipeline manner, and meanwhile, the models that do not need to be rendered are removed in a scene division manner, a view frustum cutting manner and a shielding cutting manner, so that scene management optimization is realized.
Because the digital workshop has relatively fixed large-scale equipment design position, has the operation regulation of relative solidification simultaneously, patrols and examines the circuit etc. consequently can carry out the pre-optimization to scene management, including scene division, the frustum is cut off, is sheltered from and cuts off etc..
The scene division optimization is to classify the processing objects which need to be operated in different regions according to the operation rules, and to divide the processing objects as small objects into the levels where the processing objects are located, and the processing objects can be divided according to the classification in the same level. The redundancy of the node number is avoided, and the rendering efficiency is improved.
The viewing cone cutting is to cut the rendering model to optimize the rendering efficiency by using the perspective effect of human vision, and distinguish the visibility of the rendering object to reduce the rendering content. Meanwhile, the routing inspection route in the digital workshop is relatively fixed, and the simulation visual angle can also be set with some common points for pre-optimization, so that the rendering content can be reduced, the real-time operation during the cutting of the viewing cone can be reduced, the occupation of CPU resources is reduced, and the rendering efficiency is improved. The shielding cutting is similar to the viewing cone cutting, the position and the shape of large equipment in a large-scale digital workshop are mainly established to be fixed, the shielding objects can be pre-judged in advance by combining with a routing inspection line, and the rendering efficiency is improved.
In a digital workshop scene, models are rendered in high precision and real time, namely the vertexes and the faces of the models are large in number, the models comprise a plurality of types of textures, and the models are rendered in real time according to illumination. In order to improve the fluency and the rendering efficiency of the system, models which do not need to be rendered are removed in the modes of scene division, viewing cone cutting, shielding cutting and the like, and the rendering efficiency is improved. The scene management optimization process is as follows:
(1) dividing different sub-regions of the whole digital workshop according to functions, and calculating the global coordinates of the center points of the sub-regions;
(2) the process equipment model of the digital plant includes many internal details, particle effects and animation effects. The model has high precision. Under the overall display scene of the digital workshop, a low-precision model needs to be replaced, and the rendering efficiency is improved. Therefore, two sets of models need to be prepared for different scene rendering requirements;
(3) setting LOD values of scene elimination and cone clipping to complete initialization work of scene management optimization;
(4) judging the current system operation scene, if the display state of the whole digital workshop is the display state, rendering and selecting a low-precision process equipment model, and if the display state of the whole digital workshop is the roaming and equipment operation and maintenance state, rendering a high-precision process equipment model;
(5) and calculating the distance between the camera and the central point of the sub-area in real time. If the distance is greater than the scene culling LOD value, the entire sub-region model is not rendered. If the distance is smaller than the scene elimination LOD value, rendering the model in the sub-region according to the next step rule;
(6) real-time light source rendering efficiency is also one of the main factors influencing the smoothness of system operation. Rendering is realized through a Shader (Shader), and real-time light source rendering is realized by calculating the normal texture of the model and the position, the intensity and the color of a light source in real time to output a rendering effect. And the fixed light source rendering is to calculate and output a rendering effect through the normal map and a light source fixed value. Therefore, the real-time light source rendering efficiency is lower than that of the fixed light source rendering efficiency, but the rendering effect is good. Therefore, the distance between the camera and the model in the sub-area is calculated, the model in a certain range is rendered by adopting a real-time light source, and the model outside the area range is rendered by adopting a fixed light source, so that the fluency and the rendering efficiency of the system are improved.
Referring to fig. 6, in the rendering process, the embodiment is developed in parallel in a pipeline manner, and meanwhile, the optimization of real-time illumination and shadow effects is realized by adopting a forward rendering path.
Real-time illumination and shadow calculation greatly influence rendering efficiency, a plurality of light sources exist in a large-scale digital workshop scene, each light source participates in calculation, and the system realizes optimization of real-time illumination and shadow effects through a Shader (Shader). The Unity rendering path determines how lighting is applied in shaders. Render path in Unity support 3: vertex lighting rendering path, delay rendering path, forward rendering path.
The vertex illumination rendering path typically renders the object in one pass, with the illumination of all light sources being calculated at the vertices of the object. The vertex lighting rendering path is the fastest rendering path and is supported by the most extensive hardware, but since all illumination is computed at the vertex level, this rendering path does not support most of the per-pixel rendering effects: such as shadows, normal maps, lighting masks, high-precision highlights.
The deferred rendering path is one of the current highest-level rendering paths that can achieve ray and shadow fidelity. There is no upper limit on the amount of light that can affect any object, and evaluating light in a per-pixel manner is used entirely, meaning that all will interact with the object correctly in a normal map fashion. All rays can have information cache and all rays can produce shadows. The performance overhead of delayed rendering is large, rendering of semi-transparent material is not possible, an extra forward channel needs to be added to the semi-transparent material, and a large number of Draw calls are generated.
The forward rendering path renders the object with a single or multiple channels depending on the light source affecting the object. The light sources themselves may also be treated differently depending on their settings and intensities. In forward rendering, the brightest few light sources that affect the object use a pixel-by-pixel illumination pattern. A maximum of 4 point sources will be calculated in a vertex-by-vertex rendering. Other light sources will be calculated in a spherical harmonic manner, taking only little CPU computation time and practically no GPU computation time, the spherical harmonic technique is fast to calculate but only approximate.
Based on the advantages of the three rendering paths and the characteristics of a large-scale digital workshop, the system adopts the forward rendering path to realize the optimization of real-time illumination and shadow effects, and the rendering process is optimized as follows:
(1) multiple light sources in a scene are defined. If an object is in the influence area of multiple pixel-by-pixel light sources, the object needs to execute multiple passes (rendering channels), each Pass calculates the illumination results of one pixel-by-pixel light source, and then mixes the illumination results in a frame buffer to obtain the final color value.
(2) A plurality of real-time rendering channels are defined according to light sources in a scene. The forward rendering path defines a Base Pass and an Additional Pass. The Base Pass will be executed only once, and the Additional Pass will be called up multiple times according to the number of other pixel-by-pixel light sources affecting the object, i.e. each pixel-by-pixel light source will execute the Additional Pass once.
(3) A Shadow Pass rendering Pass is defined. In the forward rendering path, Unity computes its shadow-mapped texture for the illuminant if the parallel light turns on a shadow in the scene. The shadow mapping texture is a depth map that records the position of the nearest surface in the scene that can be seen starting from the position of the light source. When calculating the shadow mapping texture, the camera is placed at the position of the light source, and then the depth information is updated according to the normal rendering process, namely the Base Pass and the Additional Pass are called to obtain the shadow mapping texture. However, this method will cause a certain waste of performance, and especially in a digital workshop scenario with tens of thousands of models, the smoothness of operation will be affected. Because only depth information is actually needed, many complex illumination model calculations are often involved in the Base Pass and the Additional Pass. Unity therefore provides an additional Pass to exclusively update the shadow mapping texture of the light source, i.e. the ShadowCaster Pass. The system optimizes and calculates the process of shadow mapping texture (depth texture) through a ShaderCaster Pass rendering channel, places a camera on the position of a light source, calls the Pass, obtains the position of the light source in the space after vertex transformation, and outputs depth information to the shadow mapping texture according to the position.
(4) According to a scene management optimization algorithm, model rendering of a real-time light source is divided into three types. The first model setting Base Shader for real-time rendering of the main light source. The second model of multi-light source real-time rendering sets Base Shader and additional Shader. The third model of shadow effect real-time rendering sets sharedcaster. The second type of rendering efficiency is affected by multiple light source calculations, so pixel-by-pixel calculations need to be done in Base Shader, with the auxiliary light sources being mainly post-processing calculations.
It should be understood that the above description of the preferred embodiments is given for clarity and not for any purpose of limitation, and that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1.一种基于Unity平台大规模数字车间渲染系统,其特征在于:在Unity引擎架构基础上进行了组件化重构,系统包括低阶渲染器子系统、场景图/剔除优化子系统和视觉效果子系统;1. a large-scale digital workshop rendering system based on the Unity platform, is characterized in that: on the basis of the Unity engine architecture, componentized reconstruction has been carried out, and the system includes a low-order renderer subsystem, a scene graph/elimination optimization subsystem and a visual effect subsystem; 所述低阶渲染器子系统,是在Unity渲染引擎的基础上,优化在同一个GPU调用过程中尽可能多的渲染几何图元,实现数字车间中上万个模型实时渲染;The low-level renderer subsystem is based on the Unity rendering engine, and optimizes the rendering of geometric primitives as much as possible in the same GPU calling process, so as to realize real-time rendering of tens of thousands of models in the digital workshop; 所述场景图/剔除优化子系统,Unity引擎遮挡剔除功能基础上,通过空间刨析法、逻辑及潜在可见集法和细致程度法,实现大规模数字车间场景中模型剔除;The scene graph/culling optimization subsystem, based on the occlusion culling function of the Unity engine, realizes model culling in a large-scale digital workshop scene through the spatial analysis method, the logic and potential visible set method and the level of detail method; 所述视觉效果子系统,采用CG着色器支撑跨平台能力。The visual effect subsystem uses CG shaders to support cross-platform capabilities. 2.根据权利要求1所述的基于Unity平台大规模数字车间渲染系统,其特征在于:所述低阶渲染器子系统包括几何图元提交组件、纹理及表面管理组件、材质及着色器组件、静态及动态光照组件、摄像机组件和文字及字体管理组件;所述几何图元提交组件,负责对数字车间场景中静态模型图元合并及纹理图集合并;所述纹理及表面管理组件,负责数字车间用到的贴图,材质球的映射关系的建立,数据缓存,动态缓存优化和管理;所述材质及着色器组件,负责渲染着色器的映射关系管理;所述静态及动态光照组件,负责管理数字车间与实时光源映射关系,光源与时间轴关系;所述摄像机组件,负责对数字车间场景中各个摄像机的管理;所述文字及字体管理组件,负责管理系统中用到的字体及文本,动态合并文本,生成文本的纹理图集,解决Unity引擎处理文本和字体存在效率的问题。2. The large-scale digital workshop rendering system based on the Unity platform according to claim 1, wherein the low-level renderer subsystem comprises a geometric primitive submission component, a texture and surface management component, a material and a shader component, Static and dynamic lighting components, camera components and text and font management components; the geometric primitive submission component is responsible for merging static model primitives and texture map sets in the digital workshop scene; the texture and surface management component is responsible for digital The textures used in the workshop, the establishment of the mapping relationship of the shader, the data cache, the optimization and management of the dynamic cache; the material and shader components are responsible for the management of the mapping relationship of the rendering shader; the static and dynamic lighting components are responsible for the management The mapping relationship between the digital workshop and the real-time light source, the relationship between the light source and the time axis; the camera component is responsible for the management of each camera in the digital workshop scene; the text and font management component is responsible for managing the fonts and texts used in the system, dynamic Merge text, generate a texture atlas of text, and solve the problem of the efficiency of Unity engine processing text and fonts. 3.根据权利要求1所述的基于Unity平台大规模数字车间渲染系统,其特征在于:所述空间刨析法,用于静态场景,建立静态模型相对位移信息,在摄像机进行遮挡剔除的同时,通过BSP树根据相机的位置,快速的获得排序后的渲染几何体,再根据模型相对位移信息,隐藏设定范围之外的模型;3. large-scale digital workshop rendering system based on Unity platform according to claim 1, is characterized in that: described space analysis method is used for static scene, establishes static model relative displacement information, when camera carries out occlusion culling, Through the BSP tree, according to the position of the camera, quickly obtain the sorted rendering geometry, and then hide the model outside the set range according to the relative displacement information of the model; 所述逻辑及潜在可见集法,通过给数字车间中模型分类和标签实现按照类别剔除;The described logic and potentially visible set method realizes culling by category by classifying and labeling models in the digital workshop; 所述细致程度法,负责管理高精度模型和低精度模型的映射关系,建立模型数据缓存。The detailed level method is responsible for managing the mapping relationship between the high-precision model and the low-precision model, and establishing a model data cache. 4.根据权利要求1所述的基于Unity平台大规模数字车间渲染系统,其特征在于:所述视觉效果子系统,包括光照贴图及实时阴影组件、粒子特效组件、高动态光照组件,粒子及贴画特效组件,后处理效果组件和环境贴图组件。4. the large-scale digital workshop rendering system based on Unity platform according to claim 1, is characterized in that: described visual effects subsystem, comprises light map and real-time shadow component, particle special effect component, high dynamic lighting component, particle and sticker Special effects components, post-processing effects components and environment map components. 5.一种基于Unity平台大规模数字车间渲染方法,其特征在于:包括应用阶段、几何阶段和光栅化阶段;应用阶段接受用户输入指令输出渲染图元,几何阶段接受渲染图元后输出屏幕空间的顶点信息,光栅化阶段则向客户端输出多种表现形式的图像;5. A large-scale digital workshop rendering method based on the Unity platform, characterized in that: comprising an application stage, a geometric stage and a rasterization stage; the application stage accepts user input commands to output rendering primitives, and the geometry stage outputs screen space after accepting the rendering primitives vertex information, and the rasterization stage outputs images of various representations to the client; 渲染过程以流水线的方式并行开展,包括功能、数据和时间上的并行处理;所述功能上的并行,是在同一数据流上,同时执行渲染过程的不同阶段,每一个阶段顺序处理不同的数据;所述数据上的并行,是将数据分布到多个数据流中,并用多个渲染单元同时来处理这些数据;所述时间上的并行,是利用时间上的分解来实现并行,动画序列的每一帧是任务分配的基本单元,每一个处理器单独完成其中的几帧图像。The rendering process is carried out in parallel in a pipeline manner, including parallel processing of functions, data, and time; the functional parallelism means that different stages of the rendering process are simultaneously executed on the same data stream, and each stage processes different data sequentially ; The parallelism in the data is to distribute the data into multiple data streams, and use multiple rendering units to process the data at the same time; Each frame is the basic unit of task assignment, and each processor completes several frames of images individually. 6.根据权利要求5所述的基于Unity平台大规模数字车间渲染方法,其特征在于:在渲染过程中,以流水线的方式并行开展,同时基于模型网格顶点数量和个数进行动态合并批处理;6. the large-scale digital workshop rendering method based on the Unity platform according to claim 5, is characterized in that: in the rendering process, carry out in parallel in the mode of pipeline, carry out dynamic merge batch processing based on model mesh vertex quantity and number simultaneously ; 具体实现包括以下步骤:The specific implementation includes the following steps: (1)在数字车间场景中,根据模型属性,查找属于同族,同类型的模型;并且判断模型的材质是否相同,剔除材质球不相同的模型;(1) In the digital workshop scene, according to the model attributes, find the models belonging to the same family and type; and judge whether the materials of the models are the same, and remove the models with different shaders; (2)计算出每个模型的网格顶点个数;(2) Calculate the number of mesh vertices of each model; (3)计算出合并模型批次,满足同一批次的模型,网格顶点数量加和小于预设值;(3) Calculate the merged model batches that satisfy the models of the same batch, and the sum of the number of mesh vertices is less than the preset value; (4)按照批次合并模型的网格。(4) Merge the meshes of the model by batch. 7.根据权利要求5所述的基于Unity平台大规模数字车间渲染方法,其特征在于:在渲染过程中,以流水线的方式并行开展,同时基于同一类型模型纹理图集进行动态和并批处理;7. the large-scale digital workshop rendering method based on Unity platform according to claim 5, is characterized in that: in the rendering process, carry out in parallel in the mode of pipeline, carry out dynamic and batch processing simultaneously based on same type model texture atlas; 具体实现包括以下步骤:The specific implementation includes the following steps: (1)在数字车间场景中,根据模型属性,查找属于同族,不同类型的模型;(1) In the digital workshop scene, according to the model attributes, find models belonging to the same family and different types; (2)模型纹理分为三类Albedo、Metallic、Normal;分别模型不同类别的纹理,并计算出纹理像素大小;(2) Model textures are divided into three types: Albedo, Metallic, and Normal; model textures of different types, and calculate the texel size; (3)根据系统预制纹理图集像素大小,计算纹理合并批次;(3) Calculate the texture merge batch according to the pixel size of the system prefabricated texture atlas; (4)按照批次进行纹理合并,需要判断合并的纹理是否有Alpha通道,如果有Alpha通道的纹理,需要单独处理;批处理后生成纹理图集和纹理UV坐标;(4) For texture merging according to batches, it is necessary to judge whether the merged texture has an alpha channel. If there is a texture with an alpha channel, it needs to be processed separately; after batch processing, a texture atlas and texture UV coordinates are generated; (5)根据纹理图集和纹理UV坐标,计算出模型纹理在图集中的位置,更新模型的纹理。(5) Calculate the position of the model texture in the atlas according to the texture atlas and texture UV coordinates, and update the texture of the model. 8.根据权利要求5所述的基于Unity平台大规模数字车间渲染方法,其特征在于:在渲染过程中,以流水线的方式并行开展,同时通过场景划分,视锥裁减、遮挡裁减方式剔除不需要渲染的模型,从而实现场景管理优化;8. The large-scale digital workshop rendering method based on the Unity platform according to claim 5, is characterized in that: in the rendering process, it is carried out in parallel in a pipeline mode, and simultaneously through the scene division, the viewing cone clipping and occlusion clipping methods are not required to be eliminated. Rendered models to optimize scene management; 具体实现包括以下步骤:The specific implementation includes the following steps: (1)整个数字车间按照功能划分不同子区域,计算子区域中心点全局坐标;(1) The entire digital workshop is divided into different sub-areas according to functions, and the global coordinates of the center point of the sub-areas are calculated; (2)准备两套模型,包括低精度工艺设备模型和高精度工艺设备模型,用于不同场景渲染需要;(2) Prepare two sets of models, including low-precision process equipment models and high-precision process equipment models, for different scene rendering needs; (3)设置场景剔除、视锥剪裁的LOD值,完成场景管理优化的初始化工作;(3) Set the LOD value of scene culling and view cone clipping, and complete the initialization of scene management optimization; (4)判断当前系统运行场景,如果是整个数字车间展示状态,渲染选取低精度工艺设备模型,如果是漫游和设备运维状态,渲染高精度工艺设备模型;(4) Judging the current system operation scene, if it is the display state of the entire digital workshop, select the low-precision process equipment model for rendering, and if it is in the roaming and equipment operation and maintenance state, render the high-precision process equipment model; (5)实时计算相机与子区域中心点的距离;如果距离大于场景剔除LOD值,整个子区域模型不渲染;如果距离小于场景剔除LOD值,子区域内模型按照下一步规则渲染;(5) Calculate the distance between the camera and the center point of the sub-area in real time; if the distance is greater than the scene culling LOD value, the entire sub-area model is not rendered; if the distance is less than the scene culling LOD value, the model in the sub-area is rendered according to the next step; (6)通过计算相机与子区域内的模型距离,在某一范围内的模型采用实时光源渲染,区域范围外的模型采用固定光源渲染的方式,提高系统的流畅性和渲染效率。(6) By calculating the distance between the camera and the model in the sub-region, the model within a certain range is rendered by real-time light source, and the model outside the range is rendered by fixed light source, which improves the fluency and rendering efficiency of the system. 9.根据权利要求5所述的基于Unity平台大规模数字车间渲染方法,其特征在于:在渲染过程中,以流水线的方式并行开展,同时采用正向渲染路径来实现实时光照和阴影效果的优化;9. the large-scale digital workshop rendering method based on Unity platform according to claim 5, is characterized in that: in the rendering process, carry out in parallel in the mode of pipeline, adopt forward rendering path to realize the optimization of real-time illumination and shadow effect simultaneously ; 具体实现包括以下步骤:The specific implementation includes the following steps: (1)定义场景中多光源;(1) Define multiple light sources in the scene; 如果一个物体在多个逐像素光源的影响区域内,那么该物体需要执行多个Pass,每个Pass计算一个逐像素光源的光照结果,然后在帧缓冲区中把这些光照结果混合起来得到最终的颜色值;If an object is in the area of influence of multiple per-pixel light sources, the object needs to perform multiple passes, each pass calculates the lighting result of a per-pixel light source, and then mixes these lighting results in the frame buffer to get the final result color value; (2)根据场景中光源,定义多个实时渲染通道;(2) According to the light source in the scene, define multiple real-time rendering channels; 正向渲染路径定义一个Base Pass和AdditionalPass;Base Pass只会执行一次,而Additional Pass会根据影响该物体的其他逐像素光源的数目被多次调用,即每个逐像素光源会执行一次Additional Pass;The forward rendering path defines a Base Pass and an Additional Pass; the Base Pass will only be executed once, and the Additional Pass will be called multiple times according to the number of other pixel-by-pixel light sources that affect the object, that is, each pixel-by-pixel light source will execute an Additional Pass; (3)定义阴影Shadow Pass渲染通道;(3) Define the shadow Shadow Pass rendering channel; 通过ShaderCaster Pass渲染通道来优化计算阴影映射纹理过程,把摄像机放置光源位置上,调用该Pass,通过对顶点变换后得到光源空间下的位置,并据此来输出深度信息到阴影映射纹理中;The shadow mapping texture process is optimized through the ShaderCaster Pass rendering pass, the camera is placed at the position of the light source, the Pass is called, and the position in the light source space is obtained by transforming the vertices, and the depth information is output to the shadow mapping texture accordingly; (4)根据场景管理优化方法,设置模型的着色器Shader;(4) According to the scene management optimization method, set the shader Shader of the model; 实时光源的模型渲染分三种类型;第一种主光源实时渲染的模型设置Base Shader;第二种多光源实时渲染的模型设置Base Shader和Additonal Shader;第三种阴影效果实时渲染的模型设置ShaderCaster。The model rendering of real-time light sources is divided into three types; the first type of model for real-time rendering of main light sources sets Base Shader; the second type of model for real-time rendering of multi-light sources sets Base Shader and Additonal Shader; the third type of model for real-time rendering of shadow effects sets ShaderCaster . 10.根据权利要求5-9任意一项所述的基于Unity平台大规模数字车间渲染方法,其特征在于:包括应用阶段优化、几何阶段优化和光栅化阶段优化;10. The large-scale digital workshop rendering method based on the Unity platform according to any one of claims 5-9, characterized in that: comprising optimization in application stage, optimization in geometry stage and optimization in rasterization stage; 所述应用阶段优化,首先进行并行图形渲染系统的归属判断,然后客户端显示屏幕的图像空间被划分为多个区域分配给不同的渲染服务器;渲染每一帧前先根据场景几何数据在显示屏幕上的投影,确认负责处理的渲染服务器,然后将相应数据发送到此渲染服务器处理,渲染完成后将所有的渲染服务器的结果拼接成最终显示图像;In the optimization of the application stage, the attribution judgment of the parallel graphics rendering system is firstly performed, and then the image space of the client display screen is divided into multiple areas and assigned to different rendering servers; The projection on the screen, confirm the rendering server responsible for processing, and then send the corresponding data to the rendering server for processing. After the rendering is completed, the results of all the rendering servers are spliced into the final display image; 所述几何阶段优化,经过顶点着色器和片元着色器优化处理后,将几何处理和光栅化功能集成在一起;The geometry stage optimization integrates geometry processing and rasterization functions after the vertex shader and fragment shader optimization processing; 所述光栅化阶段优化,将场景数据等分为若干数据子集,子集的划分不受空间范围的限制,保证三角面片数量大致相等以保持负载平衡即可;每个数据子集经过GPU程序处理后进入对应的渲染流水线,进行几何处理合成后得到最终的显示结果。In the optimization of the rasterization stage, the scene data is equally divided into several data subsets. The division of the subsets is not limited by the spatial range, and it is sufficient to ensure that the number of triangular patches is approximately equal to maintain load balance; each data subset passes through the GPU. After the program is processed, it enters the corresponding rendering pipeline, and the final display result is obtained after geometric processing and synthesis.
CN202111287289.6A 2021-11-02 2021-11-02 A large-scale digital workshop rendering system and method based on Unity platform Pending CN114155337A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111287289.6A CN114155337A (en) 2021-11-02 2021-11-02 A large-scale digital workshop rendering system and method based on Unity platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111287289.6A CN114155337A (en) 2021-11-02 2021-11-02 A large-scale digital workshop rendering system and method based on Unity platform

Publications (1)

Publication Number Publication Date
CN114155337A true CN114155337A (en) 2022-03-08

Family

ID=80459201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111287289.6A Pending CN114155337A (en) 2021-11-02 2021-11-02 A large-scale digital workshop rendering system and method based on Unity platform

Country Status (1)

Country Link
CN (1) CN114155337A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114581283A (en) * 2022-04-29 2022-06-03 厦门真景科技有限公司 Rendering pipeline establishing method, device and medium for reducing real-time preview power consumption
CN116385614A (en) * 2023-03-29 2023-07-04 深圳海拓时代科技有限公司 3D vision module rendering control system based on visualization
CN116630486A (en) * 2023-07-19 2023-08-22 山东锋士信息技术有限公司 Semi-automatic animation production method based on Unity3D rendering
CN117315121A (en) * 2023-10-12 2023-12-29 重庆爱车天下科技有限公司 3D rendering engine system based on vehicle-mounted chip
CN118052921A (en) * 2024-02-06 2024-05-17 西南石油大学 Image rendering method, device, storage medium and product

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114581283A (en) * 2022-04-29 2022-06-03 厦门真景科技有限公司 Rendering pipeline establishing method, device and medium for reducing real-time preview power consumption
CN116385614A (en) * 2023-03-29 2023-07-04 深圳海拓时代科技有限公司 3D vision module rendering control system based on visualization
CN116385614B (en) * 2023-03-29 2024-03-01 深圳海拓时代科技有限公司 3D vision module rendering control system based on visualization
CN116630486A (en) * 2023-07-19 2023-08-22 山东锋士信息技术有限公司 Semi-automatic animation production method based on Unity3D rendering
CN116630486B (en) * 2023-07-19 2023-11-07 山东锋士信息技术有限公司 Semi-automatic animation production method based on Unity3D rendering
CN117315121A (en) * 2023-10-12 2023-12-29 重庆爱车天下科技有限公司 3D rendering engine system based on vehicle-mounted chip
CN118052921A (en) * 2024-02-06 2024-05-17 西南石油大学 Image rendering method, device, storage medium and product

Similar Documents

Publication Publication Date Title
CN114155337A (en) A large-scale digital workshop rendering system and method based on Unity platform
CN111340928B (en) Ray tracing-combined real-time hybrid rendering method and device for Web end and computer equipment
US8111260B2 (en) Fast reconfiguration of graphics pipeline state
EP1594091B1 (en) System and method for providing an enhanced graphics pipeline
US8004518B2 (en) Combined spatial index for static and dynamic objects within a three-dimensional scene
Montrym et al. The geforce 6800
US7940266B2 (en) Dynamic reallocation of processing cores for balanced ray tracing graphics workload
CN100507852C (en) Optimized chaining of vertex and fragment programs
US20080259075A1 (en) Dynamically Configuring and Selecting Multiple Ray Tracing Intersection Methods
US11615575B2 (en) Methods and systems for constructing a shader
US7463259B1 (en) Subshader mechanism for programming language
US20140002458A1 (en) Efficient rendering of volumetric elements
GB2525223A (en) Graphics processing systems
US7400325B1 (en) Culling before setup in viewport and culling unit
US7292239B1 (en) Cull before attribute read
CN117036562A (en) Three-dimensional display method and related device
WO2016106000A1 (en) Indefinite texture filter size for graphics processing
CN117101127A (en) Image rendering method and device in virtual scene, electronic equipment and storage medium
CN106709041A (en) Rendering system and method for webpage graphic images
EP3218868A1 (en) Dynamic pipeline for graphics processing
CN115937389A (en) Shadow rendering method, device, storage medium and electronic equipment
EP3211598B1 (en) System and method for accelerated rendering of two-dimensional graphics
CN109816761B (en) Graph conversion method, graph conversion device, storage medium and electronic equipment
CN113256771A (en) Graphics system and graphics processing method therefor
Apers et al. Interactive Light Map and Irradiance Volume Preview in Frostbite

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination