A method for achieving edge illumination of a model, and a computer-readable medium

CN122574181APending Publication Date: 2026-08-14SHENGJI INFORMATION TECH SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]1.资源开销大:Unity后处理发光通常需要额外的渲染步骤和计算,增加GPU和CPU的负担,尤其是在移动设备上,可能会导致性能下降或帧率降低

Benefits of technology

[0016]本申请提供的实现模型边缘发光的技术方案,通过借助游戏开发引擎的虚拟相机和渲染纹理对象(RenderTexture)实现场景和目标模型的分离,并配合简洁的二维窗口偏移采样方法获取目标模型的边缘发光区域对应的显示掩码,然后借助贴面与目标模型在场景中进行合并显示。基于上述原理,本申请提供的上述技术方案不需要增加CUP开销进行数据亮区域检测,采用的二维窗口偏移采样方法可以使发光区域过度柔和自然,更重要的是其完全可以由GPU自身实现;另外,显示效果在不同硬件平台上的表现差异可以便捷地通过渲染参数进行调试。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0005271091690000011
    Figure HDA0005271091690000011
Patent Text Reader

Abstract

This application discloses a method for achieving edge glowing of a model and a computer-readable storage medium. The method includes: rendering a target model separately and saving it to a rendering texture object; using a shader to perform window-offset grayscale sampling on the data in the rendering texture object to generate an edge blurring mask for the target model; and overlaying the edge blurring mask onto the target model for rendering to produce a display effect of edge glowing of the target model. The technical solution provided by this application can achieve a soft and blurred edge glow around a model (character or object), significantly enhancing the visual appeal of the displayed object. Simultaneously, it reduces GPU resource consumption and does not require additional CPU overhead, greatly optimizing the operation of games or 3D films on portable devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing in the production of digital film and television and games. Specifically, it relates to a method for achieving edge illumination of a model and a computer-readable medium. Background Technology

[0002] In game or film development, in order to meet the visual prominence requirements of characters and other models in specific scenes, it is often necessary to implement edge glowing of the models in specific scenes.

[0003] Unity post-processing is the primary method for achieving edge glow in existing models. Unity post-processing typically includes three steps: bright area detection, blurring, and image compositing. Bright area detection extracts high-brightness regions from the original image. This is usually done by calculating the brightness value (grayscale value) of each pixel and comparing it to a set brightness threshold; pixels with brightness values ​​exceeding the threshold are considered bright areas. Blurring refers to blurring the extracted bright areas to produce a glowing or flooding effect. Gaussian blur is commonly used because it produces a smooth and natural blur effect. The degree of blurring can be controlled by adjusting parameters such as the blur radius or standard deviation. Finally, image compositing combines the blurred bright area image with the original image. This is usually achieved by superimposing the RGB values ​​of the blurred image with those of the original image; the superposition can be a simple addition or a more complex weighted summation.

[0004] Unity post-processing for glowing effects has the following shortcomings:

[0005] 1. High resource consumption: Unity post-processing glow usually requires additional rendering steps and calculations, increasing the burden on the GPU and CPU, especially on mobile devices, which may lead to performance degradation or reduced frame rate.

[0006] 2. Prone to distortion: When dealing with complex lighting and shadow interactions, it cannot fully simulate the glowing phenomena in the real world. Unity's post-processing of glowing often relies on screen-space techniques, resulting in glowing effects that look unnatural or distorted from certain perspectives. For example, due to RGB color overlay, areas of the image whose colors are closer to white are more prone to "explosion," making the glowing effect more pronounced.

[0007] 3. Difficult to debug: Since post-processing glow effects involve multiple rendering channels and parameter adjustments, debugging and optimizing these effects can be relatively complex, requiring developers to have certain knowledge of graphics and rendering.

[0008] 4. Compatibility issues: Different hardware and rendering pipelines may have varying degrees of support for post-processing glow effects, which may lead to inconsistent results or performance differences on different platforms.

[0009] In conclusion, while Unity's post-processing glow effects can add visual appeal to games or applications, their use requires a careful balance of performance overhead, display quality, debugging difficulty, and compatibility issues. Developers should choose the appropriate glow effect implementation method based on the specific needs of their project and the characteristics of the target platform. Summary of the Invention

[0010] In view of this, this application provides a technical solution for achieving edge illumination of a model without increasing CPU overhead. The edge illumination display effect of the model implemented using the technical solution provided in this application is soft and natural, and the performance differences on different hardware platforms can be easily adjusted by one or two parameters.

[0011] On one hand, the technical solution provided in this application is a method for achieving edge glowing of a model. The method includes: creating an auxiliary camera in a game development engine to render the target model separately and save it to a render texture object; using a shader to perform window-offset grayscale sampling on the data in the render texture object to generate an edge blurring mask for the target model; and using the edge blurring mask as a mask for rendering the target model to produce a display effect of edge glowing of the target model. The game development engine includes, but is not limited to, the Unity engine.

[0012] Furthermore, before creating the auxiliary camera in the game development engine, the method further includes: importing the target model into the target scene in the game development engine and setting it to the Boolm layer, and setting the main camera not to render the Boolm layer. The step of creating the auxiliary camera to render the target model separately and save it to a rendering texture object includes: creating a rendering texture object, assigning the created auxiliary camera to the rendering texture object, and setting it to render only the Boolm layer. Through the above settings, scene rendering and model rendering are separated using different cameras, so that the GPU can be used to extract the mask for edge illumination of the target model later.

[0013] Further, the step of using a shader to perform window-offset grayscale sampling on the data in the rendered texture object includes: creating a shader, setting the shader to Custom / RTBloom, and custom programming it to perform window-offset grayscale sampling on the data in the rendered texture object to generate the edge blur mask of the target model. Specifically, the window-offset grayscale sampling is implemented as follows: the sampling value of any pixel is the average of the sum of all pixel grayscale values ​​within the first sampling window range centered on that position in the rendered texture object, and the sum of all pixel grayscale values ​​within the second sampling window range centered on that position in the left and right directions, divided by a custom blur coefficient. The width of the first sampling window and the width of the second sampling window can be the same or different, and can be adjusted or set according to the actual effect.

[0014] Furthermore, the step of using the edge blur mask as a mask for rendering the target model to produce an edge-blurred glowing display effect for the target model includes: assigning the edge blur mask to the alpha channel of the rendered texture object, and rendering the rendered texture object in the target scene in the form of a patch using a material sphere to achieve edge-blurred glowing display of the target model in the target scene. The color, brightness, etc. of the edge glow of the target model can be adjusted by setting the rendering parameters of the blur mask area.

[0015] On the other hand, corresponding to the above-described method for implementing edge illumination of the model, this application also provides a computer-readable medium. The computer-readable medium stores program code, which, when executed by a computer, implements the above-described method for implementing edge illumination of the model.

[0016] The technical solution for achieving edge illumination of a model provided in this application separates the scene and the target model by utilizing the virtual camera and render texture objects of a game development engine. It then employs a simple two-dimensional window offset sampling method to obtain the display mask corresponding to the edge-illuminating area of ​​the target model, and finally merges the mask with the target model in the scene using a texture mapping technique. Based on the above principles, the technical solution provided in this application does not require additional CPU overhead for bright area detection. The two-dimensional window offset sampling method used allows for a smooth and natural transition in the illuminating area, and more importantly, it can be entirely implemented by the GPU itself. Furthermore, the differences in display effects across different hardware platforms can be easily adjusted through rendering parameters.

[0017] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A flowchart of one embodiment of the method for implementing edge illumination of the model provided in this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely explained below with reference to the accompanying drawings.

[0021] As described herein, the embodiments described are merely some, not all, of the embodiments of the invention. The components of the embodiments of the invention described and illustrated herein can generally be arranged and designed in a variety of different configurations.

[0022] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0023] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0024] In the description of this invention, it should be noted that the terms "inner," "outer," "upper," "lower," "vertical," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of the invention is in use. They are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. In addition, the terms "first," "second," "third," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0025] Some embodiments of the present invention will now be described in detail with reference to the accompanying drawings. Unless otherwise specified, features in the following embodiments can be combined with each other.

[0026] A first aspect of the present invention provides a method for achieving edge illumination of a model. Figure 1 A flowchart of one embodiment of the method for implementing edge illumination of the model provided in the application. Figure 1 As shown, the method for achieving edge illumination of the model includes the following steps:

[0027] S1 uses the game development engine to import the target model into the target scene and set it to the Boolm layer, while setting the main camera not to render the Boolm layer. For example, in Unity, you can import a target model such as a character or object into the target scene, then designate the target model as the Boolm layer for the entire display interface, and set the main camera to only render the target scene and not the target model.

[0028] S2, create an auxiliary camera to render the target model separately and save it to a RenderTexture object. This step is implemented as follows: first, create a RenderTexture object, then assign the created auxiliary camera to the RenderTexture object and set it to render only the Boolean layer. Through the above settings, scene rendering and model rendering are captured separately using different cameras. The created auxiliary camera stores the rendering result of the target model in the RenderTexture, so that the GPU can be used to extract the mask of edge glow of the target model later.

[0029] S3. Create a shader and customize it to perform window-offset grayscale sampling on the data in the render texture object to generate the edge blur mask of the target model. Create a shader in the game development engine and customize it. Then, we can program this shader to perform window-offset grayscale sampling on the data in the render texture object to generate the edge blur mask of the target model.

[0030] The window-offset grayscale sampling is implemented in a custom program to perform grayscale sampling on the data in the rendered texture object. The entire sampling algorithm needs to be concise and can be processed entirely by the GPU without adding extra CPU overhead. Specifically, the window-offset grayscale sampling is implemented as follows: the sample value of any pixel is the average of the sum of all pixel grayscale values ​​within the first sampling window centered on that position in the rendered texture object in the upward and downward directions, and the sum of all pixel grayscale values ​​within the second sampling window centered on that position in the left and right directions, divided by a custom blur coefficient. The width of the first sampling window and the width of the second sampling window can be the same or different, and can be adjusted or set according to the actual effect. Because the above window-offset grayscale sampling takes the average value of the surrounding pixels in the upward, downward, left, and right directions, the "fluctuation" between the sample values ​​of several consecutive pixels obtained when the two-dimensional window moves as a whole is small, ensuring a soft and natural subsequent glow display.

[0031] S4, the edge blurring mask is used as a mask for rendering the target model to produce an edge blurring and glowing display effect of the target model.

[0032] Further, step S4 can be implemented as follows: assigning the edge blur mask to the alpha channel of the rendered texture object, and setting / adjusting the rendering parameters of the edge blur mask region. Then, creating a material, setting the shader to "Custom / RTBloom", and assigning the rendered texture object to the material. Finally, creating a plane, assigning the material to this plane, and rendering the rendered texture object in the target scene to achieve edge blur and glow display of the target model in the target scene. The color, brightness, etc. of the edge glow of the target model can be adjusted by setting the rendering parameters of the blur mask region.

[0033] Corresponding to the above method, a second aspect of this application also provides a computer-readable medium. The computer-readable medium stores program code that, when executed by a computer, implements the edge-emitting method of the implementation model described above. The computer-readable medium includes, but is not limited to, hard disks, optical drives, ROMs, RAMs, and various forms of network storage devices.

[0034] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

Claims

1. A method for achieving edge illumination of a model, characterized in that, The method includes: creating an auxiliary camera in a game development engine to render the target model separately and save it to a rendering texture object; using a shader to perform window offset grayscale sampling on the data in the rendering texture object to generate an edge blur mask for the target model; and using the edge blur mask as a mask to render the target model to produce an edge blur and glow display effect for the target model.

2. The method as described in claim 1, characterized in that, The game development engine mentioned includes the Unity engine.

3. The method as described in claim 1, characterized in that, Before creating the auxiliary camera in the game development engine, the method further includes: importing the target model into the target scene in the game development engine and setting it to the Boolm layer, and setting the main camera not to render the Boolm layer.

4. The method as described in claim 3, characterized in that, The step of creating an auxiliary camera to render the target model separately and save it to a rendering texture object includes: creating a rendering texture object, assigning the created auxiliary camera to the rendering texture object, and setting it to render only the Boolm layer.

5. The method as described in claim 4, characterized in that, The step of using a shader to perform window offset grayscale sampling on the data in the rendered texture object includes: creating a shader and custom programming the shader to perform window offset grayscale sampling on the data in the rendered texture object to generate an edge blur mask for the edge glowing display of the target model.

6. The method as described in claim 1 or 5, characterized in that, The window offset grayscale sampling is implemented as follows: the sampling value of any pixel is the average of the sum of all pixel grayscale values ​​within the first sampling window range centered on that position in the rendered texture object, and the sum of all pixel grayscale values ​​within the second sampling window range centered on that position in the left and right directions, divided by a custom blur coefficient.

7. The method according to any one of claims 1, 4-5, characterized in that, The step of using the edge blur mask as a mask for rendering the target model to produce an edge blur glow display effect of the target model includes: assigning the edge blur mask to the Alpha channel of the rendering texture object, and setting or adjusting the rendering parameters of the blur mask area; rendering the rendering texture object in the target scene in the form of a material ball to achieve the edge blur glow display of the target model in the target scene.

8. The method as described in claim 7, characterized in that, The method further includes adjusting the color and brightness of the edge glow of the target model by setting the rendering parameters of the blurred mask region.

9. A computer-readable medium, characterized in that, The computer-readable medium contains program code that, when executed by a computer, implements the method for achieving edge illumination of a model as described in any one of claims 1-8.