Transparent rendering method and device based on weighted blending order-independent transparent rendering
Through the weighted blending order-independent transparent rendering method, using the weighted accumulation and depth feedback fusion mechanism, the problems of low efficiency, artifacts and color drift in the existing transparent rendering technology are solved, and efficient and accurate transparent object rendering effects are achieved.
Patent Information
- Application Number
- CN202510726384.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-06-03
AI Technical Summary
Existing transparent rendering technology has problems such as high sorting overhead, severe frame rate drop, high video memory usage, color drift and rendering defects, especially poor performance in complex scenes.
A transparent rendering method based on weighted blending order-independent is adopted. The total opacity and background data of transparent objects are calculated through weighted accumulation and depth feedback fusion mechanism. The auxiliary buffer and the main frame buffer are used for combined rendering, and the weight factor is dynamically adjusted to improve rendering accuracy.
While maintaining rendering accuracy, it significantly improves rendering efficiency and user experience, reduces artifacts and color drift, and improves rendering effects in complex scenes.
Smart Images

Figure CN120259523B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of data processing, and more particularly to a transparent rendering method, apparatus, device, and computer-readable storage medium based on weighted blending order-independent transparent rendering. Background Art
[0002] The current mainstream transparent rendering technologies are mainly divided into order-dependent transparent rendering and order-independent transparent rendering. Traditional methods have the following problems:
[0003] Alpha blending: requires strict back-to-front sorting, resulting in O(nlogn) sorting overhead in dynamic scenes, and rendering artifacts due to cross-occlusion and other issues;
[0004] Depth Peeling[1]: Multi-layer peeling results in O(kn) complexity (k is the number of peeling layers). Multiple peelings require the scene to be rendered repeatedly, resulting in a serious drop in frame rate, which is 20%-30% of the original frame rate. In addition, the effect is poor for scenes with many transparent objects.
[0005] Linked list-based OIT[3]: Video memory consumption is proportional to the number of fragments, there are synchronization issues in the GPU, video memory occupancy is high, and video memory occupancy exceeds 500MB for multi-layer transparent information recording at 1080p resolution. Summary of the Invention
[0006] According to an embodiment of the present application, a transparent rendering scheme based on weighted blending order-independent transparent rendering is provided, which utilizes a strategy combining weighted blending with depth information preprocessing to improve the depth relationship enhancement of transparent objects while maintaining rendering accuracy, avoiding the common artifacts and color drift phenomena in traditional sorting algorithms, and greatly improving the user experience.
[0007] In a first aspect of the present application, a transparent rendering method based on weighted blending order-independent transparent rendering is provided. The method comprises:
[0008] Obtain the 3D scene data to be rendered;
[0009] By weighted accumulation, the total opacity of transparent objects in the three-dimensional scene data is calculated in the constructed auxiliary buffer; and the background data of opaque objects in the three-dimensional scene data is calculated in the constructed main frame buffer;
[0010] The total opacity and background data are combined to form an output image to complete the rendering.
[0011] Furthermore, calculating the total opacity of transparent objects in the three-dimensional scene data in the constructed auxiliary buffer by weighted accumulation includes:
[0012] Weighting the information of each transparent fragment in the three-dimensional scene data and accumulating the information into the constructed auxiliary buffer to obtain the total opacity;
[0013] The local weighting coefficient of each transparent fragment is determined based on its depth value and material properties.
[0014] Furthermore, the weighted information of each transparent fragment in the three-dimensional scene data is accumulated into the constructed auxiliary buffer to obtain the total opacity, which includes:
[0015] By means of pixel-by-pixel parallel calculation, the information of each transparent fragment in the three-dimensional scene data is weighted and accumulated into the constructed auxiliary buffer to obtain the total opacity.
[0016] Furthermore, it also includes:
[0017] The weight factor of the transparent fragment is dynamically adjusted according to the object material properties, light intensity and / or viewing angle in the 3D scene data.
[0018] Furthermore, it also includes:
[0019] Through the depth feedback fusion mechanism, the deviation between the current pixel depth and the global scene depth is compared, and the weighting parameters are corrected in real time.
[0020] Furthermore, combining the total opacity and background data to form an output image includes:
[0021] ;
[0022] in, The color of the transparent fragment;
[0023] is the weight of the transparent fragment;
[0024] Transparency of transparent fragments;
[0025] is the background color.
[0026] Furthermore, it also includes:
[0027] Optimize the output image by performing aliasing and / or color correction.
[0028] In a second aspect of the present application, a transparent rendering device based on weighted blending order-independent transparent rendering is provided. The device comprises:
[0029] An acquisition module, used to obtain the three-dimensional scene data to be rendered;
[0030] a processing module configured to calculate the total opacity of transparent objects in the three-dimensional scene data by weighted accumulation in the constructed auxiliary buffer; and to calculate background data of opaque objects in the three-dimensional scene data in the constructed primary frame buffer;
[0031] The output module is used to combine the total opacity and background data to form an output image to complete rendering.
[0032] In a third aspect of the present application, an electronic device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor implements the above method when executing the program.
[0033] In a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method according to the first aspect of the present application is implemented.
[0034] The transparent rendering method based on weighted blending order-independent transparent rendering provided in the embodiment of the present application obtains the three-dimensional scene data to be rendered; calculates the total opacity of transparent objects in the three-dimensional scene data in a constructed auxiliary buffer by weighted accumulation; calculates the background data of opaque objects in the three-dimensional scene data in a constructed main frame buffer; combines the total opacity and background data to form an output image to complete the rendering, which can significantly improve the rendering efficiency and visual effects in complex scenes.
[0035] It should be understood that the contents described in the Summary of the Invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0037] Figure 1 Flowchart of a transparent rendering method based on weighted blending order-independent transparent rendering according to an embodiment of the present application;
[0038] Figure 2 1 is a flowchart of a depth feedback fusion mechanism of a transparent rendering method based on weighted blending order-independent transparent rendering according to an embodiment of the present application;
[0039] Figure 3is a block diagram of a transparent rendering device based on weighted blending order-independent transparent rendering according to an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the structure of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION
[0041] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present disclosure.
[0042] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.
[0043] Figure 1 A flow chart of a transparent rendering method based on weighted blending order-independent transparent rendering according to an embodiment of the present disclosure is shown. The method includes:
[0044] S110: Acquire three-dimensional scene data to be rendered.
[0045] In some embodiments, the execution entity of the present disclosure (such as a server, etc.) can obtain three-dimensional scene data sent by an electronic device to which it communicates, or three-dimensional scene data pre-stored locally; the three-dimensional scene data is usually scene data in a complex scene.
[0046] S120 , calculating the total opacity of transparent objects in the three-dimensional scene data in the constructed auxiliary buffer by weighted accumulation; and calculating the background data of opaque objects in the three-dimensional scene data in the constructed primary frame buffer.
[0047] In some embodiments, two buffers may be constructed as follows:
[0048] Main frame buffer: used to render opaque objects. The background part of the final image can be output in a general way. The opaque rendering writes the results to this part for use in subsequent steps.
[0049] Auxiliary buffer: used to process transparent objects. It adopts a double buffer architecture, that is, a separate mixing strategy, including:
[0050] Accumulated color buffer: AccumColor: RGBA32F format, used to store weighted color accumulation values;
[0051] Weight accumulation buffer: AccumWeight: R32F format, used to store weight accumulation values;
[0052] Accumulated color buffer: used to store the weighted color accumulation value of transparent fragments;
[0053] Weight accumulation buffer: used to record the "contribution weight" accumulated by all transparent fragments, whose value is related to the alpha value and depth of the fragment.
[0054] It should be noted that before starting rendering, the auxiliary buffer mentioned above needs to be cleared to ensure that the accumulation starts from the initial state.
[0055] In some embodiments, for opaque objects in 3D scene data, all opaque objects can be first drawn to the primary frame buffer using the standard rendering pipeline. The opaque portion serves as the base background (opaque background) of the final image and is composited with transparent objects in subsequent steps. Depth information can be used to determine whether each transparent object is subsequently occluded.
[0056] For transparent objects in three-dimensional scene data. In the present disclosure, traditional source / destination alpha blending is not used. Instead, the information of each transparent fragment is weighted and accumulated in an auxiliary buffer to avoid sequential dependencies. The weight factor is calculated for each transparent fragment, and the weight factor is accumulated with the transparent color. The weight coefficient can be dynamically adjusted according to the material properties of the object, the light intensity, and the viewing angle. And through the depth feedback fusion mechanism, the deviation between the current pixel depth and the global scene depth is compared, and the weighting parameters are corrected in real time to ensure that the image is natural and realistic. In order to ensure the correctness of disordered transparent rendering, pixel-by-pixel parallel calculation based on the fragment shader can be used to accumulate the color information of each transparent level to generate the accumulated color, that is, the final calculated transparent color.
[0057] Specifically, the weights of transparent fragments can be dynamically adjusted using the following standard depth-weighted blending model:
[0058] ;
[0059] Among them, k is the control of the near-view attenuation rate;
[0060] β is used to adjust the smoothness of the distant view;
[0061] Furthermore, the weights of illumination and position information are also added to dynamically update the weight function. Specifically, the normalized direction vector calculated by the light source and object position is , the normalized direction vector calculated from the object position and camera position , dot product calculation ,pass As the weight of the illumination part is multiplied On the other hand, the weight of the part with strong light is higher;
[0062] For each transparent object fragment, the local weighting coefficient α can be calculated based on its depth value and material properties. Specifically, the material properties of transparent objects usually have a refractive index , combined with Calculating the reflection coefficient , then add the depth value to modify the weight to get the calculated ,in, is the local weighted coefficient originally set, and the calculated This can give objects with strong reflectivity a higher weight.
[0063] Furthermore, to improve the mixing accuracy, adaptive normalization technology can be used for the accumulated results of different depth layers to ensure uniform and realistic color distribution.
[0064] In some embodiments, after weighted blending is completed, due to the certain differences in depth between different fragments, color blending may be biased. Therefore, a depth feedback fusion mechanism is designed in this disclosure to solve this problem, including:
[0065] like Figure 2 As shown in the pseudo code in , the depth information obtained in the opaque rendering stage can be used to verify the current pixel depth. If the depth deviation is detected to exceed a preset threshold, the corresponding weighting parameter is automatically adjusted and the color value of the pixel is recalculated; the threshold can be pre-set according to the application scenario.
[0066] Furthermore, an iterative correction method can be used to achieve global consistency in the color distribution of the entire scene within a limited number of iterations.
[0067] S130: Combine the total opacity and background data to form an output image to complete rendering.
[0068] In some embodiments, the final calculated transparent color and the previously drawn opaque background may be weighted to form the final output image using the following formula:
[0069] ;
[0070] in, The color of the transparent fragment;
[0071] is the weight of the transparent fragment;
[0072] Transparency of transparent fragments;
[0073] is the background color;
[0074] The total opacity of all transparent layers after superposition. →0), the term approaches 0 (completely transparent); when all ( →1), the term approaches 1 (completely opaque);
[0075] It is the product of the transmittance of all transparent layers, indicating the remaining contribution of background light after it passes through all transparent layers;
[0076] Contribution to the background.
[0077] Furthermore, it also includes:
[0078] After rendering is complete, effects can be added through post-processing. For example, the output image can be processed with anti-aliasing and color correction, and the rendered result can be output to a display device. Parameters can be adjusted to suit different application scenarios (such as scientific visualization) to enhance the user experience, demonstrating the scalability of this application.
[0079] According to the embodiments of the present disclosure, the following technical effects are achieved:
[0080] The transparent rendering weight calculation method disclosed in this disclosure can dynamically set the weighting factor based on the object's material properties, lighting conditions, and viewing angle information, thereby improving the accuracy of rendering the color of each transparent object;
[0081] The deep feedback fusion mechanism uses an iterative correction method to make the global color distribution more uniform within a limited number of iterations, making the occlusion relationship between different transparent objects clearer. Even in the case of a large number of transparent objects, the front-to-back relationship can still be reflected, achieving efficient transparent rendering and significantly improving the user experience. See Table 1:
[0082] Table 1
[0083] ;
[0084] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.
[0085] The above is an introduction to the method embodiment. The following is a device embodiment to further illustrate the solution described in this application.
[0086] Figure 3 A block diagram 300 of a transparent rendering apparatus based on weighted blending order-independent transparent rendering according to an embodiment of the present application is shown. Figure 3 Shown include:
[0087] An acquisition module 310 is used to acquire 3D scene data to be rendered;
[0088] The processing module 320 is configured to calculate the total opacity of transparent objects in the three-dimensional scene data by weighted accumulation in the constructed auxiliary buffer; and calculate the background data of opaque objects in the three-dimensional scene data in the constructed primary frame buffer;
[0089] The output module 330 is used to combine the total opacity and background data to form an output image to complete rendering.
[0090] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0091] Figure 4 A schematic diagram of the structure of a terminal device or server suitable for implementing an embodiment of the present application is shown.
[0092] like Figure 4 As shown, the terminal device or server includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 into the random access memory (RAM) 403. Various programs and data required for the operation of the terminal device or server are also stored in the RAM 403. The CPU 401, ROM 402 and RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0093] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 408 including a hard disk; and a communication section 409 including a network interface card such as a LAN card or a modem. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. Removable media 411, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 410 as needed, so that computer programs read therefrom can be installed into the storage section 408 as needed.
[0094] In particular, according to an embodiment of the present application, the above method flow steps can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication part 409, and / or installed from the removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, the above-mentioned functions defined in the system of the present application are executed.
[0095] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0096] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the aforementioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0097] The units or modules involved in the embodiments described in this application may be implemented in software or hardware. The units or modules described may also be provided in a processor. The names of these units or modules do not, in certain circumstances, constitute limitations on the units or modules themselves.
[0098] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device. The computer-readable storage medium stores one or more programs, which, when used by one or more processors, execute the method described in the present application.
[0099] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of application involved in this application is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the aforementioned application concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions applied for in this application.
Claims
1. A transparent rendering method based on weighted blending order-independent transparent rendering, characterized in that: include: Obtain the 3D scene data to be rendered; By weighted accumulation, the total opacity of transparent objects in the three-dimensional scene data is calculated in the constructed auxiliary buffer; and the background data of opaque objects in the three-dimensional scene data is calculated in the constructed main frame buffer; Combining the total opacity and background data to form an output image to complete rendering; Calculating the total opacity of transparent objects in the three-dimensional scene data in the constructed auxiliary buffer by weighted accumulation includes: Weighting the information of each transparent fragment in the three-dimensional scene data and accumulating the information into the constructed auxiliary buffer to obtain the total opacity; Wherein, based on the depth value and material properties of each transparent fragment, its local weighting coefficient is determined; include: Determine the refractive index based on the material properties of the transparent object , combined with Calculating the reflection coefficient ; Then add the depth value to modify the weight to get the calculated ,in, is the local weighting coefficient originally set so that the calculated It can make objects with strong reflections have higher weights; The weighted information of each transparent fragment in the three-dimensional scene data is accumulated into the constructed auxiliary buffer to obtain the total opacity, which includes: By means of pixel-by-pixel parallel calculation, the information of each transparent fragment in the three-dimensional scene data is weighted and accumulated into the constructed auxiliary buffer to obtain the total opacity; Also includes: Dynamically adjust the weight factor of transparent fragments based on object material properties, light intensity and / or viewing angle in the 3D scene data; Also includes: Through the depth feedback fusion mechanism, the deviation between the current pixel depth and the global scene depth is compared and the weighting parameters are corrected in real time; Dynamically adjust the weights of transparent fragments using the following standard depth-weighted blending model: ; Among them, k is the control of the near-view attenuation rate; β is used to adjust the smoothness of the distant view; Also includes: Dynamically update the weight function based on the weight of illumination and position information; Normalized direction vector calculated by the position of the light source and the object , the normalized direction vector calculated from the object position and camera position , dot product calculation ,pass As the weight of the illumination part is multiplied on, so that the parts with strong light have higher weight; Also includes: Optimize the output image by performing aliasing and / or color correction.
2. The method according to claim 1, characterized in that Combining the total opacity and background data to form an output image includes: ; in, The color of the transparent fragment; is the weight of the transparent fragment; Transparency of transparent fragments; is the background color.
3. A transparent rendering device based on weighted blending order-independent transparent rendering, characterized in that: include: An acquisition module, used to obtain the three-dimensional scene data to be rendered; A processing module, configured to calculate the total opacity of transparent objects in the three-dimensional scene data by weighted accumulation in the constructed auxiliary buffer; Calculating background data of opaque objects in the three-dimensional scene data in the constructed primary frame buffer; An output module, configured to combine the total opacity and background data to form an output image to complete rendering; Calculating the total opacity of transparent objects in the three-dimensional scene data in the constructed auxiliary buffer by weighted accumulation includes: Weighting the information of each transparent fragment in the three-dimensional scene data and accumulating the information into the constructed auxiliary buffer to obtain the total opacity; Wherein, based on the depth value and material properties of each transparent fragment, its local weighting coefficient is determined; include: Determine the refractive index based on the material properties of the transparent object , combined with Calculating the reflection coefficient ; Then add the depth value to modify the weight to get the calculated ,in, is the local weighting coefficient originally set so that the calculated It can make objects with strong reflections have higher weights; The weighted information of each transparent fragment in the three-dimensional scene data is accumulated into the constructed auxiliary buffer to obtain the total opacity, which includes: By means of pixel-by-pixel parallel calculation, the information of each transparent fragment in the three-dimensional scene data is weighted and accumulated into the constructed auxiliary buffer to obtain the total opacity; Also includes: Dynamically adjust the weight factor of transparent fragments based on object material properties, light intensity and / or viewing angle in the 3D scene data; Also includes: Through the depth feedback fusion mechanism, the deviation between the current pixel depth and the global scene depth is compared and the weighting parameters are corrected in real time; Dynamically adjust the weights of transparent fragments using the following standard depth-weighted blending model: ; Among them, k is the control of the near-view attenuation rate; β is used to adjust the smoothness of the distant view; Also includes: Dynamically update the weight function based on the weight of illumination and position information; Normalized direction vector calculated by the position of the light source and the object , the normalized direction vector calculated from the object position and camera position , dot product calculation ,pass As the weight of the illumination part is multiplied on, so that the parts with strong light have higher weight; Also includes: Optimize the output image by performing aliasing and / or color correction.
4. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
OpenGL-based order-independent transparency image rendering method
CN117315123A