Method and device for generating halo effect, electronic equipment and storage medium

CN116363294BActive Publication Date: 2026-10-30NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310187831.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2026-10-30
Estimated Expiration
2043-02-22

AI Technical Summary

Technical Problem

[0003]现有技术在渲染游戏中的光晕效果时,通常是通过对不同表现效果的贴图进行采样堆叠呈现,这种方式由于需要采样多张贴图,导致渲染批次增加,并且由于贴图的样式固定,只能改变光晕在颜色维度上的效果

Benefits of technology

[0010]上述光晕效果的生成方法、装置、电子设备和存储介质,响应于光晕生成指令,确定目标光晕的至少一个目标效果参数;基于所述目标效果参数对原始输出像素进行光晕形状生成,得到光晕形状数据;对所述光晕形状数据进行所述至少一个目标效果参数的光晕效果计算,得到目标光晕数据,以基于所述目标光晕数据渲染目标光晕效果。该方式中,通过原始输出像素生成光晕形状数据后,对光晕形状数据进行不同光晕效果维度的目标效果参数的光晕效果计算,从而得到包含至少一种目标光晕效果的目标光晕数据,使得光晕效果能够在同一个渲染批次中渲染完成,并且能够通过调整效果参数调整不同维度的光晕效果,从而增加可变的光晕效果维度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116363294B_ABST
    Figure CN116363294B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for generating a light halo effect, electronic equipment and a storage medium; wherein the method comprises: in response to a light halo generation instruction, determining at least one target effect parameter of a target light halo; based on the target effect parameter, generating a light halo shape for an original output pixel to obtain light halo shape data; performing light halo effect calculation on the light halo shape data according to at least one target effect parameter to obtain target light halo data, and rendering a target light halo effect based on the target light halo data. This way makes the light halo effect be able to be rendered in the same rendering batch, and the light halo effect of different dimensions can be adjusted by adjusting the effect parameters, thereby increasing the variable dimension of the light halo effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rendering technology, and in particular to a method, apparatus, electronic device, and storage medium for generating a halo effect. Background Technology

[0002] A halo effect is a special rendering effect that can enhance the aesthetics and immersive experience of a game.

[0003] Current technologies for rendering halo effects in games typically involve sampling and stacking textures with different effects. This method requires sampling multiple textures, leading to an increase in rendering batches. Furthermore, because the texture styles are fixed, only the color dimension of the halo can be changed. Therefore, existing halo effect rendering technologies suffer from the technical problems of multiple rendering batches and a limited range of variable halo effect dimensions. Summary of the Invention

[0004] In view of this, the object of the present invention is to provide a method, apparatus, electronic device and storage medium for generating halo effects, so as to reduce the rendering batches of halo effects and increase the variable dimensions of halo effects.

[0005] In a first aspect, embodiments of the present invention provide a method for generating a halo effect, the method comprising: in response to a halo generation instruction, determining at least one target effect parameter for a target halo; generating a halo shape for an original output pixel based on the target effect parameter to obtain halo shape data; performing halo effect calculation on the halo shape data using the at least one target effect parameter to obtain target halo data, and rendering a target halo effect based on the target halo data.

[0006] Secondly, embodiments of the present invention provide a halo effect generation apparatus, the apparatus comprising: a response module, configured to determine at least one target effect parameter of a target halo in response to a halo generation command; a generation module, configured to generate a halo shape from an original output pixel based on the target effect parameter to obtain halo shape data; and a calculation module, configured to perform halo effect calculation on the halo shape data using the at least one target effect parameter to obtain target halo data, and to render a target halo effect based on the target halo data.

[0007] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to realize the above-mentioned method for generating halo effects.

[0008] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-mentioned method for generating halo effects.

[0009] The embodiments of the present invention bring the following beneficial effects:

[0010] The aforementioned method, apparatus, electronic device, and storage medium for generating halo effects, in response to a halo generation command, determine at least one target effect parameter for the target halo; generate halo shape data by generating halo shape data from the original output pixels based on the target effect parameter; perform halo effect calculations on the halo shape data using the at least one target effect parameter to obtain target halo data, and then render the target halo effect based on the target halo data. In this method, after generating halo shape data from the original output pixels, halo effect calculations are performed on the halo shape data using target effect parameters of different halo effect dimensions, thereby obtaining target halo data containing at least one target halo effect. This allows the halo effect to be rendered in the same rendering batch, and allows adjustment of different dimensions of the halo effect by adjusting the effect parameters, thereby increasing the variable dimensions of the halo effect.

[0011] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0012] 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

[0013] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0014] Figure 1 This is a flowchart of one embodiment of the method for generating halo effects according to the present invention;

[0015] Figure 2 This is the first schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0016] Figure 3This is a flowchart of another embodiment of the method for generating halo effects according to the present invention;

[0017] Figure 4 This is a second schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0018] Figure 5 This is the third schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0019] Figure 6 This is the fourth schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0020] Figure 7 This is the fifth schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0021] Figure 8 This is the sixth schematic diagram of the method for generating halo effects in an embodiment of the present invention;

[0022] Figure 9 A schematic diagram of a halo effect generation device provided in an embodiment of the present invention;

[0023] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1One embodiment of the method for generating halo effects in this invention includes:

[0027] Step S10: In response to the halo generation command, determine at least one target effect parameter of the target halo;

[0028] It is understandable that when the game engine renders the halo effect in real time, it responds to the halo generation command of the game engine and obtains at least one target effect parameter of the target halo. In one implementation, the at least one target effect parameter of the target halo is dynamically set in the game engine. It should be noted that one halo corresponds to at least one target effect parameter of one target halo. There can be one or more target effect parameters. One target halo effect can correspond to one target effect parameter or more than one target effect parameter. That is, one target effect parameter can affect one halo effect, and one halo effect can also be affected by more than one target effect parameter. Here, one target effect parameter is used to indicate a halo attribute. A target halo effect refers to the effect presented by one or more halo attributes, such as halo size attribute presenting halo effects of different sizes, halo color attribute presenting halo effects of different colors, etc., which are not limited here.

[0029] In one implementation, at least one target effect parameter of the target halo includes, but is not limited to, at least one of the following: halo center color value, halo color value, halo color warmth attribute, edge softness index, halo size coefficient, and number of halo layers. The target halo can be a single-layer halo or a combination of more than one layer of halos. If the target halo is a single-layer halo, then at least one target effect parameter can include at least one target halo effect of the single-layer halo. If the target halo contains more than one layer of halos, then at least one target effect parameter can include at least one target effect parameter corresponding to each halo layer, or at least one target effect parameter corresponding to a single halo layer. The at least one target effect parameter corresponding to a single halo layer can be applied to all halo layers by means of reuse or inheritance, which is not limited here.

[0030] In one implementation, the halo generation instruction generates halo effects for a single rendering batch. This means the target halo data is generated within the same rendering batch, avoiding the waste of rendering resources caused by batch rendering. It's understandable that in game engines, draw calls are a crucial performance metric, directly impacting overall game performance. A draw call is when the Central Processing Unit (CPU) calls a Graphics Application Programming Interface (API), such as OpenGL, to instruct the GPU to perform graphics drawing. One draw call represents one graphics drawing command, and one draw call constitutes one rendering batch. Due to the overhead of CPU and GPU rendering state switching caused by draw calls, batch merging is often used to reduce the number of draw call calls. The essence of batch merging is to ensure consistent rendering states of consecutive nodes during a single frame's rendering process, merging as much node data as possible and submitting it all at once. This reduces the number of graphics drawing command calls, lowers the performance overhead of graphics API calls, and also avoids frequent GPU rendering state switching.

[0031] Step S20: Generate halo shape data by performing halo shape generation on the original output pixels based on the target effect parameters;

[0032] It should be noted that the preset halo shader is used to render the target halo effect. It is a custom smart halo shader that can be applied to rendering scenarios other than game engines, such as animation rendering and image rendering, etc., without specific limitations here. It can be understood that the raw output pixels are the raw output data of the halo shader, which can be determined by the game scene in the game engine from which the halo effect is to be generated, such as vertex attributes in the game scene, without specific limitations here. It can be understood that the raw output pixels contain all the attribute values ​​of the raw output pixels, such as color attributes, coordinate attributes, etc., without specific limitations here. In this embodiment, the preset halo shader resets the halo shape attributes of the attribute values ​​in the raw output pixels to obtain the halo shape data.

[0033] In one implementation, to facilitate the generation of halo effects and to facilitate the overlay of target halo data with other effects in the game engine, such as Figure 2As shown, the halo shape data visually appears as a circular-to-square image with a white center and black edges, but it is actually UV coordinate data with set color attributes. It's important to note that the halo shape data is not obtained by sampling any texture; rather, it is generated by setting the color attributes of the original output pixels. Therefore, the halo shape data has infinite precision and is faster to render than texture sampling, thus improving the efficiency of halo effect generation. Understandably, when setting the color attributes, color values ​​in the RGB (red, green, blue) color space are used, making halo shape generation faster and more intuitive.

[0034] In one implementation, different color attributes are set for the UV coordinate center and UV coordinate endpoints of the original output pixels (e.g., the UV coordinate center is set to white and the UV coordinate endpoints are set to black). Then, using the UV coordinate center as the center point, a maximum inscribed circle is determined. A linear gradient is applied to the maximum inscribed circle, and color attributes are set for pixels outside the maximum inscribed circle (e.g., set to black), resulting in halo shape data. It should be noted that the halo shape data is the shape data of a single-layer halo and is the basic data for subsequent halo effect calculations.

[0035] Step S30: Calculate the halo effect of at least one target effect parameter on the halo shape data to obtain target halo data, and render the target halo effect based on the target halo data.

[0036] In this embodiment, the preset halo shader includes a preset calculation algorithm for halo effects. The halo shader calculates the halo effect of the halo shape data by passing in at least one target effect parameter, thereby obtaining target halo data. The target halo data visually presents at least one target halo effect, such as a multi-layered halo effect, a halo effect with a target color, a halo effect with blurred edges, or a halo effect with solid edges, etc. The specific effects are not limited here.

[0037] In one implementation, at least one target effect parameter set by the engine is obtained through the halo effect calculation interface of the halo shader, and the halo effect is calculated on the halo shape data using the at least one target effect parameter to obtain target halo data. This implementation uses the interface exposed by the shader to input effect parameters and calculate halo effects, which can flexibly and efficiently generate halo effect-related data, thereby improving the flexibility of halo effect production.

[0038] The halo effect generation method provided in the above embodiments generates halo shape data by generating halo shape data from the original output pixels, and then calculates the halo effect of the target effect parameters of different halo effect dimensions on the halo shape data, thereby obtaining target halo data containing at least one target halo effect, so that the halo effect can be rendered in the same rendering batch, and the halo effect of different dimensions can be adjusted by adjusting the effect parameters, thereby increasing the variable halo effect dimensions.

[0039] Please see Figure 3 Another embodiment of the method for generating halo effects in this invention includes:

[0040] Step S301: In response to the halo generation command, determine at least one target effect parameter of the target halo;

[0041] The execution process of step S301 is similar to that of step S10, and will not be described in detail here.

[0042] Step S302: Set the first initial color value of the coordinate origin and the second initial color value of the coordinate interval endpoints for the original output pixels to obtain the initial color value data;

[0043] In this step, to obtain the halo shape, the origin of the original output pixel is first set to a first initial color value using the halo shader, and the endpoints of the coordinate interval are set to a second initial color value, thus obtaining initial color value data. The original output pixel is the output pixel in uv coordinates, with the U-direction coordinate ranging from [0,1] to [0,1], and the V-direction coordinate also ranging from [0,1]. The endpoints of the coordinate interval include [0,1], [1,0], and [1,1], and the origin is [0,0]. For example, setting the origin [0,0] of the original output pixel to black (a first initial color value), and setting the endpoints [0,1], [1,0], and [1,1] to white (a second initial color value), the resulting initial color value data, after the smooth transition processing in step S304, appears visually as follows: Figure 4 As shown, the effect is similar to 1 / 4 of the halo shape, and the complete halo shape can be obtained through subsequent coordinate transformations.

[0044] Step S303: Perform center offset and magnification on the initial color value data to obtain coordinate transformation data;

[0045] In this step, to obtain a complete halo shape, the 1 / 4 halo shape data obtained in step S302 is shifted at the center and magnified by a factor. Since the UV coordinate data is infinitely extended bidirectional two-dimensional data, a complete halo shape can be obtained through this center shift and magnification. For example, subtracting 0.5 from the initial color value data and then multiplying it by 2 shifts the coordinate center halfway to the right and magnifies it by a factor of 2, thus obtaining the complete halo shape. Figure 5 The image shows the visual effect of the coordinate transformation data after the smooth transition processing in step S304.

[0046] Step S304: Perform smooth transition processing on the coordinate transformation data to obtain reverse halo data;

[0047] In this step, after smoothing the coordinate transformation data, a reversed halo shape is obtained. "Reversed" means that the color values ​​of the center and the edges are reversed. Since halo shape data with a white center and black edges is easier to overlay with other pixels (such as the background image of the game scene) in the game engine, and the reversed halo data obtained in this step is black in the center and white at the edges, it is called reversed halo data.

[0048] Step S305: Invert the color values ​​of the reversed halo data to obtain halo shape data;

[0049] In this step, to obtain halo shape data with a black center and white edges, the color values ​​of the inverted halo data are reversed. This inverts the color values ​​of the inverted halo data, turning white into black and black into white, which better meets the rendering requirements of the game engine. Figure 6 As shown, this is a halo shape data. Within the uv coordinate range (i.e., the reverse coordinates of u and v are both [0,1]), the center [0.5,0.5] is white, the circle gradually turns black, and it gradually connects with the area outside the circle. The area outside the circle is also black. All these pixels constitute a complete halo shape data. In the game engine, black pixels will be eliminated when superimposed with other pixels. For example, if a white pixel is superimposed with a black pixel, the pixel is white; if a red pixel is superimposed with a black pixel, the pixel is red. Therefore, when this halo shape data is superimposed with pixels from other game scenes in the game engine, its own black pixels will be eliminated, and the pixel color of the game scene will be displayed.

[0050] In one implementation, pixel color values ​​can be inverted using functions such as invert, color inversion, and one-minus calculation. Specifically, in one implementation, step S305 includes performing a one-minus calculation on the inverted halo data to obtain halo shape data. It can be understood that the one-minus calculation involves subtracting the original pixel value from 1. For example, if the original pixel value of a pixel in the inverted halo data is 0.3, then the one-minus calculation is 1 - 0.3 = 0.7, resulting in a pixel value of 0.7. The specific calculation is not limited here.

[0051] Step S306: Calculate the halo effect of at least one target effect parameter on the halo shape data to obtain target halo data, and render the target halo effect based on the target halo data.

[0052] In one embodiment, the target effect parameter includes the center color value of the halo. Step S306 includes: obtaining colored halo data based on the halo shape data and the center color value of the halo; performing HSV color space conversion on the colored halo data in the original color space to obtain initial HSV halo data, and performing target HSV calculation on the initial HSV halo data using the target HSV parameter to obtain target HSV halo data, wherein the target HSV parameter is used to indicate the color warmth or coolness attribute of the target halo; and restoring the target HSV halo data to the original color space to obtain the target halo data for the target color effect.

[0053] It is understood that the parameters of the HSV color space include hue (H), saturation (S), and value (V). This implementation method is one way to generate different color halo effects. The target effect parameters include the center color value of the halo, which indicates the center color value of the target halo effect. Specifically, the center color value of the halo indicates the RGB value of the center color of the target halo effect. It is understood that if the center color value of the halo is directly set to the center color of the target halo, the generated halo effect will be rather unnatural. Therefore, in order to make the target halo effect more realistic, in this implementation method, the colored halo data in the RGB color space is converted to the HSV color space to obtain the initial HSV halo data. Then, the target HSV halo data is obtained by calculating with the initial HSV halo data using preset target HSV parameters. The target HSV parameter represents a color warmth or coolness attribute. The target HSV parameter can be preset as one of the target effect parameters in the game engine, or it can be dynamically calculated based on the center color value of the halo. The specific method is not limited here. In one implementation, combining the halo shape data and the halo center color value yields target HSV halo data with color warmth / coolness attributes indicated by the target HSV parameters. Further, multiplying or superimposing the halo shape data and the halo center color value yields the target HSV halo data. In this implementation, after HSV conversion of the initial HSV halo data using the target HSV parameters, the resulting target HSV halo data possesses specific color warmth / coolness attributes, more realistically reflecting the halo effect rather than just a single color dimension. Finally, restoring the target HSV halo data from the HSV color space to the RGB color space yields the target halo data with the desired color effect. It should be noted that the target HSV parameters include the target H parameter, target S parameter, and target V parameter; their specific values ​​are not limited here.

[0054] Understandably, the warm or cool attribute of color is a bias characteristic of color perception. For example, colors such as red, orange, yellow, and brown are usually called warm colors, while colors such as green, blue, and purple are usually called cool colors. The warm or cool attribute of color is used to classify color bias, making the effect of the target halo closer to the game scene.

[0055] Specifically, in one embodiment, the above-mentioned HSV color space conversion is performed on the colored halo data in the original color space to obtain initial HSV halo data, and target HSV calculation is performed on the initial HSV halo data using target HSV parameters to obtain target HSV halo data. This includes: performing HSV color space conversion on the colored halo data in the original color space, and normalizing the HSV color space conversion result to obtain initial HSV halo data, wherein the initial HSV halo data includes the normalized HSV color value of the halo center color value; comparing the normalized HSV color value with a preset warm / cool attribute threshold value to obtain a comparison result, and determining the warm / cool attribute of the target halo based on the comparison result; determining the target HSV parameters based on the warm / cool attribute, and generating the target HSV halo data based on the target HSV parameters and the initial HSV halo data.

[0056] This implementation method dynamically calculates the target HSV parameters based on the color value of the halo center. Specifically, firstly, the colored halo data in the RGB color space (i.e., the original color space) is converted to the HSV color space. Then, the colored halo data in the HSV color space (i.e., the HSV color space conversion result) is normalized to obtain initial HSV halo data. Next, the normalized HSV color value corresponding to the halo center color value in the initial HSV halo data is compared with a preset warm / cool attribute threshold. The warm / cool attribute of the halo center color value is determined based on the comparison result. For example, assuming the preset warm / cool attribute thresholds include a first cool color threshold M and a second cool color threshold N, then if the halo center color value > the first cool color threshold M and the halo center color value < the second cool color threshold N, i.e., the halo center color value ∈ (M, N), then the warm / cool attribute of the halo center color value can be determined as "cool". Conversely, if the halo center color value > the first cool color threshold M and the second cool color threshold N, i.e., the halo center color value ∈ (M, N), then the warm / cool attribute of the halo center color value can be determined as "cool". Then, the color temperature attribute of the center color value of the halo can be determined to be "warm," but the specific value is not limited here. Next, based on the color temperature attribute of the target halo, the target HSV parameter can be determined. In one implementation, different color temperature attributes correspond to different preset target HSV parameters. For example, if the color temperature attribute is "cool," it corresponds to target HSV parameter 1; if the color temperature attribute is "warm," it corresponds to target HSV parameter 2, and the specific value is not limited here.

[0057] In one implementation, since the hue H in the HSV color space can effectively distinguish the warm and cool characteristics of colors, the above-mentioned comparison of normalized HSV color values ​​with preset warm and cool attribute thresholds to obtain comparison results includes: comparing the normalized H value in the normalized HSV color values ​​with at least one preset H threshold value to obtain comparison results. For example, when the normalized H value ∈ (0.167, 0.667), its color warm and cool attribute leans towards cool. Therefore, one preset H threshold value can be set to 0.167, and another preset H threshold value can be set to 0.667. Then, the normalized H value corresponding to the color value of the halo center is compared with these two preset H threshold values. The comparison results are used to determine whether the normalized H value belongs to the cool color characteristic range. If it does, the color warm and cool attribute of the target halo can be determined to be "cool". If it does not, the color warm and cool attribute of the target halo is determined to be "warm". The specifics are not limited here.

[0058] In one implementation, the color warmth / coolness attribute can also be used to determine the HSV conversion algorithm. Specifically, the above-mentioned determination of the target HSV parameters based on the color warmth / coolness attribute, and the generation of target HSV halo data based on the target HSV parameters and initial HSV halo data, includes: determining the target HSV parameters and HSV conversion algorithm based on the color warmth / coolness attribute, and processing the initial HSV halo data and target HSV parameters using the HSV conversion algorithm to obtain the target HSV halo data. For example, assuming the color warmth / coolness attribute is "cool color," which corresponds to target HSV parameter 1 and HSV conversion algorithm 1, then processing the initial HSV halo data and target HSV parameter 1 using HSV conversion algorithm 1 will yield the target HSV halo data; conversely, if the color warmth / coolness attribute is "warm color," which corresponds to target HSV parameter 2 and HSV conversion algorithm 2, then processing the initial HSV halo data and target HSV parameter 2 using HSV conversion algorithm 2 will yield the target HSV halo data. Specifically, assuming the color warmth / coolness attribute is "cool color", the target HSV parameters corresponding to this color warmth / coolness attribute include h1, s1, and v1. The process of processing the initial HSV halo data and the target HSV parameters through the HSV conversion algorithm corresponding to this color warmth / coolness attribute can be as follows: add the H value in the initial HSV halo data to h1, multiply the S value in the initial HSV halo data to s1, and multiply the V value in the initial HSV halo data to v1 to obtain the target HSV halo data. The specifics are not limited here.

[0059] It should be noted that the H, S, and V values ​​in the target HSV parameters can be positive or negative. In one implementation, if the color warm / cool attribute is "cool", the H, S, and V values ​​in the target HSV parameters are all positive. If the color warm / cool attribute is "warm", the H value in the target HSV parameters is negative, and the S and V values ​​are both positive, thereby obtaining a better halo effect.

[0060] In one embodiment, at least one target effect parameter includes an edge hardness index. The halo effect calculation of the halo shape data by at least one target effect parameter is performed to obtain target halo data, including: obtaining target halo data with target edge hardness effect based on the halo shape data and the edge hardness index.

[0061] This embodiment describes a method for generating halo effects with varying edge hardness. At least one target effect parameter includes an edge hardness index, which indicates the degree of sharpness or blurriness at the edges of the target halo effect. The edge hardness index ranges from [0,1]. In one embodiment, target halo data with the desired edge hardness effect can be obtained by performing an exponential operation on the halo shape data using the edge hardness index. Furthermore, by performing a power operation on the edge hardness index on the halo shape data, the edge hardness of the original halo shape can be changed, resulting in target halo data with the desired edge hardness effect. Figure 7 The image shows halo data for three different edge hardness / softness effects, such as... Figure 7 As shown in (1), when the edge hardness index is 0, the halo shape data is binarized, that is, all non-zero data in the halo shape data are converted to 1, and 0 remains unchanged. Therefore, when the edge hardness index is 0, the edge of the target halo is a hard edge; Figure 7 As shown in (2), when the edge hardness index is in the range of (0,1), the closer the edge hardness index is to 0, the harder the edge of the target halo; the closer the edge hardness index is to 1, the softer and smoother the edge of the target halo, and the closer the effect is to the original halo shape data. Figure 7 As shown in (3), when the edge hardness index is 1, the data does not change, and the halo shape data is the target halo data of the target edge hardness effect. This embodiment changes the edge hardness of the halo effect by setting the effect parameters, so that the variable halo effect dimension is not only the color dimension. Increasing the edge hardness of the halo effect dimension makes the final halo effect richer.

[0062] In one embodiment, the at least one target effect parameter includes a halo size coefficient, which indicates the size of the target halo data. The halo effect calculation of the halo shape data using at least one target effect parameter yields the target halo data, including: obtaining target halo data with a target halo size effect based on the halo shape data and the halo size coefficient. This embodiment describes a method for generating halo effects of different halo sizes. The halo size coefficient is a variable greater than 1; the larger the halo size coefficient, the smaller the shape of the target halo; the smaller the halo size coefficient, the larger the shape of the target halo. In one embodiment, a target halo data with a custom halo size can be obtained by multiplying the halo shape data by the halo size coefficient. It should be noted that the target halo size setting can be based on the halo shape data, the target halo data with the softness / hardness effect of the target edge, or the halo data of any other stage or any layer of halo data; no specific limitation is made here. In this embodiment, the halo shape data can be replaced with target halo data for target edge hardness effect, target halo data for target halo size effect, or target halo data for target color effect, so that the variable halo effect dimension is not only the color dimension. Increasing the halo size dimension makes the final halo effect richer.

[0063] In one embodiment, the at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halos, wherein the at least two halos include at least a main body layer halo. The halo effect of at least one target effect parameter is calculated on the halo shape data to obtain target halo data, including:

[0064] S1. Calculate at least one target effect parameter corresponding to the halo of the main body layer based on the halo shape data to obtain the halo data of the main body layer.

[0065] S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data. Perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data.

[0066] S3. Determine whether at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo;

[0067] S4. If at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until at least one target effect parameter does not contain at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

[0068] This embodiment describes a method for generating halo effects with different numbers of halo layers. All target effect parameters include at least one target effect parameter corresponding to each of the at least two ordered halo layers. For example, assuming that the target effect parameters corresponding to one halo layer include the halo center color value, edge softness index, and halo size coefficient, then all target effect parameters include the halo center color value, edge softness index, and halo size coefficient corresponding to each of the at least two ordered halo layers. The specific details are not limited here. At least one main halo layer is included in at least two halo layers. The main halo layer is used to indicate the outermost halo layer. In this embodiment, firstly, at least one target effect parameter corresponding to the main halo layer is calculated to obtain the main halo layer data. Then, the main halo layer data is overlaid with the main halo layer data using at least one target effect parameter corresponding to the next halo layer to obtain the next halo layer data. Then, the next halo layer data and the main halo layer data are interpolated linearly (Lerp) to merge the main halo layer data and the next halo layer data to obtain an initial overlaid halo layer data that combines the main halo layer data and the next halo layer data. It can be understood that the obtained initial overlaid halo layer data is an overlaid effect where the main halo layer is on top and the next halo layer is covered by the main halo layer below. Next, if all target effect parameters also contain at least one target effect parameter corresponding to the next layer of halo, that is, if all target effect parameters contain at least one target effect parameter corresponding to 3 or more layers of halo, then the initial stacked halo data is used as the main layer halo data, and steps S2-S4 are repeated to obtain a target halo data with 3 or more layers of halo. Figure 8 (1) shows the target halo data of the two-layer overlay effect. Figure 8 (2) in the figure represents the target halo data of the 3-layer stacked effect.

[0069] It should be noted that the generation of halo layering effects can be based on halo shape data, target halo data for target edge hardness / softness effects, target halo data for target halo size effects, or target halo data for target color effects. It can also be based on halo data from any other stage or halo data from any layer; specific limitations are not specified here. That is, the halo shape data in this embodiment can be replaced with target halo data for target edge hardness / softness effects, target halo data for target halo size effects, or target halo data for target color effects. This makes the variable halo effect dimension not only the color dimension, and the addition of stackable halo effect dimensions makes the final halo effect richer.

[0070] Furthermore, in one embodiment, at least one target effect parameter corresponding to each halo layer includes at least one of the following: halo center color value, edge hardness index, and halo size coefficient; the main layer halo is used to indicate the outermost halo; at least one target effect parameter corresponding to the next layer halo is inherited from at least one target effect parameter corresponding to the previous layer halo.

[0071] Understandably, each halo layer can perform halo effect calculations for the halo center color value, edge softness index, and halo size coefficient. At least one target effect parameter corresponding to each halo layer is inherited from at least one target effect parameter corresponding to the previous halo layer. The main halo layer is the outermost halo (i.e., the top halo layer), and the other halo layers are stacked in an orderly manner below the outermost halo layer, making the stacking effect of the target halo better.

[0072] The halo effect generation method provided in the above embodiments generates halo shape data by generating halo shape data from the original output pixels, and then calculates the halo effect of the target effect parameters of different halo effect dimensions on the halo shape data, thereby obtaining target halo data containing at least one target halo effect, so that the halo effect can be rendered in the same rendering batch, and the halo effect of different dimensions can be adjusted by adjusting the effect parameters, thereby increasing the variable halo effect dimensions.

[0073] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 9 The diagram shows a halo effect generation device, which includes: a response module 90 for responding to a halo generation command and determining at least one target effect parameter of the target halo; a generation module 92 for generating halo shapes from the original output pixels based on the target effect parameters to obtain halo shape data; and a calculation module 94 for performing halo effect calculations on the halo shape data using at least one target effect parameter to obtain target halo data, and rendering the target halo effect based on the target halo data.

[0074] The aforementioned halo effect generation device generates halo shape data from the original output pixels, and then calculates the halo effect of the target effect parameters of different halo effect dimensions on the halo shape data, thereby obtaining target halo data containing at least one target halo effect. This allows the halo effect to be rendered in the same rendering batch, and allows the halo effect of different dimensions to be adjusted by adjusting the effect parameters, thereby increasing the variable halo effect dimensions.

[0075] Optionally, the aforementioned target effect parameters include the center color value of the halo, and the aforementioned calculation module includes: a multiplication unit, used to obtain colored halo data based on the halo shape data and the center color value of the halo; a conversion unit, used to perform HSV color space conversion on the colored halo data in the original color space to obtain initial HSV halo data, and to perform target HSV calculation on the initial HSV halo data through the target HSV parameters to obtain target HSV halo data, wherein the target HSV parameters are used to indicate the color warmth or coolness attribute of the target halo; and a restoration unit, used to restore the target HSV halo data to the original color space to obtain the target halo data of the target color effect.

[0076] Optionally, the above conversion unit is further configured to: perform HSV color space conversion on the colored halo data in the original color space, and normalize the HSV color space conversion result to obtain initial HSV halo data, the initial HSV halo data including the normalized HSV color value of the halo center color value; compare the normalized HSV color value with the preset warm / cool attribute threshold value to obtain the comparison result, and determine the warm / cool attribute of the target halo based on the comparison result; determine the target HSV parameters based on the warm / cool attribute, and generate the target HSV halo data based on the target HSV parameters and the initial HSV halo data.

[0077] Optionally, at least one of the target effect parameters mentioned above includes an edge hardness index, and the calculation module is further used to: obtain target halo data of the target edge hardness effect based on the halo shape data and the edge hardness index.

[0078] Optionally, at least one of the target effect parameters mentioned above includes a halo size coefficient, which is used to indicate the size of the target halo data. The calculation module is also used to: obtain the target halo data of the target halo size effect based on the halo shape data and the halo size coefficient.

[0079] Optionally, the aforementioned at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halos, wherein the aforementioned at least two halos include at least the main body layer halo, and the aforementioned calculation module is further configured to perform the following steps:

[0080] S1. Calculate at least one target effect parameter corresponding to the halo of the main body layer based on the halo shape data to obtain the halo data of the main body layer.

[0081] S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data. Perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data.

[0082] S3. Determine whether at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo;

[0083] S4. If at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until at least one target effect parameter does not contain at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

[0084] Optionally, at least one target effect parameter corresponding to each halo layer includes at least one of the following: halo center color value, edge softness index, and halo size coefficient; the main layer halo is used to indicate the outermost halo; at least one target effect parameter corresponding to the next layer halo is inherited from at least one target effect parameter corresponding to the previous layer halo.

[0085] Optionally, the above-mentioned generation module includes: a setting unit, used to set a first initial color value at the origin of the coordinate system and a second initial color value at the endpoints of the coordinate interval for the original output pixels to obtain initial color value data; a transformation unit, used to perform center offset and magnification on the initial color value data to obtain coordinate transformation data; a smoothing unit, used to perform smooth transition processing on the coordinate transformation data to obtain reverse halo data; and a reversal unit, used to reverse the color values ​​of the reverse halo data to obtain halo shape data.

[0086] Optionally, the aforementioned reverse unit is also used to: perform a subtraction calculation on the reverse halo data to obtain halo shape data.

[0087] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described method for generating the halo effect. This electronic device can be a server or a terminal device.

[0088] See Figure 10 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described method for generating the halo effect.

[0089] Furthermore, Figure 10 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0090] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0091] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101. The processor 100 reads information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments, for example:

[0092] In response to the halo generation command, at least one target effect parameter of the target halo is determined; halo shape is generated on the original output pixels based on the target effect parameter to obtain halo shape data; halo effect calculation is performed on the halo shape data based on at least one target effect parameter to obtain target halo data, and target halo effect is rendered based on target halo data.

[0093] In this method, after generating halo shape data from the original output pixels, halo effect calculations are performed on the halo shape data using target effect parameters of different halo effect dimensions. This results in target halo data containing at least one target halo effect, enabling the halo effect to be rendered in the same rendering batch. Furthermore, the halo effect of different dimensions can be adjusted by adjusting the effect parameters, thereby increasing the variable halo effect dimensions.

[0094] Optionally, the aforementioned target effect parameters include the center color value of the halo. The halo effect is calculated using at least one target effect parameter on the halo shape data to obtain target halo data, including: obtaining colored halo data based on the halo shape data and the center color value of the halo; performing HSV color space conversion on the colored halo data in the original color space to obtain initial HSV halo data, and then performing target HSV calculation on the initial HSV halo data using the target HSV parameters to obtain target HSV halo data. The target HSV parameters are used to indicate the warm or cool color attributes of the target halo; and restoring the target HSV halo data to the original color space to obtain the target halo data for the target color effect.

[0095] Optionally, the above-mentioned HSV color space conversion of the colored halo data in the original color space to obtain initial HSV halo data, and the target HSV calculation of the initial HSV halo data using target HSV parameters to obtain target HSV halo data, includes: performing HSV color space conversion on the colored halo data in the original color space, and normalizing the HSV color space conversion result to obtain initial HSV halo data, the initial HSV halo data including the normalized HSV color value of the halo center color value; comparing the normalized HSV color value with a preset warm / cool attribute threshold value to obtain a comparison result, and determining the warm / cool attribute of the target halo based on the comparison result; determining the target HSV parameters based on the warm / cool attribute, and generating the target HSV halo data based on the target HSV parameters and the initial HSV halo data.

[0096] Optionally, the above-mentioned at least one target effect parameter includes an edge hardness index. The halo effect calculation of the halo shape data by at least one target effect parameter is performed to obtain target halo data, including: obtaining target halo data with target edge hardness effect based on halo shape data and edge hardness index.

[0097] Optionally, the above-mentioned at least one target effect parameter includes a halo size coefficient, which is used to indicate the size of the target halo data. The halo effect calculation of the halo shape data by at least one target effect parameter is performed to obtain the target halo data, including: obtaining the target halo data of the target halo size effect based on the halo shape data and the halo size coefficient.

[0098] Optionally, the aforementioned at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halos, wherein the at least two halos include at least a main body layer halo. The halo effect of at least one target effect parameter is calculated on the halo shape data to obtain target halo data, including:

[0099] S1. Calculate at least one target effect parameter corresponding to the halo of the main body layer based on the halo shape data to obtain the halo data of the main body layer.

[0100] S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data. Perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data.

[0101] S3. Determine whether at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo;

[0102] S4. If at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until at least one target effect parameter does not contain at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

[0103] Optionally, at least one target effect parameter corresponding to each layer of halo includes at least one of the following: halo center color value, edge softness index, and halo size coefficient; the main layer halo is used to indicate the outermost halo; at least one target effect parameter corresponding to the next layer halo is inherited from at least one target effect parameter corresponding to the previous layer halo.

[0104] Optionally, the above-mentioned halo shape generation of the original output pixels based on the target effect parameters to obtain halo shape data includes: setting a first initial color value for the origin of the coordinate system and a second initial color value for the endpoints of the coordinate interval of the original output pixels to obtain initial color value data; performing center offset and magnification on the initial color value data to obtain coordinate transformation data; performing smooth transition processing on the coordinate transformation data to obtain reverse halo data; and reversing the color values ​​of the reverse halo data to obtain halo shape data.

[0105] Optionally, the above-mentioned color value inversion of the reverse halo data to obtain halo shape data includes: performing a subtraction calculation on the reverse halo data to obtain halo shape data.

[0106] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned method for generating the halo effect, for example:

[0107] In response to the halo generation command, at least one target effect parameter of the target halo is determined; halo shape is generated on the original output pixels based on the target effect parameter to obtain halo shape data; halo effect calculation is performed on the halo shape data based on at least one target effect parameter to obtain target halo data, and target halo effect is rendered based on target halo data.

[0108] In this method, after generating halo shape data from the original output pixels, halo effect calculations are performed on the halo shape data using target effect parameters of different halo effect dimensions. This results in target halo data containing at least one target halo effect, enabling the halo effect to be rendered in the same rendering batch. Furthermore, the halo effect of different dimensions can be adjusted by adjusting the effect parameters, thereby increasing the variable halo effect dimensions.

[0109] Optionally, the aforementioned target effect parameters include the center color value of the halo. The halo effect is calculated using at least one target effect parameter on the halo shape data to obtain target halo data, including: obtaining colored halo data based on the halo shape data and the center color value of the halo; performing HSV color space conversion on the colored halo data in the original color space to obtain initial HSV halo data, and then performing target HSV calculation on the initial HSV halo data using the target HSV parameters to obtain target HSV halo data. The target HSV parameters are used to indicate the warm or cool color attributes of the target halo; and restoring the target HSV halo data to the original color space to obtain the target halo data for the target color effect.

[0110] Optionally, the above-mentioned HSV color space conversion of the colored halo data in the original color space to obtain initial HSV halo data, and the target HSV calculation of the initial HSV halo data using target HSV parameters to obtain target HSV halo data, includes: performing HSV color space conversion on the colored halo data in the original color space, and normalizing the HSV color space conversion result to obtain initial HSV halo data, the initial HSV halo data including the normalized HSV color value of the halo center color value; comparing the normalized HSV color value with a preset warm / cool attribute threshold value to obtain a comparison result, and determining the warm / cool attribute of the target halo based on the comparison result; determining the target HSV parameters based on the warm / cool attribute, and generating the target HSV halo data based on the target HSV parameters and the initial HSV halo data.

[0111] Optionally, the above-mentioned at least one target effect parameter includes an edge hardness index. The halo effect calculation of the halo shape data by at least one target effect parameter is performed to obtain target halo data, including: obtaining target halo data with target edge hardness effect based on halo shape data and edge hardness index.

[0112] Optionally, the above-mentioned at least one target effect parameter includes a halo size coefficient, which is used to indicate the size of the target halo data. The halo effect calculation of the halo shape data by at least one target effect parameter is performed to obtain the target halo data, including: obtaining the target halo data of the target halo size effect based on the halo shape data and the halo size coefficient.

[0113] Optionally, the aforementioned at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halos, wherein the at least two halos include at least a main body layer halo. The halo effect of at least one target effect parameter is calculated on the halo shape data to obtain target halo data, including:

[0114] S1. Calculate at least one target effect parameter corresponding to the halo of the main body layer based on the halo shape data to obtain the halo data of the main body layer.

[0115] S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data. Perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data.

[0116] S3. Determine whether at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo;

[0117] S4. If at least one target effect parameter contains at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until at least one target effect parameter does not contain at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

[0118] Optionally, at least one target effect parameter corresponding to each layer of halo includes at least one of the following: halo center color value, edge softness index, and halo size coefficient; the main layer halo is used to indicate the outermost halo; at least one target effect parameter corresponding to the next layer halo is inherited from at least one target effect parameter corresponding to the previous layer halo.

[0119] Optionally, the above-mentioned halo shape generation of the original output pixels based on the target effect parameters to obtain halo shape data includes: setting a first initial color value for the origin of the coordinate system and a second initial color value for the endpoints of the coordinate interval of the original output pixels to obtain initial color value data; performing center offset and magnification on the initial color value data to obtain coordinate transformation data; performing smooth transition processing on the coordinate transformation data to obtain reverse halo data; and reversing the color values ​​of the reverse halo data to obtain halo shape data.

[0120] Optionally, the above-mentioned color value inversion of the reverse halo data to obtain halo shape data includes: performing a subtraction calculation on the reverse halo data to obtain halo shape data.

[0121] The computer program product of the halo effect generation method, apparatus, electronic device and storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0123] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0124] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0125] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for 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. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0126] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for generating a halo effect, characterized in that, The method includes: In response to the halo generation command, determine at least one target effect parameter of the target halo; Based on the target effect parameters, a halo shape is generated from the original output pixels to obtain halo shape data; the original output pixels are the original output data of the halo shader, and the halo shape data is generated by setting the color attributes of the original output pixels; The halo effect is calculated on the halo shape data using at least one target effect parameter to obtain target halo data, and the target halo effect is rendered based on the target halo data; the at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halo layers respectively, and the at least two halo layers include at least the main body layer halo; The step of calculating the halo effect of at least one target effect parameter on the halo shape data to obtain target halo data includes: S1. Calculate at least one target effect parameter corresponding to the main body layer halo on the halo shape data to obtain the main body layer halo data; S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data, and perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data. S3. Determine whether the at least one target effect parameter includes at least one target effect parameter corresponding to the next layer halo; S4. If the at least one target effect parameter includes at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until the at least one target effect parameter does not include at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

2. The method according to claim 1, characterized in that, The target effect parameters include the center color value of the halo. The calculation of the halo effect using at least one of the target effect parameters on the halo shape data to obtain target halo data includes: Based on the halo shape data and the halo center color value, colored halo data is obtained; The colored halo data in the original color space is converted to HSV color space to obtain initial HSV halo data. Then, the initial HSV halo data is calculated using target HSV parameters to obtain target HSV halo data. The target HSV parameters are used to indicate the color warmth or coolness of the target halo. The target HSV halo data is restored to the original color space to obtain the target halo data of the target color effect.

3. The method according to claim 2, characterized in that, The process of converting the colored halo data in the original color space to HSV color space to obtain initial HSV halo data, and then calculating the target HSV halo data using target HSV parameters, includes: The colored halo data in the original color space is converted to HSV color space, and the HSV color space conversion result is normalized to obtain initial HSV halo data, which includes the normalized HSV color value of the center color value of the halo. The normalized HSV color value is compared with the preset warm / cool attribute threshold value to obtain the comparison result, and the warm / cool attribute of the target halo is determined based on the comparison result. The target HSV parameters are determined based on the color warmth / coolness attributes, and the target HSV halo data is generated based on the target HSV parameters and the initial HSV halo data.

4. The method according to claim 1, characterized in that, The at least one target effect parameter includes an edge hardness index. The calculation of the halo effect using the at least one target effect parameter on the halo shape data to obtain target halo data includes: Based on the halo shape data and the edge hardness index, target halo data of the target edge hardness effect is obtained.

5. The method according to claim 1, characterized in that, The at least one target effect parameter includes a halo size coefficient, which indicates the size of the target halo data. The calculation of the halo effect of the halo shape data using the at least one target effect parameter to obtain the target halo data includes: Based on the halo shape data and the halo size coefficient, the target halo data of the target halo size effect is obtained.

6. The method according to claim 1, characterized in that, At least one target effect parameter corresponding to each halo layer includes at least one of the following: halo center color value, edge softness index, and halo size coefficient; the main halo layer is used to indicate the outermost halo layer; at least one target effect parameter corresponding to the next layer halo layer is inherited from at least one target effect parameter corresponding to the previous layer halo layer.

7. The method according to claim 1, characterized in that, The step of generating halo shapes from the original output pixels based on the target effect parameters to obtain halo shape data includes: The initial color value data is obtained by setting the first initial color value at the origin of the coordinate system and the second initial color value at the endpoints of the coordinate interval for the original output pixels. The initial color value data is shifted at the center and magnified by a factor to obtain coordinate transformation data; The coordinate transformation data is smoothed to obtain inverse halo data; The color values ​​of the reversed halo data are reversed to obtain halo shape data.

8. The method according to claim 7, characterized in that, The step of inverting the color values ​​of the inverted halo data to obtain halo shape data includes: The halo shape data is obtained by subtracting one from the reverse halo data.

9. A device for generating a halo effect, characterized in that, The device includes: The response module is used to determine at least one target effect parameter of the target halo in response to the halo generation command; The generation module is used to generate halo shapes from the original output pixels based on the target effect parameters, thereby obtaining halo shape data; the original output pixels are the original output data of the halo shader, and the halo shape data is generated by setting the color attributes of the original output pixels; The calculation module is used to calculate the halo effect of the halo shape data for the at least one target effect parameter to obtain target halo data, and to render the target halo effect based on the target halo data; the at least one target effect parameter includes at least one target effect parameter corresponding to at least two ordered halo layers respectively, and the at least two halo layers include at least the main body layer halo; The calculation module is also used to perform the following steps: S1. Calculate at least one target effect parameter corresponding to the main body layer halo on the halo shape data to obtain the main body layer halo data; S2. Calculate at least one target effect parameter corresponding to the next layer halo data for the main layer halo data to obtain the next layer halo data, and perform linear interpolation between the next layer halo data and the main layer halo data to obtain the initial stacked halo data. S3. Determine whether the at least one target effect parameter includes at least one target effect parameter corresponding to the next layer halo; S4. If the at least one target effect parameter includes at least one target effect parameter corresponding to the next layer halo, then the initial overlay halo data is determined as the main layer halo data, and steps S2-S4 are repeated until the at least one target effect parameter does not include at least one target effect parameter corresponding to the next layer halo, and the initial overlay halo data is determined as target halo data with overlay effect.

10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the method for generating a halo effect according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the method for generating the halo effect according to any one of claims 1-8.

Citation Information

Patent Citations

  • Method for generating halo in image

    CN102819852A