A multi-style hybrid rendering method and system for unreal engine

CN122597545BActive Publication Date: 2026-10-09HANGZHOU DIANZI UNIVERSTIY INFORMATION ENG SCHOOL
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611079654.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-10-09
Estimated Expiration
2046-07-21

AI Technical Summary

Technical Problem

目前市面上的多风格渲染方案主要依赖于表面材质的方式来实现不同视觉表现,难以满足复杂场景下的混合需求,存在以下主要问题:

Benefits of technology

[0029] The beneficial effects of this invention are as follows: This invention effectively solves the technical problems of insufficient multi-style material blending rendering capabilities, abrupt style transitions, and perspective issues caused by rendering sorting errors in complex scenes in existing Unreal Engine. Through innovative post-processing and screen-space dynamic blending mechanisms, it achieves natural fusion and smooth transitions of multiple different art styles within the same frame, significantly improving the artistic expression and visual coherence of the image. Simultaneously, this method greatly reduces the difficulty for developers in creating complex multi-style scenes, improves rendering efficiency and controllability, and balances performance optimization and effect adjustment while ensuring correct rendering. It provides a more practical hybrid rendering solution for fields such as games, virtual reality, and digital twins, and has strong engineering application value and promotional significance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597545B_ABST
    Figure CN122597545B_ABST
Patent Text Reader

Abstract

The application discloses a multi-style mixed rendering method and system for Unreal Engine, which firstly constructs a style material set based on a material editing system of Unreal Engine, adds a custom template identification value attribute to an RActor of a custom style post-material in a scene based on a custom depth channel, and acquires a custom depth buffer.Secondly, shading is performed based on the style material set, color buffers of RActors of different styles are acquired, depth testing and screen space boundary detection are performed, a basic mixed color buffer is acquired after superposition rendering, and feature vectors of different shading styles are acquired.Finally, a shading style similarity matrix between style feature vectors is calculated, pixel-level color mixing operation is performed, and a multi-style mixed rendering picture is output.The application effectively solves the problems of insufficient multi-style material mixed rendering capability, harsh style transition and perspective problems caused by rendering sorting errors in complex scenes in the existing Unreal Engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer graphics rendering technology, and specifically relates to a multi-style hybrid rendering method and system for Unreal Engine. Background Technology

[0002] With the rapid development of Unreal Engine rendering technology, developers increasingly need to apply various visual effects to different objects in scenes in applications such as games, virtual reality, and digital twins to create rich, colorful, and artistically layered visuals. The purpose of this invention is to provide a hybrid rendering method for Unreal Engine based on materials of different styles, achieving correct rendering blending and natural transitions of multiple material styles within the same scene.

[0003] While Unreal Engine supports achieving different visual effects through its material system, it still has significant shortcomings in the area of ​​rendering mixed materials of various styles. Currently available multi-style rendering solutions mainly rely on surface materials to achieve different visual representations, which is insufficient to meet the mixing needs of complex scenes, and suffers from the following main problems:

[0004] (1) Insufficient multi-style blending rendering capability: Most existing solutions use a single surface material to stylize objects. Although they can present different visual effects to a certain extent, they lack an effective multi-style blending rendering mechanism. When different effects need to be achieved for multiple Actors in the same scene, relying solely on surface materials is cumbersome and complex, and cannot achieve unified management and efficient blending of multiple post-processing materials.

[0005] (2) The transition between multiple styles is stiff: the current multi-style implementation mainly relies on the direct switching of surface materials. The boundaries of multiple surface materials cannot be mixed with each other. There are obvious visual jumps at the adjacent boundaries of different style areas, and a smooth and natural transition effect cannot be achieved. Summary of the Invention

[0006] To address the aforementioned issues, this invention proposes a multi-style blending rendering method and system for Unreal Engine. Based on post-processing materials, this method combines core technologies such as custom template identifiers, multi-style boundary visual feature extraction in screen space, style similarity calculation, and dynamic weight blending to achieve accurate and efficient blending and smooth transitions of multiple different styles of materials within the same image.

[0007] In one aspect, this invention proposes a multi-style hybrid rendering method for Unreal Engine, comprising the following steps:

[0008] Step 1: Based on the Unreal Engine, the material editing system builds a multi-style parametric post-processing material template and material instance mechanism. Through HLSL custom nodes and dynamic material parameters, it constructs a set of visual effect parameters for different art styles, and obtains an independent and reusable style material set.

[0009] Step 2: Based on the custom depth channel in the Unreal Engine rendering pipeline, add a custom template identifier value attribute to the RActor in the scene that requires custom-styled post-processing materials, and obtain a custom depth buffer.

[0010] The Actor that requires custom-styled post-processing materials will be referred to as RActor.

[0011] Step 2.1: Use the custom template identifier value attribute of each RActor as its unique template identifier information, and write it into the custom depth channel to obtain the custom rendering template buffer of the RActor, which is composed of the buffer result of the custom depth channel and the custom template identifier value.

[0012] Step 2.2: Write each RActor with a custom template identifier value attribute to a custom depth channel. The engine writes to a custom depth buffer through the custom depth channel and then to a GBuffer to prepare for subsequent steps.

[0013] Step 3: Based on the style material set from Step 1, color the world scene and each RActor to obtain a mapping set of RActors with custom template identifier values ​​as keys and coloring effects as values.

[0014] Step 4: Based on the RActor mapping category set in Step 3, and based on the RActor custom rendering template buffer in Step 2.1, obtain the corresponding RActor custom rendering template buffer area through the key-value pairs of the mapping category set, and combine the RActor custom rendering template buffer area with its shading effect to obtain the color buffer of RActor with different styles.

[0015] Step 5: Based on the scene depth buffer obtained from Unreal Engine's GBuffer and the custom depth buffer of Ractor written in Step 2.2, construct the submodule MixDepthTester to perform depth testing and obtain the correct rendering order of the scene and Ractor.

[0016] Step 6: Based on the Unreal Engine's post-processing rendering pipeline, build the MixRender module to manage mixed rendering, and write the scene and RActor's correct rendering sorting results from Step 5 into the module cache (PrimitiveSortListCache). The custom rendering template buffer of RActor from Step 2.1 is written into the module buffer (RActorBoundaryLocationBuffer) to obtain the RActor's boundary position buffer through the screen space boundary detection algorithm.

[0017] Step 7: Based on the Unreal Engine's BasePass, sample the world scene, obtain the world scene color buffer and write it to the MixRender module cache (WorldColorBuffer), and write the color buffers of different styles of RActor from Step 4 to the MixRender module cache (RActorColorBuffer). After simple overlay rendering, obtain the basic blend color buffer.

[0018] Step 8: Based on the basic blending color buffer in Step 7, and based on the RActorBoundaryLocationBuffer written to the MixRender module in Step 6, extract the key visual feature parameters (only color, saturation, brightness, and contrast) of different style material instances for pixels in adjacent RActor boundary regions in screen space, and obtain feature vectors of different shading styles.

[0019] Step 9: Based on the feature vectors of different coloring styles obtained in Step 8, calculate the cosine similarity between the style feature vectors in real time to obtain the coloring style similarity matrix.

[0020] Step 10: Based on the coloring style similarity matrix obtained in Step 9, dynamically obtain the StyleBlendFactor style blending weight factor according to the similarity matrix.

[0021] Step 11: Based on the StyleBlendFactor generated in Step 10, perform the final pixel-level color blending operation in the MixRender module to finally output a multi-style blended rendering image.

[0022] In another aspect, the present invention provides a multi-style hybrid rendering system for Unreal Engine, comprising the following units:

[0023] The Style Material Unit is a material editing system based on Unreal Engine. It constructs multi-style parametric post-processing material templates and material instance mechanisms to build independent and reusable style material sets.

[0024] The Depth Buffer Unit, based on a custom depth channel in the Unreal Engine rendering pipeline, adds a custom template identifier value attribute to the RActor of custom-style post-processing materials in the scene and obtains a custom depth buffer.

[0025] The color buffer unit colors the world scene and each RActor based on the style material set, obtaining color buffers for RActors with different styles.

[0026] The basic blending color buffer unit is based on the scene depth buffer and custom depth buffer obtained from Unreal Engine's GBuffer. It performs depth testing and screen space boundary detection to obtain the RActor boundary position buffer. Combined with the RActor's color buffer, the basic blending color buffer is obtained after overlay rendering.

[0027] The shading style unit, based on the basic blending color buffer and the RActor boundary position buffer, extracts key visual feature parameters of material instances with different styles to obtain feature vectors of different shading styles.

[0028] The multi-style blending rendering output unit calculates the shading style similarity matrix between the feature vectors of different shading styles, obtains the style blending weight factor, performs pixel-level color blending operations, and outputs a multi-style blending rendering image.

[0029] The beneficial effects of this invention are as follows: This invention effectively solves the technical problems of insufficient multi-style material blending rendering capabilities, abrupt style transitions, and perspective issues caused by rendering sorting errors in complex scenes in existing Unreal Engine. Through innovative post-processing and screen-space dynamic blending mechanisms, it achieves natural fusion and smooth transitions of multiple different art styles within the same frame, significantly improving the artistic expression and visual coherence of the image. Simultaneously, this method greatly reduces the difficulty for developers in creating complex multi-style scenes, improves rendering efficiency and controllability, and balances performance optimization and effect adjustment while ensuring correct rendering. It provides a more practical hybrid rendering solution for fields such as games, virtual reality, and digital twins, and has strong engineering application value and promotional significance. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of the method of the present invention;

[0031] Figure 2 A comparison chart showing the effects of using and not using MixDepthTester;

[0032] Figure 3 To accurately render semi-transparent cartoon water bodies and hand-drawn scenes;

[0033] Figure 4To ensure proper blending and rendering of multiple styles (cartoon doors, hand-drawn scenes, pure red characters);

[0034] Figure 5 The image shows a comparison of the effects of traditional solutions and the solution of this invention in the same scene (realistic scene + cartoon door). Detailed Implementation

[0035] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Those skilled in the art should understand that the following embodiments are for illustrative purposes only and are not intended to limit the invention. Various modifications or equivalent substitutions can be made to the following embodiments without departing from the spirit and substance of the invention, and all such modifications or substitutions should be included within the scope of protection of the present invention.

[0036] This invention proposes a multi-style hybrid rendering method for Unreal Engine, such as... Figure 1 As shown, it includes the following steps:

[0037] Step 1: Based on the Unreal Engine, the material editing system builds a multi-style parametric post-processing material template and material instance mechanism. Through HLSL custom nodes and dynamic material parameters, it constructs a set of visual effect parameters for different art styles, and obtains an independent and reusable style material set.

[0038] Step 2: Based on the custom depth channel in the Unreal Engine rendering pipeline, add a custom template identifier value attribute to the RActor in the scene that requires custom-styled post-processing materials, and obtain a custom depth buffer.

[0039] The Actor that requires custom-styled post-processing materials will be referred to as RActor.

[0040] Step 2.1: Use the custom template identifier value attribute of each RActor as its unique template identifier information, and write it into the custom depth channel to obtain the custom rendering template buffer of the RActor, which is composed of the buffer result of the custom depth channel and the custom template identifier value.

[0041] Step 2.2: Write each RActor with a custom template identifier value attribute to a custom depth channel. The engine writes to a custom depth buffer through the custom depth channel and then to a GBuffer to prepare for subsequent steps.

[0042] Step 3: Based on the style material set from Step 1, color the world scene and each RActor to obtain a mapping set of RActors with custom template identifier values ​​as keys and coloring effects as values.

[0043] Step 4: Based on the RActor mapping category set in Step 3, and based on the RActor custom rendering template buffer in Step 2.1, obtain the corresponding RActor custom rendering template buffer area through the key-value pairs of the mapping category set, and combine the RActor custom rendering template buffer area with its shading effect to obtain the color buffer of RActor with different styles.

[0044] Step 5: Based on the scene depth buffer obtained from Unreal Engine's GBuffer and the custom depth buffer of Ractor written in Step 2.2, construct the submodule MixDepthTester to perform depth testing and obtain the correct rendering order of the scene and Ractor.

[0045] Step 6: Based on the Unreal Engine's post-processing rendering pipeline, build the MixRender module to manage mixed rendering, and write the scene and RActor's correct rendering sorting results from Step 5 into the module cache (PrimitiveSortListCache). The custom rendering template buffer of RActor from Step 2.1 is written into the module buffer (RActorBoundaryLocationBuffer) to obtain the RActor's boundary position buffer through the screen space boundary detection algorithm.

[0046] Step 7: Based on the Unreal Engine's BasePass, sample the world scene, obtain the world scene color buffer and write it to the MixRender module cache (WorldColorBuffer), and write the color buffers of different styles of RActor from Step 4 to the MixRender module cache (RActorColorBuffer). After simple overlay rendering, obtain the basic blend color buffer.

[0047] Step 8: Based on the basic blending color buffer in Step 7, and based on the RActorBoundaryLocationBuffer written to the MixRender module in Step 6, extract the key visual feature parameters (only color, saturation, brightness, and contrast) of different style material instances for pixels in adjacent RActor boundary regions in screen space, and obtain feature vectors of different shading styles.

[0048] Step 9: Based on the feature vectors of different coloring styles obtained in Step 8, calculate the cosine similarity between the style feature vectors in real time to obtain the coloring style similarity matrix.

[0049] Step 10: Based on the coloring style similarity matrix obtained in Step 9, dynamically obtain the StyleBlendFactor style blending weight factor according to the similarity matrix.

[0050] Step 11: Based on the StyleBlendFactor generated in Step 10, perform the final pixel-level color blending operation in the MixRender module to finally output a multi-style blended rendering image.

[0051] Furthermore, the specific implementation process of constructing the multi-style parametric post-processing material template in step 1 is as follows: based on the preset style performance effect, a series of effect parameter sets are disclosed, and multiple style materials are created in the Unreal Engine's material editing system based on the material instance mechanism. Each style material includes a material instance for shading the scene and a material instance for shading the RActor.

[0052] Furthermore, the specific process of constructing the submodule MixDepthTester for depth comparison testing in step 5 is as follows: establishing a joint judgment mechanism of scene depth buffer and custom depth buffer.

[0053] For the same style material A, the depth comparison standard is different when using material instance A1 as scene shading and when using material instance A2 as RActor shading.

[0054] Based on the depth test between the RActor shaded by material B and the scene shaded by material instance A1, when the custom depth buffer is greater than the scene depth buffer, i.e. the RActor is occluded by the scene, the result of rendering A1 is returned first; otherwise, the result of rendering B is returned first.

[0055] Based on the depth test of the scene shaded by material B and the RActor shaded by material instance A2, when the custom depth buffer is greater than the scene depth buffer, that is, the RActor is occluded by the scene, the result of rendering B is returned first, otherwise the result of rendering A2 is returned first.

[0056] Furthermore, the specific implementation process for extracting key visual feature parameters of material instances of different styles in step 8 is as follows:

[0057] In the MixRender module, pixels in the adjacent RActor boundary region in screen space are... Extracting style feature vectors .

[0058]

[0059] The definitions and extraction methods of its components are as follows:

[0060] A pixel in the boundary region of adjacent RActors in screen space The calculation is performed using a fixed-size local window of equal length. The calculation method is equivalent to window sliding. The window size should be as odd as possible to ensure that the length of all four sides is the same. The variable of window size can be exposed as a parameter of the MixRender module. The window size determines the performance consumption.

[0061] Current pixel is The window is a Win(p) window, and the window length is [missing information].

[0062] It is a function to convert RGB to HSV.

[0063] (1) Color statistics

[0064] Based on the same window Win(p), all pixels are converted from RGB to HSV color space, histogram statistics are performed on the H channel, and the weighted average of the three most frequent hues is taken as CL(p).

[0065] (2) Mean saturation

[0066] Based on the same window Win(p), convert all pixels RGB to HSV color space and take the arithmetic mean of the S channel.

[0067]

[0068] It is to select the corresponding position within the window. pixels, It corresponds to the S channel of HSV ( Corresponding to H channel, Corresponding to the S channel, (Corresponding to the V channel).

[0069] (3) Brightness statistics

[0070] Based on the same window Win(p), convert all pixels from RGB to HSV color space, and take the median of the V channel:

[0071]

[0072] It is to select the corresponding position within the window. pixels, It corresponds to the V channel of HSV ( Corresponding to H channel, Corresponding to the S channel, (Corresponding to the V channel).

[0073] (4) Contrast

[0074] Based on the same window Win(p), convert all pixels from RGB to HSV color space, and record the largest V channel value of Win(p). The smallest V channel value is The results were obtained using the Michelson contrast calculation method. .

[0075]

[0076] Furthermore, the specific implementation process of obtaining the coloring style similarity matrix in step 9 is as follows: for adjacent pixels and pixels in different coloring regions... Style similarity is calculated using cosine similarity, with a similarity range of [-1, 1]. A simplified formula is as follows:

[0077]

[0078] It means The position in pixels, It means The pixel position.

[0079] Furthermore, the specific implementation process of obtaining the StyleBlendFactor in step 10 is as follows: normalize the range of cosine similarity between style feature vectors from [-1,1] to [0,1] to achieve a standardized StyleBlendFactor.

[0080]

[0081] This is a MixRender parameter that represents the blend intensity, ranging from 0 to 1. It controls the strength of the blend. A larger value results in a smoother blend; a smaller value results in a more pronounced style transition.

[0082] Therefore, for the pixels in the detected adjacent RActor boundary regions in the screen space The highest similarity value within the local window is taken and substituted into the above formula to generate the StyleBlendFactor weight factor for that pixel.

[0083] Furthermore, the specific implementation process of performing the final pixel-level color blending operation in step 11 is as follows: read the WorldColorBuffer and RActorColorBuffer written to the MixRender module in step 7, and perform pixel blending on adjacent RActor boundary regions in the screen space. For the final color mixing, a simplified formula is as follows:

[0084]

[0085] In another aspect, the present invention provides a multi-style blending rendering system for Unreal Engine, used to implement the aforementioned multi-style blending rendering method, including a style material unit, a depth buffer unit, a color buffer unit, a basic blending color buffer unit, a shading style unit, and a multi-style blending rendering output unit.

[0086] The style material unit, based on the Unreal Engine's material editing system, constructs a multi-style parametric post-processing material template and material instance mechanism, and builds an independent and reusable style material set.

[0087] The depth buffer unit, based on the custom depth channel in the Unreal Engine's rendering pipeline, adds a custom template identifier value attribute to the RActor of the custom-style post-processing material in the scene, and obtains a custom depth buffer.

[0088] The color buffer unit colors the world scene and each RActor based on the style material set to obtain color buffers for RActors with different styles.

[0089] The basic blending color buffer unit, based on the scene depth buffer and custom depth buffer obtained from Unreal Engine's GBuffer, performs depth testing and screen space boundary detection to obtain the RActor boundary position buffer. Combined with the RActor's color buffer, the basic blending color buffer is obtained after overlay rendering.

[0090] The shading style unit extracts key visual feature parameters of material instances of different styles based on the basic blending color buffer and the RActor boundary position buffer, and obtains feature vectors of different shading styles.

[0091] The multi-style blending rendering output unit calculates the shading style similarity matrix between style feature vectors based on feature vectors of different shading styles, obtains the style blending weight factor, performs pixel-level color blending operation, and outputs a multi-style blending rendering image.

[0092] Example:

[0093] Step 1: Build multi-style parametric post-processing material templates and their instance mechanisms within the Unreal Engine material editing system. Developers design a series of publicly adjustable parameter sets using HLSL custom nodes, based on different artistic needs (e.g., cartoon style, hand-drawn style, retro style), including tone mapping, edge detection intensity, texture blending method, and noise intensity. Then, the material instance function is used to quickly generate multiple independent style materials, each containing two instances: one for world scene shading and one for RActor shading. This parametric + instance design approach facilitates rapid iteration of style parameters and significantly reduces material compilation times and runtime memory overhead, offering greater flexibility and reusability compared to traditional fixed-surface materials.

[0094] The main reason for using post-processed materials instead of traditional surface materials is that post-processed materials operate across the entire screen space, enabling unified management and blending of multiple objects in the later stages of the rendering pipeline. This facilitates style blending and boundary transitions among multiple RActors in this solution. In contrast, surface materials are only bound to a single object, making it difficult to blend adjacent objects of different styles at the pixel level, which can easily lead to harsh boundaries and complex management. The design approach of using post-processed materials combined with parametric templates and material instances allows developers to quickly iterate on style parameters while significantly reducing material compilation times and runtime memory overhead. Compared to traditional fixed surface materials, it offers greater flexibility, reusability, and blending control.

[0095] Step 2: Introduce a custom depth channel into the Unreal Engine rendering pipeline, adding a custom stencil identifier attribute to Actors that require special styles, and defining it as an RActor. This identifier value serves as a unique stencil identifier for each RActor, and is written to the custom depth buffer and GBuffer in the early stages of rendering. This identifier mechanism based on a custom depth channel fully utilizes the engine's native efficient buffer capabilities, avoiding the performance loss caused by creating additional render targets, and laying the foundation for subsequent accurate classification processing and boundary detection, such as... Figure 3 As shown.

[0096] For example, in a virtual city scene, different identifier values ​​can be assigned to different building groups, characters and vehicles to achieve independent style control.

[0097] Steps 3 and 4: Based on the multi-style parametric post-processing material set built in Step 1, perform independent shading processing on the entire world scene and each RActor. First, RActors are classified using added custom template identifier values, generating a mapping classification set with template identifier values ​​as keys and shading results as values. Then, the corresponding regions are precisely extracted from the RActor's custom rendering template buffer according to the identifier values, and combined with their respective shading effects to finally obtain an independent stylized color buffer for each RActor.

[0098] Because in traditional surface material schemes, all objects usually share the same rendering pass, it is difficult to achieve independent high-quality shading of different styles; while this method, by combining post-processed materials with custom template identifier values, enables the world scene to use a set of global materials for basic shading, while allowing each RActor to use its own exclusive style material instance for independent shading.

[0099] The advantage of this approach is that it ensures the consistency of the overall scene style while allowing different RActors to present completely independent artistic styles (such as a cartoon-style character and a hand-drawn style scene architecture existing in the same frame). By combining the mapping classification set and the custom rendering template buffer, the rendering results of each RActor can be extracted quickly and accurately, while providing clean, high-quality source data for step 7.

[0100] Step 5: Construct the MixDepthTester submodule to perform joint comparison and testing of scene depth information in GBuffer and custom depth information of RActor, achieving correct rendering order. This module uses differentiated depth determination rules for different material instances (scene instances and RActor instances) of the same style, effectively handling complex perspective situations such as occlusion and semi-transparency, with the following effect: Figure 2 As shown.

[0101] For example, when a semi-transparent cartoon-style foreground tree RActor intersects with a building in a hand-drawn style scene at a certain depth, the module can accurately determine the priority rendering order, avoid incorrect perspective problems, and greatly improve the rendering stability in multi-style scenes.

[0102] Step 6: Build a MixRender management module in the post-processing rendering channel, store the depth sorting results obtained in Step 5 into a dedicated cache (PrimitiveSortListCache), and extract the boundary position information of RActor from the RActor custom rendering template buffer through the screen space boundary detection algorithm, and store it into the boundary position buffer (RActorBoundaryLocationBuffer) to provide accurate spatial guidance for obtaining the boundary pixels in the subsequent Step 8.

[0103] Step 7: Sample the world scene using BasePass to obtain the scene color buffer (WorldColorBuffer), and simultaneously overlay the stylized color buffers of each RActor according to the sorting result to obtain the basic blend color buffer (RActorColorBuffer).

[0104] Step 8: Within the MixRender module, the boundary regions of adjacent RActors with different styles are quickly located using screen space sampling, based on the boundary position information recorded in the RActorBoundaryLocationBuffer. Specifically, for each pixel marked as 1 (boundary pixel) in the boundary position buffer, an equal distance N is extended outwards from that pixel. This N is the previously mentioned window size; essentially, each square represents a window. Adjacent pixel pairs belonging to different style regions are then selected to determine the set of boundary region pixels requiring blending. Subsequently, key visual features (primary color hue, saturation, brightness, contrast) are extracted from these detected boundary region pixels using a local sliding window approach to construct feature vectors. This window size N can be adjusted as a public parameter of the MixRender module, allowing developers to strike a balance between blending effects and performance consumption based on project requirements.

[0105] Steps 9 and 10: Based on the extracted feature vectors, the cosine similarity between adjacent regions is calculated in real time to obtain a style similarity matrix. Combined with an adjustable blending intensity parameter K, a StyleBlendFactor weight factor is dynamically generated for each boundary pixel. The value of K can be adjusted between 0 and 1 according to project requirements; a smaller value results in a more pronounced transition, while a larger value results in a smoother transition. A value of 0 simulates no transition.

[0106] Step 11: The MixRender module reads the base color buffer data and performs pixel-level weighted blending of adjacent style colors based on the calculated dynamic weighting factors, ultimately outputting a high-quality multi-style blended rendering image, as shown in the image. Figure 4 As shown. This pixel-level dynamic blending mechanism is one of the core innovations of this invention. It makes the connection between different style areas no longer a simple hard cut, but an intelligent and smooth transition based on actual visual characteristics.

[0107] For example, at the boundary between cartoon-style characters and realistic environments, the edges of the characters will naturally blend into the brightness and tone of the background, presenting a natural fusion effect like a professional work of art.

[0108] Experimental verification:

[0109] To verify the effectiveness of the method of the present invention, the following tests were conducted in the embodiments.

[0110] The test environment was configured as follows: Unreal Engine 5.2, a complex test scene containing objects of various styles (cartoon characters with animation, hand-drawn buildings, and semi-transparent water) (DrawCall≈4000, PrimitiveCount≈1 million), the rendering graphics API was DirectX12, and the resolution was 1920×1080.

[0111] Testing method: Comparative experiments were used for verification, with a maximum score of 5.

[0112] Comparative experimental setup:

[0113] (1) Control group: traditional surface material scheme.

[0114] (2) Experimental group: Complete technical solution of the present invention (window size N=5, mixing intensity K=0.65).

[0115] Table 1

[0116]

[0117] Combination Figure 5 As shown in Table 1, compared with traditional surface material schemes, the method of this invention, while having a slightly lower average frame rate, improves the boundary transition naturalness score from 0 to 5 points, and the overall visual quality is also significantly improved. Because traditional surface material schemes completely lack the function of blending transitions between styles, there is still a harsh sense of boundary between adjacent areas of different styles; while this invention, based on screen space visual feature extraction, style similarity calculation, and dynamic weight blending technology, and adjusting the blending intensity through module parameter K, achieves efficient and convenient natural and smooth transitions.

[0118] The experiments fully verified the effectiveness and superiority of this invention in multi-style hybrid rendering and visual expressiveness. Comprehensive test results show that this invention has good practicality and scalability.

Claims

1. A multi-style hybrid rendering method for Unreal Engine, characterized in that, Includes the following steps: Step 1: Based on the Unreal Engine material editing system, construct a multi-style parametric post-processing material template and material instance mechanism to build an independent and reusable style material set; Step 2: Based on the custom depth channel in the Unreal Engine rendering pipeline, the Actor that requires custom-style post-processing materials is called RActor. Add a custom template identifier value attribute to the RActor of the custom-style post-processing materials in the scene and obtain the custom depth buffer. Step 3: Colorize the world scene and each RActor based on the style material set to obtain color buffers for RActors of different styles; Step 4: Based on the scene depth buffer and custom depth buffer obtained from Unreal Engine's GBuffer, perform depth testing and screen space boundary detection to obtain the RActor boundary position buffer. Combine the RActor's color buffer and overlay rendering to obtain the basic blending color buffer. Step 5: Based on the basic blending color buffer and RActor boundary position buffer, extract the key visual feature parameters of material instances of different styles to obtain feature vectors of different shading styles; Step 6: Based on the feature vectors of different shading styles, calculate the shading style similarity matrix between the style feature vectors, obtain the style mixing weight factor, perform pixel-level color mixing operation, and output a multi-style mixed rendering image.

2. The multi-style hybrid rendering method for Unreal Engine according to claim 1, characterized in that, Step 1 specifically involves: constructing a multi-style parametric post-processing material template and material instance mechanism based on the Unreal Engine material editing system; constructing a set of visual effect parameters for different art styles through HLSL custom nodes and dynamic material parameters; and obtaining an independent and reusable set of style materials.

3. The multi-style hybrid rendering method for Unreal Engine according to claim 2, characterized in that, Step 2 is specifically implemented as follows: the Actor of the custom style post-processing material is called RActor, the custom template identifier value attribute of each RActor is used as its unique template identifier information, and a custom rendering template buffer of the RActor is obtained by writing to the custom depth channel, which is composed of the buffer result of the custom depth channel and the custom template identifier value. The engine writes to the custom depth buffer through the custom depth channel and writes to the GBuffer.

4. The multi-style hybrid rendering method for Unreal Engine according to claim 3, characterized in that, The specific implementation process of step 3 is as follows: Step 3.1: Shade the world scene and each RActor based on the style material set to obtain a mapping set of RActors with custom template identifier values ​​as keys and shading effects as values; Step 3.2: Based on the mapping category set and the RActor custom rendering template buffer, obtain the corresponding RActor custom rendering template buffer area through the key-value pairs of the mapping category set, and combine the RActor custom rendering template buffer area with its shading effect to obtain the color buffer of RActor with different styles.

5. The multi-style hybrid rendering method for Unreal Engine according to claim 4, characterized in that, The specific implementation process of step 4 is as follows: Step 4.1: Based on the scene depth buffer obtained from Unreal Engine's GBuffer and Ractor's custom depth buffer, build the MixDepthTester module to perform depth testing and obtain the correct rendering order of the scene and Ractor. Step 4.2: Based on the Unreal Engine's post-processing rendering pipeline, build the MixRender module to manage mixed rendering, write the correct rendering sorting results of the RActors in the scene into the module cache, and write the custom rendering template buffer of the RActors into the module buffer by obtaining the RActor boundary position buffer through the screen space boundary detection algorithm. Step 4.3: Based on the Unreal Engine's BasePass, sample the world scene, obtain the world scene color buffer, write it to the MixRender module cache, and write the color buffers of different styles of RActors to the MixRender module cache. After overlay rendering, obtain the basic blend color buffer.

6. The multi-style hybrid rendering method for Unreal Engine according to claim 5, characterized in that, In step 4.1, MixDepthTester is constructed for depth testing. This is achieved by establishing a joint determination mechanism between the scene depth buffer and the custom depth buffer. The specific implementation process is as follows: For the same style material A, the depth comparison standard is different when using material instance A1 as scene shading and when using material instance A2 as RActor shading. Based on the depth test between the RActor shaded by material B and the scene shaded by material instance A1, when the custom depth buffer is greater than the scene depth buffer, i.e. the RActor is occluded by the scene, the result of rendering A1 is returned first; otherwise, the result of rendering B is returned first. Based on the depth test of the scene shaded by material B and the RActor shaded by material instance A2, when the custom depth buffer is greater than the scene depth buffer, that is, the RActor is occluded by the scene, the result of rendering B is returned first, otherwise the result of rendering A2 is returned first.

7. A multi-style hybrid rendering method for Unreal Engine according to claim 6, characterized in that, The specific implementation process for extracting the key visual feature parameters of material instances of different styles in step 5 is as follows: In the MixRender module, style feature vectors are extracted from pixels p in the boundary region of adjacent RActors in screen space. : ; The definitions and extraction of its components are as follows: A fixed-size local window of equal length is set for a pixel p in the boundary region of adjacent RActors in the screen space for calculation. The calculation method is window sliding. The window size is odd and ensures that the lengths of all four sides are the same. The variable of window size is exposed as a parameter of the MixRender module. The window size determines the performance consumption. The current pixel is p, the window is Win(p), and the window length is N; For color statistics: Based on the same window Win(p), convert all pixels RGB to HSV color space, perform histogram statistics on the H channel, and take the weighted average of the three most frequent hues as the color value. ; Saturation mean: Based on the same window Win(p), convert all pixels RGB to HSV color space, and take the arithmetic mean of the S channel as the average value. ; Brightness statistics: Based on the same window Win(p), all pixels are converted from RGB to HSV color space, and the median of the V channel is taken as the value. ; Contrast Ratio: Based on the same window Win(p), convert all pixels from RGB to HSV color space, and record the maximum V channel value of Win(p). The smallest V channel value is Calculated: 。 8. A multi-style hybrid rendering method for Unreal Engine according to claim 7, characterized in that, Step 6 is implemented as follows: Step 6.1: Based on the obtained feature vectors of different coloring styles, calculate the cosine similarity between style feature vectors in real time to obtain the coloring style similarity matrix; Step 6.2: Based on the obtained coloring style similarity matrix, dynamically obtain the StyleBlendFactor style blending weight factor according to the similarity matrix; Step 6.3: Based on the StyleBlendFactor style blending weight factor, perform the final pixel-level color blending operation in the MixRender module to finally output a multi-style blended rendering image.

9. A multi-style hybrid rendering method for Unreal Engine according to claim 8, characterized in that, The specific implementation process of obtaining the StyleBlendFactor blending weight factor in step 6.2 is as follows: normalize the range of cosine similarity between style feature vectors from [-1,1] to [0,1] to achieve a standardized StyleBlendFactor blending weight factor.

10. A multi-style blending rendering system for Unreal Engine, used to implement the multi-style blending rendering method according to any one of claims 1 to 9, characterized in that, Includes the following units: The Style Material Unit is a material editing system based on Unreal Engine. It constructs multi-style parametric post-processing material templates and material instance mechanisms to build independent and reusable style material sets. The Depth Buffer Unit is a custom depth channel in the Unreal Engine rendering pipeline. Actors that require custom-style post-processing materials are called RActors. Custom template identifier values ​​are added to the RActors of custom-style post-processing materials in the scene to obtain the custom depth buffer. The color buffer unit colors the world scene and each RActor based on the style material set, obtaining color buffers for RActors with different styles; The basic blending color buffer unit is based on the scene depth buffer and custom depth buffer obtained from Unreal Engine's GBuffer. It performs depth testing and screen space boundary detection to obtain the RActor boundary position buffer. Combined with the RActor's color buffer, the basic blending color buffer is obtained after overlay rendering. The shading style unit, based on the basic blending color buffer and RActor boundary position buffer, extracts key visual feature parameters of material instances with different shading styles to obtain feature vectors of different shading styles; The multi-style blending rendering output unit calculates the shading style similarity matrix between the feature vectors of different shading styles, obtains the style blending weight factor, performs pixel-level color blending operations, and outputs a multi-style blending rendering image.

Citation Information

Patent Citations

  • Sketch style scene rendering method and device and storage medium

    CN114913283A

  • Camera capture method and assembly based on unreal engine

    CN121639943A