Three-dimensional to two-dimensional rendering method and system, electronic equipment and storage medium
By combining asynchronous parallel preprocessing and synchronous rendering channels, and using weighted hybrid processing, the performance bottleneck and resource waste issues of 3D to 2D rendering are resolved, achieving efficient and stable rendering effects and real-time feedback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BYD CO LTD
- Filing Date
- 2026-01-12
- Publication Date
- 2026-05-15
AI Technical Summary
Existing 3D to 2D rendering methods suffer from performance bottlenecks, require significant time and resources, and cannot achieve real-time feedback and flexible artistic control.
Standardized data is generated by multiple asynchronous parallel preprocessing steps, and then processed synchronously and in parallel through multiple rendering channels. Combined with weighted blending and compositing, a two-dimensional image is generated, making full use of the GPU's parallel computing capabilities.
It improves rendering efficiency, reduces resource waste, ensures the stability of rendering effects and real-time feedback, and achieves a WYSIWYG (What You See Is What You Get) effect.
Smart Images

Figure CN122049154A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a three-dimensional to two-dimensional rendering method, system, electronic device, and storage medium. Background Technology
[0002] 3D to 2D rendering is the process of converting 3D scene data generated by a computer into an image on a 2D display plane. It is widely used in related fields of vehicles, such as scene recognition in intelligent driving. Existing technologies for 3D to 2D rendering mostly require the collection of a large amount of data and a significant amount of time to complete the rendering of shadow outlines. In other words, existing 3D to 2D rendering methods not only have performance bottlenecks but also require substantial time and resource costs. Summary of the Invention
[0003] The present invention aims to at least solve one of the technical problems existing in the prior art. Therefore, the object of the present invention is to provide a 3D-to-2D rendering method, system, electronic device, and storage medium.
[0004] The present invention proposes a 3D to 2D rendering method, comprising the following steps: receiving original 3D scene data; performing multiple asynchronous parallel preprocessing operations on the original 3D scene data to generate standardized data; performing synchronous parallel data transformation processing on the standardized data through multiple rendering channels to generate multiple intermediate result images; and performing weighted mixing and compositing processing on the multiple intermediate result images to generate corresponding 2D images.
[0005] According to the 3D-to-2D rendering method of this invention, the method first receives the original 3D scene data, performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data, and transforms the messy original 3D data into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images, making full use of the GPU's large-scale parallel computing capabilities, which helps to improve processing efficiency and enhance the stability of color and lighting effects. Finally, the multiple intermediate result images are weighted and blended to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect, but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0006] In addition, the three-dimensional to two-dimensional rendering method according to embodiments of the present invention may also have the following additional technical features: Furthermore, the process of performing multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data includes: asynchronous parallel geometric processing, lighting information encoding processing, and resource management and allocation processing on the original 3D scene data to generate normal buffer data, depth buffer data, and lighting summary data. Specifically, the geometric processing includes: performing vertex coordinate transformation, surface normal calculation, and depth value linearization on the original 3D scene data to generate and store normal buffer data and depth buffer data. The lighting information encoding processing includes: performing lighting model calculations based on the normal buffer data and light source information, quantizing the calculation results into discrete levels, mapping the discrete levels to preset artistic colors or identifiers, and generating lightweight lighting summary data. The resource management and allocation processing includes: assigning unique identifiers to objects or materials in the original 3D scene and storing them in a material ID buffer, compressing texture resources, and pre-allocating video memory according to scene complexity. This helps to transform the messy original 3D data into standardized, quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels.
[0007] Furthermore, based on the normal buffer data and light source information, the lighting model calculation is performed, the calculation results are quantized into discrete levels, and the discrete levels are mapped to preset artistic colors or symbols to generate lightweight lighting summary data. This includes: inputting the original lighting-related data of the original 3D scene; calculating the diffuse reflection intensity value based on the surface normal and the light source direction; quantizing the continuous diffuse reflection intensity value into multiple discrete intensity levels based on a preset threshold function; mapping the quantized intensity levels to preset color values; and packaging and compressing the mapped color values and extracted simplified specular information to output the lighting summary data. This simplifies complex lighting calculations and prepares the data for cartoon rendering.
[0008] Furthermore, the multiple rendering channels include at least a contour rendering channel, a color rendering channel, a shadow rendering channel, and a special effects rendering channel, and the multiple rendering channels process data independently and in parallel; this can fully utilize the massive parallel computing power of the GPU, which helps to improve processing efficiency and enhance the stability of color and lighting effects.
[0009] Furthermore, the step of weighted mixing and compositing of multiple intermediate result images to generate a corresponding two-dimensional image includes: performing weighted operations on multiple intermediate result images one by one based on multiple preset channel weight parameters, mixing the multiple weighted results and then compositing them to obtain the two-dimensional image; this can ensure the effectiveness of the weighted mixing process, thereby helping to ensure the rendering effect.
[0010] Furthermore, the multiple channel weight parameters include at least contour weight, color weight, shadow weight, and effect weight, and the multiple channel weight parameters can be adjusted in real time according to the compositing result; thereby, the contour weight, color weight, shadow weight, and effect weight that can be adjusted in real time according to the compositing result help to ensure the effectiveness of the weighted blending process.
[0011] Furthermore, the step of performing weighted calculations on multiple intermediate result images based on multiple preset channel weight parameters, and then compositing the resulting weighted images to obtain the two-dimensional image, includes: weighting and summing the intermediate result images corresponding to each channel according to the contour weight, color weight, shadow weight, and effect weight to generate a preliminary blended image; performing layer blending mode processing and transparency processing on the preliminary blended image to generate a composite image; and performing post-processing on the composite image to generate the two-dimensional image, wherein the post-processing includes at least global anti-aliasing, color mapping, sharpening, and / or blurring. This allows for the generation of a two-dimensional image based on weighted compositing, effectively avoiding the problem of needing to re-execute the entire rendering pipeline for parameter adjustments, thus ensuring that the rendering effect achieves a WYSIWYG (What You See Is What You Get) effect.
[0012] To address the aforementioned problems, this invention also proposes a 3D-to-2D rendering system, comprising: a preprocessing module for receiving original 3D scene data and performing multiple asynchronous parallel preprocessing operations on the original 3D scene data to generate standardized data; a rendering module for performing synchronous parallel data conversion processing on the standardized data through multiple rendering channels to generate multiple intermediate result images; and a mixing module for performing weighted mixing and compositing processing on the multiple intermediate result images to generate corresponding 2D images.
[0013] The 3D-to-2D rendering system according to embodiments of the present invention is used to implement the 3D-to-2D rendering method of the above embodiments of the present invention. First, it receives original 3D scene data and performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images. This fully utilizes the massive parallel computing power of the GPU, helping to improve processing efficiency and enhance the stability of color and lighting effects. Finally, the multiple intermediate result images undergo weighted mixing and compositing processing to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0014] To address the aforementioned problems, the present invention also proposes an electronic device, comprising: a 3D to 2D rendering system as described in the above embodiments of the present invention, or a processor, a memory, and a 3D to 2D rendering program stored in the memory and executable on the processor, wherein the 3D to 2D rendering program, when executed by the processor, implements the 3D to 2D rendering method as described in the above embodiments of the present invention.
[0015] An electronic device according to an embodiment of the present invention is used to implement the 3D to 2D rendering method of the above embodiments of the present invention. First, it receives original 3D scene data and performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images. This fully utilizes the massive parallel computing power of the GPU, which helps improve processing efficiency and enhances the stability of color and lighting effects. Finally, the multiple intermediate result images are weighted and blended to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D to 2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0016] To address the aforementioned problems, the present invention also proposes a computer-readable storage medium storing a 3D-to-2D rendering program, wherein the 3D-to-2D rendering program, when executed by a processor, implements the 3D-to-2D rendering method as described in the above embodiments of the present invention.
[0017] According to an embodiment of the present invention, a computer-readable storage medium storing a 3D-to-2D rendering program thereon, when executed by a processor, is used to implement the 3D-to-2D rendering method of the above embodiments of the present invention. First, it receives original 3D scene data and performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images. This fully utilizes the massive parallel computing power of the GPU, helping to improve processing efficiency and enhance the stability of color and lighting effects. Finally, the multiple intermediate result images undergo weighted mixing and compositing processing to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0018] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0019] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart illustrating the distributed 3D multi-channel rendering method in existing technologies; Figure 2 This is a flowchart of a three-dimensional to two-dimensional rendering method according to an embodiment of the present invention; Figure 3 This is a block diagram of the overall architecture of a three-dimensional to two-dimensional rendering method according to a specific embodiment of the present invention; Figure 4 This is a schematic diagram of the data flow design of a 3D to 2D rendering method according to a specific embodiment of the present invention. Figure 5 This is a schematic diagram of the control flow design of a 3D to 2D rendering method according to a specific embodiment of the present invention. Figure 6 This is a block diagram of the preprocessing module of a three-dimensional to two-dimensional rendering method according to a specific embodiment of the present invention; Figure 7 This is a schematic diagram illustrating the principle of lighting information encoding in a three-dimensional to two-dimensional rendering method according to a specific embodiment of the present invention. Figure 8This is a schematic diagram of four-channel parallel rendering of a three-dimensional to two-dimensional rendering method according to a specific embodiment of the present invention; Figure 9 This is a schematic diagram of the hybrid output of a 3D to 2D rendering method according to a specific embodiment of the present invention; Figure 10 This is a structural block diagram of a 3D to 2D rendering system according to an embodiment of the present invention.
[0020] Figure label: 100 - 3D to 2D rendering system; 110 - Preprocessing module; 120 - Rendering module; 130 - Hybrid module. Detailed Implementation
[0021] The embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. The embodiments of the present invention are described in detail below.
[0022] Figure 1 This is a flowchart illustrating a distributed 3D multi-channel rendering method in existing technology. For example... Figure 1 As shown, the existing distributed 3D multi-channel rendering method includes the following steps: a control terminal sends rendering instructions to each rendering channel according to a preset rendering index list; each rendering channel renders the corresponding sub-scene image according to the received rendering instructions; after each rendering channel completes rendering, the control terminal sends a display instruction to each rendering channel; and each rendering channel displays the corresponding sub-scene image upon receiving the display instruction. However, this technology only focuses on accelerating general realistic rendering and does not optimize the core algorithms for non-realistic rendering such as cartoon rendering, outline generation, and color blocking.
[0023] Existing technology also provides a system for real-time transformation from 3D models to 2D shadow contour rendering. This system includes a processor communicating with a memory storing executable instructions. When executed by the processor, these instructions configure the system to receive 3D model input corresponding to a physical object and generate a data structure based on the 3D model input, including one or more features of the physical object and one or more 2D renderings of the physical object. The processor also configures the system to associate one or more features with one or more 2D renderings of the physical object and to determine the shadow contour rendering of the physical object based on the one or more features. However, this technology focuses on shadow contour rendering and does not involve parallel processing. Furthermore, this technology requires the acquisition of large amounts of data, necessitating time accumulation and incurring significant time costs.
[0024] Existing technology also provides a method for improved multi-process rendering in graphics systems, including rendering geometry in a scene to generate rendered image data, and then feeding back this rendered image data for subsequent rendering processes of the same or other geometry in the scene. Geometric primitives are rasterized to generate pixel data, which is stored in a rasterization buffer. The pixel data (including a list of fragment records) is parsed and stored in shared memory. Geometry in the scene can be rasterized in multiple processes to generate pixel data, including fragments that partially cover pixels. Fragments in subsequent processes can be blended with corresponding fragments stored in the rasterization buffer in the previous process. However, this technique requires fetching complex data and has a low fault tolerance.
[0025] The causes and consequences of the above problems mainly include the following aspects: Reason 1: The serial architecture stemming from the "Von Neumann bottleneck." This is the most fundamental and core reason. Traditional graphics pipelines are designed based on a sequential execution computation model. This approach treats rendering as a task that must be completed step by step. Each subsequent stage must wait for the previous stage to finish before it can begin. The consequences are: ① Performance ceiling: The time to render one frame is the sum of the times taken by all the serial stages. ② Resource idleness: When the GPU (Graphics Processing Unit) is performing pixel shading, the units responsible for geometric calculations may be idle, wasting hardware parallelism capabilities in the software architecture.
[0026] Reason Two: Fixed Functionality and Algorithm Coupling. Traditional pipelines are "rigid," making it difficult to flexibly adapt to the needs of different art styles. This method tightly couples the rendering algorithm with the execution flow of the rendering pipeline. Changing the outline style may require modifying shader code or even changing the rendering path. Effects influence each other, and adjusting colors may unintentionally destroy the integrity of the outline. The resulting consequences are: ① Lack of flexibility: It is extremely costly for designers to try different style combinations, requiring deep involvement from programmers. ② Long iteration cycles: Every minor artistic adjustment requires a complete adjustment cycle.
[0027] Reason 3: Data Dependency and Redundant Computation. This is a direct consequence of the serial architecture. Subsequent processing stages heavily rely on the specific outputs of the previous stage. Contour post-processing requires waiting for the complete color and depth buffers, and then recalculating the edges across the entire screen. This is equivalent to redrawing the edges on an already drawn image, resulting in high computational cost and inaccuracy. Multiple post-processing effects (such as contours, tone mapping, and blur) may require repeated readings and writing to the same memory block, causing significant memory bandwidth pressure. The consequences include: ① High latency: Even a simple adjustment to a parameter triggers a recalculation of the entire pipeline. ② Performance degradation: A large amount of computational resources are wasted on data transfer and redundant calculations.
[0028] Reason 4: Lack of a unified abstraction layer. Current technology fails to establish a clear and universal intermediate layer between the "raw 3D data" and the "final artistic effect." The creation of artistic effects operates directly on the underlying, ever-changing 3D data. Designers need to understand complex concepts such as normals and depth to control the outline. Different models and scenes have different data formats, requiring customized processing methods. This results in: complex workflows requiring significant time for adaptation and debugging; and inconsistent effects where the same parameter can produce completely different results in different scenarios.
[0029] Therefore, in summary, existing 3D to 2D rendering methods suffer from problems such as complex processes, performance bottlenecks, resource waste, inability to fully utilize GPU parallel capabilities in fixed pipelines, insufficient artistic control, reliance on post-processing for parameter adjustments, and lack of real-time feedback.
[0030] To address the aforementioned problems in the existing technology, embodiments of the present invention provide a 3D-to-2D rendering method, system, electronic device, and storage medium, as described below. Figures 2-10 A three-dimensional to two-dimensional rendering method, system, electronic device, and storage medium are described according to embodiments of the present invention.
[0031] Figure 2 This is a flowchart of a three-dimensional to two-dimensional rendering method according to an embodiment of the present invention. Figure 2 As shown, a 3D to 2D rendering method according to an embodiment of the present invention includes the following steps: Step S1: Receive the original 3D scene data, perform multiple asynchronous parallel preprocessing steps on the original 3D scene data, and generate standardized data.
[0032] In a specific embodiment, raw 3D scene data is first received, and then multiple asynchronous parallel preprocessing steps are performed on the raw 3D scene data to generate standardized data. Specifically, the raw 3D scene data is, for example, data acquired through an image acquisition device, and the multiple asynchronous parallel preprocessing steps include, but are not limited to, geometric processing, lighting information encoding processing, and resource management and allocation processing. The generated standardized data includes, but is not limited to, normal buffer data, depth buffer data, and lighting summary data.
[0033] Specifically, according to the 3D to 2D rendering method of the present invention, the original 3D scene data is first received, and multiple asynchronous parallel preprocessing operations are performed on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels.
[0034] Step S2: Perform synchronous and parallel data transformation processing on the standardized data through multiple rendering channels to generate multiple intermediate result images.
[0035] In a specific embodiment, the standardized data is then subjected to synchronous and parallel data transformation processing across multiple rendering channels to generate multiple intermediate result images. Specifically, the multiple rendering channels include, but are not limited to, contour rendering channels, color rendering channels, shadow rendering channels, and special effects rendering channels, with zero dependency between channels and parallel execution.
[0036] Specifically, according to the three-dimensional to two-dimensional rendering method of the present invention, the standardized data is then processed in parallel with multiple rendering channels to generate multiple intermediate result images. This fully utilizes the large-scale parallel computing power of the GPU (Graphics Processing Unit), which helps to improve processing efficiency and enhance the stability of color and lighting effects.
[0037] Step S3: Perform weighted mixing and synthesis on multiple intermediate result images to generate the corresponding two-dimensional image.
[0038] In a specific embodiment, the multiple intermediate result images are finally weighted, mixed, and synthesized to generate the corresponding two-dimensional image. Specifically, for example, the multiple intermediate result images are weighted and mixed using preset, adjustable weight parameters, such as, but not limited to, contour weight, color weight, shadow weight, and effect weight.
[0039] Specifically, according to the 3D to 2D rendering method of the present invention, multiple intermediate result images are finally weighted and combined to generate the corresponding 2D image. This avoids the problem that parameter adjustment requires re-execution of the entire rendering pipeline and cannot achieve real-time feedback, ensuring that the rendering effect achieves the WYSIWYG effect.
[0040] Therefore, the 3D-to-2D rendering method according to embodiments of the present invention first receives the original 3D scene data, performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data, transforming the messy original 3D data into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images, fully utilizing the massive parallel computing capabilities of the GPU, which helps improve processing efficiency and enhances the stability of color and lighting effects. Finally, the multiple intermediate result images undergo weighted mixing and compositing processing to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0041] In one embodiment of the present invention, step S1 performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data, including: asynchronous parallel geometric processing, lighting information encoding processing, and resource management and allocation processing on the original 3D scene data to generate normal buffer data, depth buffer data, and lighting summary data; wherein, geometric processing includes: performing vertex coordinate transformation, surface normal calculation, and depth value linearization processing on the original 3D scene data to generate and store normal buffer data and depth buffer data; lighting information encoding processing includes: performing lighting model calculation based on normal buffer data and light source information, quantizing the calculation results into discrete levels, mapping the discrete levels to preset artistic colors or identifiers, and generating lightweight lighting summary data; resource management and allocation processing includes: assigning unique identifiers to objects or materials in the original 3D scene and storing them in the material ID buffer, compressing texture resources, and pre-allocating video memory according to scene complexity.
[0042] In a specific embodiment, the original 3D scene data undergoes vertex coordinate transformation, surface normal calculation, and depth value linearization to generate and store normal buffer data and depth buffer data. Specifically, vertex transformation converts the 3D model from its own "model coordinate system" to the "world coordinate system" of the entire scene, and then to the camera's "view coordinate system"; normal calculation calculates the direction (normal vector) of the surface corresponding to each pixel, which is the core basis for the contour channel to determine edges and the shadow channel to calculate brightness and darkness. It is pre-calculated and stored in the "normal buffer" during the preprocessing stage; depth linearization calculates the precise distance of each pixel from the camera and converts it into a linear "depth buffer".
[0043] In a specific embodiment, lighting model calculations are performed based on normal buffer data and light source information. The calculation results are quantized into discrete levels, and these discrete levels are mapped to preset artistic colors or symbols to generate lightweight lighting summary data. In essence, this simplifies complex lighting calculations, preparing the data for cartoon rendering.
[0044] In a specific embodiment, a unique identifier is assigned to each object or material in the original 3D scene and stored in the material ID buffer. Texture resources are compressed, and video memory is pre-allocated according to scene complexity. Specifically, this involves material ID mapping, texture compression, and memory allocation. Material ID mapping assigns a unique ID number to each object or material and stores it in the "material ID buffer," allowing color channels to quickly identify "which object this pixel belongs to" and apply the corresponding cartoon color palette. Texture compression compresses resources such as color textures (e.g., in ASTC format) to reduce video memory usage and data transfer, which is especially important for mobile devices. Memory allocation pre-allocates the necessary video memory space for the subsequent four channels based on scene complexity, avoiding performance stuttering caused by dynamic memory allocation during real-time rendering.
[0045] Specifically, according to the 3D to 2D rendering method of the present invention, the original 3D scene data is processed asynchronously and in parallel through geometric processing, lighting information encoding processing, and resource management and allocation processing to generate normal buffer data, depth buffer data, and lighting summary data. This enables multiple asynchronous and parallel preprocessing of the original 3D scene data to generate standardized data, which helps to transform the messy original 3D data into standard quantifiable values and provides a "plug-and-play" data interface for subsequent parallel channels.
[0046] In one embodiment of the present invention, a lighting model calculation is performed based on normal buffer data and light source information. The calculation results are quantized into discrete levels, and the discrete levels are mapped to preset artistic colors or symbols to generate lightweight lighting summary data. This includes: inputting original lighting-related data of the original 3D scene; calculating diffuse reflection intensity values based on surface normals and light source directions; quantizing continuous diffuse reflection intensity values into multiple discrete intensity levels based on a preset threshold function; mapping the quantized intensity levels to preset color values; and packaging and compressing the mapped color values and extracted simplified specular information to output lighting summary data.
[0047] In a specific embodiment, the original lighting-related data of the original 3D scene is first input. Then, based on the surface normal and the light source direction, the diffuse reflection intensity value is calculated. Next, based on a preset threshold function, the continuous diffuse reflection intensity value is quantized into multiple discrete intensity levels. Then, the quantized intensity levels are mapped to preset color values. Finally, the mapped color values and the extracted simplified specular information are packaged and compressed, and output as lighting summary data. Specifically, the system first receives the original data from the 3D scene, including surface normals, material properties, light source position, and intensity; then performs basic lighting calculations, such as Lambert diffuse reflection and Blinn-Phong specular highlight modes; then enters the quantization stage, where specific values are matched and classified into levels. For example, diffuse reflection intensity (a continuous value from 0.0 to 1.0) is divided into specific levels using a threshold function: intensity > 0.6 is level two, belonging to the bright area; 0.3 < intensity ≤ 0.6 is level one, belonging to the midtones; intensity ≤ 0.3 is level 0, belonging to the dark area. Typically, the dot product N·L of the normal vector N and the light source direction L is used for calculation. Then, the quantized level is associated with the designer's preset color, such as a level of 0 mapping to dark blue to simulate cool ambient light. Next, the processed lighting information (height level, specular ID, etc.) is efficiently packaged into a compact data structure. This step involves specular information extraction, determining which areas will produce specular highlights, but only outputting simplified information such as the intensity and position of the specular highlights, rather than physically precise complex specular highlights. Finally, a lightweight lighting summary map is generated to supply the subsequent shadow and color channels.
[0048] Specifically, according to the 3D-to-2D rendering method of this invention, the original lighting-related data of the original 3D scene is first input. Then, based on the surface normal and the light source direction, the diffuse reflection intensity value is calculated. Next, based on a preset threshold function, the continuous diffuse reflection intensity value is quantized into multiple discrete intensity levels. Then, the quantized intensity levels are mapped to preset color values. Finally, the mapped color values and the extracted simplified specular information are packaged and compressed, and output as lighting summary data. In this way, the lighting model calculation is performed based on the normal buffer data and the light source information, the calculation result is quantized into discrete levels, and the discrete levels are mapped to preset artistic colors or symbols to generate lightweight lighting summary data, which simplifies complex lighting calculations and prepares for cartoon rendering.
[0049] In one embodiment of the present invention, the multiple rendering channels include at least a contour rendering channel, a color rendering channel, a shadow rendering channel, and a special effects rendering channel, and the multiple rendering channels process data independently and in parallel.
[0050] In a specific embodiment, the multiple rendering passes include at least a contour rendering pass, a color rendering pass, a shadow rendering pass, and an effects rendering pass, and the data is processed independently and in parallel among the multiple rendering passes. Specifically, the rendering task is decomposed into four independent sub-passes, and these four sub-passes are computed in parallel, perfectly blending the outputs of the contour, color block, shadow, and effects channels into a 2D image; all channels start working from the same preprocessed data, rather than one channel depending on the output of another channel, which fundamentally eliminates the risk of serial processing. Each channel is an independent computer shader or render pass, which can be scheduled to be executed simultaneously on different computing units on the GPU, and each sub-pass produces its own independent result.
[0051] Specifically, according to the 3D to 2D rendering method of the present invention, the multiple rendering channels include at least a contour rendering channel, a color rendering channel, a shadow rendering channel, and a special effects rendering channel, and the multiple rendering channels process data independently and in parallel; in this way, the massive parallel computing power of the GPU can be fully utilized, which helps to improve processing efficiency and enhance the stability of color and lighting effects.
[0052] In one embodiment of the present invention, step S3 performs weighted mixing and synthesis processing on multiple intermediate result images to generate a corresponding two-dimensional image, including: performing weighted operations on multiple intermediate result images one by one based on multiple preset channel weight parameters, and mixing the multiple weighted results to obtain a two-dimensional image.
[0053] In a specific embodiment, based on multiple preset channel weight parameters, weighted operations are performed on multiple intermediate result images one by one, and the resulting weighted results are mixed and then synthesized to obtain a two-dimensional image. Specifically, the multiple preset channel weight parameters include, but are not limited to, contour weight, color weight, shadow weight, and effect weight.
[0054] Specifically, according to the 3D to 2D rendering method of the present invention, multiple intermediate result images are weighted one by one based on multiple preset channel weight parameters, and the multiple weighted results are mixed and then synthesized to obtain a 2D image; this can ensure the effectiveness of the weighted mixing process, thereby helping to ensure the rendering effect.
[0055] In one embodiment of the present invention, the multiple channel weight parameters include at least contour weight, color weight, shadow weight and effect weight, and the multiple channel weight parameters can be adjusted in real time according to the synthesis result.
[0056] In a specific embodiment, the multiple channel weight parameters include at least contour weight, color weight, shadow weight, and effect weight. Specifically, these multiple channel weight parameters can be manually set by the operator or adjusted in real time based on the compositing results using machine learning algorithms.
[0057] Specifically, according to the 3D to 2D rendering method of the present invention, the multiple channel weight parameters include at least contour weight, color weight, shadow weight and special effects weight, and the multiple channel weight parameters can be adjusted in real time according to the compositing result; thereby, the contour weight, color weight, shadow weight and special effects weight that can be adjusted in real time according to the compositing result help to ensure the effectiveness of weighted blending processing.
[0058] In one embodiment of the present invention, based on multiple preset channel weight parameters, weighted operations are performed on multiple intermediate result images one by one, and the multiple weighted results are mixed and then synthesized to obtain a two-dimensional image. The process includes: weighting and summing the intermediate result images corresponding to each channel according to contour weight, color weight, shadow weight, and effect weight to generate a preliminary mixed image; performing layer blending mode processing and transparency processing on the preliminary mixed image to generate a composite image; and performing post-processing on the composite image to generate a two-dimensional image, wherein the post-processing includes at least global anti-aliasing processing, color mapping processing, sharpening processing, and / or blurring processing.
[0059] In a specific embodiment, the intermediate result images corresponding to each channel are first weighted and summed according to contour weight, color weight, shadow weight, and effect weight to generate a preliminary blended image. Specifically, the weighted blending multiplies the result of each channel by an adjustable weight coefficient. The specific formula is as follows: Preliminary blended color = (contour result × W_outline) + (color result × W_color) + (shadow result × W_shadow) + (effect result × W_effect), where W_outline, W_color, W_shadow, and W_effect are all controllable. W_outline refers to adjusting the intensity of the contour lines, W_color refers to controlling the saturation and flatness of the base color blocks, W_shadow refers to controlling the intensity and clarity of the shadows, and W_effect refers to controlling the intensity of effects such as brushstrokes and textures.
[0060] In a specific embodiment, the initial blended image is then processed with layer blending modes and transparency adjustments to generate a composite image. Specifically, after weighted summation, the transparency and overlay relationships between layers need to be processed. It is necessary to ensure that the outline layer is overlaid on the color layer in "Multiply" mode so that the outline lines can correctly cover the color blocks without white edges. Transparency processing mainly addresses the semi-transparent effect of special effects layers (such as smoke and halo) to ensure they blend naturally with the background.
[0061] In a specific embodiment, the synthesized image is post-processed to generate a two-dimensional image. Post-processing includes at least global anti-aliasing, color mapping, sharpening, and / or blurring. Specifically, post-processing is the packaging of the final effect of the blended image. To improve overall visual quality, it mainly consists of global anti-aliasing, color mapping, and sharpening / blurring. Global anti-aliasing smooths the entire image (especially contours and color block edges) to eliminate jagged edges. Color mapping converts linear colors to sRGB (standard Red Green Blue) color space to ensure correct display on the monitor. Sharpening / blurring, depending on style requirements, involves slight global sharpening to enhance line clarity or local blurring to simulate depth of field.
[0062] Specifically, according to the 3D to 2D rendering method of this embodiment, the intermediate result images corresponding to each channel are first weighted and summed according to contour weight, color weight, shadow weight, and effect weight to generate a preliminary blended image. Then, the preliminary blended image is processed by layer blending mode and transparency to generate a composite image. Finally, the composite image is post-processed to generate a 2D image. The post-processing includes at least global anti-aliasing, color mapping, sharpening, and / or blurring. In this way, multiple intermediate result images can be weighted one by one based on multiple preset channel weight parameters, and the multiple weighted results are blended and then composited to obtain a 2D image. This can effectively avoid the problem that parameter adjustment requires re-execution of the entire rendering pipeline and cannot achieve real-time feedback, ensuring that the rendering effect achieves the WYSIWYG effect.
[0063] The following describes the three-dimensional to two-dimensional rendering method of the present invention in further detail with reference to a specific embodiment. In this specific embodiment, a three-dimensional to two-dimensional rendering method is provided.
[0064] Figure 3 This is a block diagram of the overall architecture of a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 3As shown in this specific embodiment, the core approach of this 3D to 2D rendering method is a three-level parallel architecture, namely an intelligent preprocessing center, an independent rendering pipeline cluster, and an art-oriented mixer. The specific steps are as follows: S101: Intelligent Preprocessing Center; transforms messy raw 3D data into standard quantifiable values, asynchronously and in parallel processes geometry, material, and lighting information, and provides a "plug-and-play" data interface for subsequent parallel channels.
[0065] S102: Independent rendering channel cluster; the outline channel, color channel, shadow channel, and effects channel process the outline, color, shadow, and effects respectively. The channels have zero dependency and execute in parallel, making full use of the GPU's large-scale parallel computing capabilities.
[0066] S103: Art-oriented mixer; intelligent fusion of channel results based on independent channel weights, with a real-time adjustable mixing algorithm.
[0067] In this specific embodiment, the working principle of the 3D to 2D rendering method can be divided into data flow design and control flow design.
[0068] Figure 4 This is a schematic diagram illustrating the data flow design of a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 4 As shown in this specific embodiment, the working principle data flow design of this 3D to 2D rendering method mainly follows the path taken by "3D scene data" to "2D stylized image", focusing on the changes in data form and the processing order.
[0069] Figure 5 This is a schematic diagram illustrating the control flow design of a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 5 As shown in this specific embodiment, the working principle control flow design of this 3D to 2D rendering method mainly involves the command chain of how the "designer's intention" precisely controls the "final visual effect".
[0070] Figure 6 This is a block diagram of the preprocessing module of a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 6 As shown in this specific embodiment, the preprocessing module of this 3D to 2D rendering method mainly has three sub-tasks: geometry processing, lighting information encoding, and resource management and allocation. The specific steps are as follows: S401: Geometric processing; divided into vertex transformation, normal calculation, and depth linearization; vertex transformation transforms the 3D model from its own "model coordinate system" to the "world coordinate system" of the entire scene, and then to the camera's "view coordinate system"; normal calculation calculates the direction (normal vector) of the surface corresponding to each pixel, which is the core basis for the contour channel to determine the edge and the shadow channel to calculate the brightness and darkness. It is calculated in advance and stored in the "normal buffer" during the preprocessing stage; depth linearization calculates the precise distance of each pixel from the camera and converts it into a linear "depth buffer".
[0071] S402: Lighting Information Encoding; simplifies complex lighting calculations, preparing for cartoon rendering.
[0072] Figure 7 This is a schematic diagram illustrating the principle of lighting information encoding in a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 7 As shown in this specific embodiment, the specific steps of the lighting information encoding principle of this 3D to 2D rendering method are as follows: S501: Input phase; Receives raw data from the 3D scene, including surface normals, material properties, light source position, and intensity.
[0073] S502: Lighting model calculation; performs basic lighting calculations, such as Lambert diffuse and Blinn-Phong specular modes.
[0074] S503: Quantization stage; This is the core of the encoding process. Specific values are calculated and classified into levels through matching. For example, diffuse reflection intensity (a continuous value from 0.0 to 1.0) is divided into specific levels using a threshold function: intensity > 0.6 is level 2, belonging to the bright part; 0.3 < intensity ≤ 0.6 is level 1, belonging to the midtone; intensity ≤ 0.3 is level 0, belonging to the dark part; It is usually calculated using the dot product N·L of the normal vector N and the light source direction L.
[0075] S504: Artistic parameter mapping; associates quantified levels with designer-preset colors. For example, a level of 0 maps to dark blue, simulating cool ambient light.
[0076] S505: Data compression and packaging; efficiently package the processed lighting information (height level, specular ID, etc.) into a compact data structure; this step involves specular information extraction, determining which areas will produce specular highlights, but only outputs simplified information such as the intensity and position of the specular highlights, rather than physically precise complex specular highlights.
[0077] S506: Output stage; generates a lightweight lighting summary map to supply subsequent shadow and color channels.
[0078] S403: Resource Management and Allocation; it is a highly efficient parallel "scheduling center," primarily responsible for material ID mapping, texture compression, and memory allocation. Material ID mapping assigns a unique ID number to each object or material and stores it in a "material ID buffer," allowing color channels to quickly identify "which object this pixel belongs to" and apply the corresponding cartoon color palette. Texture compression compresses resources such as color textures (e.g., ASTC (Adaptive Scalable Texture Compression) format) to reduce video memory usage and data transfer volume, which is especially important for mobile devices. Memory allocation pre-allocates the necessary video memory space for the subsequent four channels based on scene complexity, avoiding performance stuttering caused by dynamic memory allocation during real-time rendering.
[0079] Figure 8 This is a schematic diagram of four-channel parallel rendering of a 3D to 2D rendering method according to a specific embodiment of the present invention. Figure 8 As shown in this specific embodiment, the four-channel parallel rendering of this 3D to 2D rendering method decomposes the rendering task into four independent sub-channels and allows these four sub-channels to be computed in parallel. The specific steps are as follows: S601: A unified input source; primarily, it ensures that all channels start working from the same preprocessed data, rather than one channel depending on the output of another, which fundamentally eliminates the risk of serial transmission.
[0080] S602: Independent computation process; each channel is an independent computer shader or render pass, which can be scheduled to different computing units on the GPU for simultaneous execution.
[0081] S603: Mixed output; Each sub-channel produces its own independent result, and the results from each sub-channel are sent to the final stage for mixing according to the designer's weight settings to generate the final image.
[0082] Figure 9 This is a schematic diagram illustrating the hybrid output of a 3D-to-2D rendering method according to a specific embodiment of the present invention. Figure 9 As shown in this specific embodiment, the hybrid output of this 3D to 2D rendering method is to perfectly blend the output results of the four channels—outline, color block, shadow, and special effects—into a 2D image. The specific steps are as follows: S701: Weighted Blending; This is the core of the blending output algorithm, which multiplies the result of each channel by an adjustable weight coefficient; The specific formula is: Preliminary Blending Color = (Outline Result × W_outline) + (Color Result × W_color) + (Shadow Result × W_shadow) + (Effect Result × W_effect); Wherein, W_outline, W_color, W_shadow, and W_effect are all controllable. W_outline refers to adjusting the intensity of the outline, W_color refers to controlling the saturation and flatness of the base color block, W_shadow refers to controlling the intensity and clarity of the shadow, and W_effect refers to controlling the intensity of effects such as brushstrokes and textures.
[0083] S702: Alpha Compositing; After weighted addition, it is necessary to process the transparency and overlay relationship between layers. It is necessary to ensure that the outline layer is overlaid on the color layer in "Multiply" mode so that the outline can correctly cover the color block and there will be no white edges; the transparency processing is mainly to process the semi-transparent effect of the special effects layer (such as smoke and halo) so that it blends naturally with the background.
[0084] S703: Post-processing; This is the final packaging of the blended image to improve the overall visual quality. It is mainly divided into global anti-aliasing, color mapping, and sharpening / blurring: Global anti-aliasing smooths the entire image (especially the outlines and color block edges) to eliminate stepped jagged edges; Color mapping converts linear space colors to sRGB space to ensure correct display on the monitor; Sharpening / blurring is to perform slight global sharpening to enhance line clarity or local blurring to simulate depth of field, depending on the style requirements.
[0085] In this specific embodiment, the 3D to 2D rendering method is implemented, for example, through the Unity engine and the Shader core algorithm.
[0086] As can be seen, in this specific embodiment, the 3D to 2D rendering method has the following significant advantages compared with the prior art: 1. To solve the performance bottleneck and eliminate resource waste in the prior art, a heterogeneous parallel architecture is adopted, with four independent rendering channels clustered in parallel rendering to improve rendering efficiency; 2. To solve the problem that the fixed pipeline in the prior art cannot fully utilize the large-scale parallel computing capabilities of modern GPUs, each rendering channel is calculated independently, eliminating resource waste, improving efficiency, and reducing manpower by 3 / 4; 3. To solve the problem of unstable color and lighting effects in the prior art, the stability of color and lighting effects is improved through Lab color space and independent shadow channel processing, avoiding the recurrence of HUD visual flickering; 4. To solve the problem that parameter adjustment in the prior art requires re-execution of the entire rendering pipeline and cannot achieve real-time feedback, a WYSIWYG effect is achieved through a parametric blending module, without requiring changes to the overall architecture, and the development iteration speed is fast.
[0087] In summary, the 3D-to-2D rendering method according to embodiments of the present invention first receives original 3D scene data, performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data, transforming the messy original 3D data into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images, fully utilizing the massive parallel computing capabilities of the GPU, which helps improve processing efficiency and enhances the stability of color and lighting effects. Finally, the multiple intermediate result images undergo weighted blending and compositing processing to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0088] A further embodiment of the present invention discloses a 3D to 2D rendering system. Figure 10 This is a structural block diagram of a 3D to 2D rendering system according to an embodiment of the present invention, as shown below. Figure 10 As shown, the 3D to 2D rendering system 100 includes: a preprocessing module 110, a rendering module 120, and a mixing module 130.
[0089] Specifically, the preprocessing module 110 is used to receive the original 3D scene data, perform multiple asynchronous parallel preprocessing operations on the original 3D scene data, and generate standardized data; the rendering module 120 is used to perform multiple synchronous parallel data transformation processing on the standardized data through multiple rendering channels to generate multiple intermediate result images; the mixing module 130 is used to perform weighted mixing and compositing processing on the multiple intermediate result images to generate the corresponding 2D image.
[0090] In one embodiment of the present invention, the preprocessing module 110 performs multiple asynchronous parallel preprocessing operations on the original 3D scene data to generate standardized data, including: asynchronous parallel geometric processing, lighting information encoding processing, and resource management and allocation processing on the original 3D scene data to generate normal buffer data, depth buffer data, and lighting summary data; wherein, the geometric processing includes: performing vertex coordinate transformation, surface normal calculation, and depth value linearization processing on the original 3D scene data to generate and store normal buffer data and depth buffer data; the lighting information encoding processing includes: performing lighting model calculation based on normal buffer data and light source information, quantizing the calculation results into discrete levels, mapping the discrete levels to preset artistic colors or identifiers, and generating lightweight lighting summary data; the resource management and allocation processing includes: assigning unique identifiers to objects or materials in the original 3D scene and storing them in the material ID buffer, compressing texture resources, and pre-allocating video memory according to scene complexity.
[0091] In one embodiment of the present invention, the preprocessing module 110 performs lighting model calculations based on normal buffer data and light source information, quantizes the calculation results into discrete levels, maps the discrete levels to preset artistic colors or symbols, and generates lightweight lighting summary data, including: inputting original lighting-related data of the original 3D scene; calculating diffuse reflection intensity values based on surface normals and light source directions; quantizing continuous diffuse reflection intensity values into multiple discrete intensity levels based on a preset threshold function; mapping the quantized intensity levels to preset color values; and packaging and compressing the mapped color values and extracted simplified specular information to output lighting summary data.
[0092] In one embodiment of the present invention, the multiple rendering channels include at least a contour rendering channel, a color rendering channel, a shadow rendering channel, and a special effects rendering channel, and the multiple rendering channels process data independently and in parallel.
[0093] In one embodiment of the present invention, the mixing module 130 performs weighted mixing and synthesis processing on multiple intermediate result images to generate a corresponding two-dimensional image, including: performing weighted operations on multiple intermediate result images one by one based on multiple preset channel weight parameters, and mixing the multiple weighted results and then performing synthesis processing to obtain a two-dimensional image.
[0094] In one embodiment of the present invention, the multiple channel weight parameters include at least contour weight, color weight, shadow weight and effect weight, and the multiple channel weight parameters can be adjusted in real time according to the synthesis result.
[0095] In one embodiment of the present invention, the mixing module 130 performs weighted calculations on multiple intermediate result images one by one based on multiple preset channel weight parameters, and performs a composite processing on the multiple weighted results to obtain a two-dimensional image. The process includes: weighting and summing the intermediate result images corresponding to each channel according to contour weight, color weight, shadow weight, and effect weight to generate a preliminary mixed image; performing layer blending mode processing and transparency processing on the preliminary mixed image to generate a composite image; and performing post-processing on the composite image to generate a two-dimensional image. The post-processing includes at least global anti-aliasing processing, color mapping processing, sharpening processing, and / or blurring processing.
[0096] It should be noted that the specific implementation of the 3D to 2D rendering system 100 in this embodiment of the invention is similar to the specific implementation of the 3D to 2D rendering method described in the above embodiment of the invention. For details, please refer to the description of the 3D to 2D rendering method section. To reduce redundancy, it will not be repeated here.
[0097] The 3D-to-2D rendering system 100 according to an embodiment of the present invention is used to implement the 3D-to-2D rendering method of the above embodiment of the present invention. First, it receives the original 3D scene data and performs multiple asynchronous parallel preprocessing operations on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data is processed by multiple rendering channels in synchronous parallel data transformation to generate multiple intermediate result images. This fully utilizes the large-scale parallel computing power of the GPU, which helps to improve processing efficiency and enhance the stability of color and lighting effects. Finally, the multiple intermediate result images are weighted and blended to generate the corresponding 2D image. This avoids the problem that parameter adjustments require re-execution of the entire rendering pipeline, which prevents real-time feedback and ensures that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0098] Further embodiments of the present invention also disclose an electronic device.
[0099] In some embodiments, the electronic device includes a three-dimensional to two-dimensional rendering system 100 as described in the above embodiments of the present invention.
[0100] In other embodiments, the electronic device includes a processor, a memory, and a 3D-to-2D rendering program stored in the memory and executable on the processor, wherein the 3D-to-2D rendering program, when executed by the processor, implements the 3D-to-2D rendering method as described in the above embodiments of the present invention.
[0101] In specific embodiments, the electronic device may be, for example, an image processing device or a vehicle.
[0102] It should be noted that the specific implementation of the electronic device in the embodiments of the present invention is similar to the specific implementation described in the three-dimensional to two-dimensional rendering method of the above embodiments of the present invention. For details, please refer to the description in the three-dimensional to two-dimensional rendering method section. In order to reduce redundancy, it will not be repeated here.
[0103] An electronic device according to an embodiment of the present invention is used to implement the 3D to 2D rendering method of the above embodiments of the present invention. First, it receives original 3D scene data and performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images. This fully utilizes the massive parallel computing power of the GPU, which helps improve processing efficiency and enhances the stability of color and lighting effects. Finally, the multiple intermediate result images are weighted and blended to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D to 2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0104] A further embodiment of the present invention discloses a computer-readable storage medium storing a 3D-to-2D rendering program, which, when executed by a processor, implements the 3D-to-2D rendering method as described in the above embodiments of the present invention.
[0105] It should be noted that the specific implementation of the computer-readable storage medium in the embodiments of the present invention is similar to the specific implementation described in the three-dimensional to two-dimensional rendering method of the above embodiments of the present invention. For details, please refer to the description in the three-dimensional to two-dimensional rendering method section. In order to reduce redundancy, it will not be repeated here.
[0106] According to an embodiment of the present invention, a computer-readable storage medium storing a 3D-to-2D rendering program thereon, when executed by a processor, is used to implement the 3D-to-2D rendering method of the above embodiments of the present invention. First, it receives original 3D scene data and performs multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data. The messy original 3D data is transformed into standard quantifiable values, providing a "plug-and-play" data interface for subsequent parallel channels. Then, the standardized data undergoes synchronous parallel data transformation processing by multiple rendering channels to generate multiple intermediate result images. This fully utilizes the massive parallel computing power of the GPU, helping to improve processing efficiency and enhance the stability of color and lighting effects. Finally, the multiple intermediate result images undergo weighted mixing and compositing processing to generate the corresponding 2D image. This avoids the problem of not being able to achieve real-time feedback due to the need to re-execute the entire rendering pipeline when adjusting parameters, ensuring that the rendering effect achieves a WYSIWYG effect. This not only ensures the stability of the 3D-to-2D rendering effect but also avoids resource waste, effectively saves time costs, and improves rendering efficiency.
[0107] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example.
[0108] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for converting 3D to 2D rendering, characterized in that, Includes the following steps: Receive raw 3D scene data, perform multiple asynchronous parallel preprocessing steps on the raw 3D scene data, and generate standardized data; The standardized data is subjected to synchronous and parallel data transformation processing through multiple rendering channels to generate multiple intermediate result images; The intermediate result images are weighted, mixed, and synthesized to generate the corresponding two-dimensional image.
2. The 3D to 2D rendering method according to claim 1, characterized in that, The process of performing multiple asynchronous parallel preprocessing steps on the original 3D scene data to generate standardized data includes: The original 3D scene data undergoes asynchronous and parallel geometric processing, lighting information encoding processing, and resource management and allocation processing to generate normal buffer data, depth buffer data, and lighting summary data; wherein, The geometric processing includes: performing vertex coordinate transformation, surface normal calculation, and depth value linearization on the original 3D scene data, and generating and storing the normal buffer data and the depth buffer data; The lighting information encoding process includes: performing lighting model calculations based on the normal buffer data and light source information, quantizing the calculation results into discrete levels, mapping the discrete levels to preset artistic colors or symbols, and generating lightweight lighting summary data. The resource management and allocation process includes: assigning a unique identifier to objects or materials in the original 3D scene and storing it in the material ID buffer, compressing texture resources, and pre-allocating video memory according to scene complexity.
3. The 3D to 2D rendering method according to claim 2, characterized in that, Based on the normal buffer data and light source information, the lighting model is calculated, the calculation results are quantized into discrete levels, and the discrete levels are mapped to preset artistic colors or symbols to generate lightweight lighting summary data, including: Input the original lighting data of the original 3D scene; Calculate the diffuse reflection intensity value based on the surface normal and the direction of the light source; The continuous diffuse reflection intensity values are quantized into multiple discrete intensity levels based on a preset threshold function; The quantized intensity level is mapped to a preset color value; The mapped color values and the extracted simplified specular information are packaged and compressed, and output as the illumination summary data.
4. The 3D to 2D rendering method according to claim 1, characterized in that, The plurality of rendering channels include at least a contour rendering channel, a color rendering channel, a shadow rendering channel, and an effects rendering channel, and the plurality of rendering channels process data independently and in parallel.
5. The 3D to 2D rendering method according to claim 4, characterized in that, The step of weighted mixing and compositing of multiple intermediate result images to generate a corresponding two-dimensional image includes: Based on multiple preset channel weight parameters, weighted operations are performed on multiple intermediate result images one by one, and the multiple weighted results are mixed and then synthesized to obtain the two-dimensional image.
6. The three-dimensional to two-dimensional rendering method according to claim 5, characterized in that, The multiple channel weight parameters include at least contour weight, color weight, shadow weight, and effect weight, and the multiple channel weight parameters can be adjusted in real time according to the synthesis result.
7. The 3D to 2D rendering method according to claim 6, characterized in that, The process involves weighting multiple intermediate result images one by one based on multiple preset channel weight parameters, and then combining the weighted results to synthesize the resulting two-dimensional image, including: Based on the contour weight, the color weight, the shadow weight, and the effect weight, the intermediate result images corresponding to each channel are weighted and summed to generate a preliminary blended image; The initial mixed image is processed with layer blending mode and transparency to generate a composite image; The synthesized image is post-processed to generate the two-dimensional image, wherein the post-processing includes at least global anti-aliasing, color mapping, sharpening, and / or blurring.
8. A 3D to 2D rendering system, characterized in that, include: The preprocessing module is used to receive the original 3D scene data, perform multiple asynchronous parallel preprocessing operations on the original 3D scene data, and generate standardized data. The rendering module is used to perform synchronous and parallel data transformation processing on the standardized data through multiple rendering channels to generate multiple intermediate result images; The mixing module is used to perform weighted mixing and synthesis processing on multiple intermediate result images to generate corresponding two-dimensional images.
9. An electronic device, characterized in that, include: The 3D to 2D rendering system as described in claim 8; or, A processor, a memory, and a 3D-to-2D rendering program stored in the memory and executable on the processor, wherein the 3D-to-2D rendering program, when executed by the processor, implements the 3D-to-2D rendering method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a 3D to 2D rendering program, which, when executed by a processor, implements the 3D to 2D rendering method as described in any one of claims 1-7.