Halo effect generation method and device, electronic equipment and readable storage medium

By determining the shape of the light sheet and the distance field data of the virtual light source, the problem of high consumption of halo effect generation performance in the prior art is solved, efficient and real halo effect generation is achieved, and user experience is improved.

CN119919568APending Publication Date: 2025-05-02NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411886615.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The prior art consumes a lot of performance when simulating halo effects, making it difficult to achieve efficient and real halo effects generation.

Method used

By determining the target halo effect type and its corresponding light sheet shape, and generating a spot image based on the distance field data between the virtual light source and the light sheet, directly rendering and displaying, the performance consumption required for sampling is reduced.

Benefits of technology

It reduces the performance consumption of halo effect generation, increases the authenticity of halo effect generation, and enhances the user's experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919568A_ABST
    Figure CN119919568A_ABST
Patent Text Reader

Abstract

The invention discloses a halo effect generation method and device, electronic equipment and a readable storage medium. The method comprises the following steps: determining a target halo effect type to be applied; determining the shape of a light sheet corresponding to the target halo effect type; according to the shape of the light sheet and the distance field data of the virtual light source and the light sheet, a light spot image corresponding to a target halo effect type is generated, and the target halo effect type comprises a first target halo effect type and / or a second target halo effect type; the first target halo effect type is a target halo effect type representing a halo effect needing to be partially shielded by the virtual object, and the second target halo effect type is a target halo effect type representing a halo effect not needing to be partially shielded by the virtual object; and performing rendering display based on the light spot image corresponding to the target halo effect type. The method provided by the embodiment of the invention can reduce performance consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and readable storage medium for generating a halo effect. Background Art

[0002] When a photographer shoots against the light, the lens is pointed directly at a bright light source (such as the sun or various artificial lights). More direct light enters the lens, which will produce a halo effect, also known as lens glare. With the development of image processing technology, the halo effect can be simulated through image processing technology.

[0003] Currently, the methods of simulating halo effects include image texture and Monte Carlo physical determination. Image texture mainly achieves various halo effects by adjusting different halo textures through art. The Monte Carlo method determines the halo effect of the lens in a physical way.

[0004] However, current methods of simulating halo effects are performance-intensive. Summary of the invention

[0005] The present application provides a method, device, electronic device and readable storage medium for generating a halo effect, which can reduce the performance consumption of generating a halo effect, increase the authenticity of the generated halo effect, and enhance the user experience. The specific scheme is as follows:

[0006] In a first aspect, an embodiment of the present application provides a method for generating a halo effect, characterized in that the method comprises:

[0007] determining the type of target halo effect to be applied;

[0008] Determine the shape of the light sheet corresponding to the target halo effect type;

[0009] Generate a light spot image corresponding to a target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is a target halo effect type representing a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type is a target halo effect type representing a halo effect that does not need to be partially blocked by a virtual object;

[0010] Rendering and display are performed based on the spot image corresponding to the target halo effect type.

[0011] In a second aspect, an embodiment of the present application provides a halo effect generating device, characterized in that the device comprises:

[0012] a determination unit, used to determine a target halo effect type to be applied;

[0013] The determination unit is further used to determine the shape of the light sheet corresponding to the target halo effect type;

[0014] a generating unit, configured to generate a light spot image corresponding to a target halo effect type according to a shape of the light sheet and distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type being a target halo effect type representing a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type being a target halo effect type representing a halo effect that does not need to be partially blocked by a virtual object;

[0015] The rendering unit is used for rendering and displaying a spot image corresponding to a target halo effect type.

[0016] In a third aspect, the present application further provides an electronic device, including:

[0017] Processor; and

[0018] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method described in the first aspect is executed.

[0019] In a fourth aspect, an embodiment of the present application further provides a machine-readable storage medium storing a data processing program, which is executed by a processor to perform the method described in the first aspect.

[0020] Compared with the prior art, the present application has the following advantages: after determining the shape of the light sheet corresponding to the target halo effect type, the present application can obtain a light spot image corresponding to the target halo effect by rendering a light sheet with the above shape according to the distance field data of the virtual light source and the light sheet. Compared with the two traditional methods of image texture and Monte Carlo physics determination, the present application does not require a large amount of sampling, and directly generates a light spot image corresponding to the target halo effect according to the distance field data of the virtual light source and the light sheet, thereby reducing the performance consumption required for sampling, thereby reducing the performance consumption of simulating halo effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 is a flow chart of a method for generating a halo effect provided in an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a first light blocking mask diagram provided in an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a spot image of a composite halo effect provided in an embodiment of the present application;

[0024] Figure 4 The embodiment of this application provides Figure 1A schematic diagram of an implementation flow of S103;

[0025] Figure 5 is a schematic diagram of a lens light leakage effect provided by an embodiment of the present application;

[0026] Figure 6 is a schematic diagram of a central strong exposure effect provided by an embodiment of the present application;

[0027] Figure 7 The embodiment of this application provides Figure 4 A schematic diagram of an implementation flow of S402;

[0028] Figure 8 is a schematic diagram of a central star-shaped exposure effect provided in an embodiment of the present application;

[0029] Fig. 9 is a schematic diagram of a spherical light spot effect provided in an embodiment of the present application;

[0030] Fig.10 is a schematic diagram of a hexagonal light spot effect provided in an embodiment of the present application;

[0031] Fig.11 is another implementation flow diagram of the method for generating a halo effect provided in an embodiment of the present application;

[0032] Fig.12 is a schematic diagram of a light spot image corresponding to the transverse light spot effect type provided in an embodiment of the present application;

[0033] Fig.13 This is another implementation flow diagram of the method for generating a halo effect provided in an embodiment of the present application;

[0034] Fig.14 is a schematic diagram of a spot image corresponding to a horizontal geometric spot effect type provided in an embodiment of the present application;

[0035] Fig.15 is a structural block diagram of an example of a halo effect generating device provided in an embodiment of the present application;

[0036] Fig.16 It is a structural block diagram of an example of an electronic device for generating a halo effect provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0038] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0039] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.

[0040] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0041] Based on background technical reasons, in order to reduce the performance consumption of generating halo effects, the first embodiment of the present application provides a halo effect generation method, which can be applied to the simulation generation scheme of halo effects in virtual scenes, and the embodiments of the present application are not specifically limited.

[0042] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0043] Figure 1 FIG. 1 is a flow chart of a method for generating a halo effect according to an embodiment of the present application. Figure 1 As shown, the method may include S101 to S104. S101 to S104 are described in detail below.

[0044] S101, determining a target halo effect type to be applied.

[0045] Exemplarily, one or more target halo effects to be applied can be determined from a plurality of pre-configured halo effects according to a virtual light source in a virtual scene and a current presentation field of view of the virtual scene. The current presentation field of view of the virtual scene is the presentation field of view of the virtual scene provided by a virtual camera in the game. Different halo effects can be fitted separately by a shape distance field algorithm, and then the obtained different halo effects are synthesized to obtain the halo effect required by the scene. The pre-configured multiple halo effect types may include lens light leakage effect, center strong exposure effect, center star exposure effect, spherical spot effect, horizontal spot effect, horizontal geometric spot effect, etc.

[0046] S102: Determine the shape of the light sheet corresponding to the target halo effect type.

[0047] S103 . Generate a light spot image corresponding to a target halo effect type according to the distance field data between the virtual light source and the light sheet.

[0048] S104, rendering and displaying a spot image corresponding to the target halo effect type.

[0049] Exemplarily, the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is a target halo effect type that characterizes a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type is a target halo effect type that characterizes a halo effect that does not need to be partially blocked by a virtual object. After determining the target halo effect type, a spot image corresponding to the target halo effect type can be generated according to a spot image generation method corresponding to each target halo effect type. The spot image generation method for each target halo effect type is specifically introduced in the following embodiments.

[0050] When the target halo effect type includes a first target halo effect type and a second target halo effect type, "rendering and displaying based on the spot image corresponding to the target halo effect type" can be implemented in the following ways:

[0051] S1041. Superimpose the spot images corresponding to the first target halo effect type to obtain a first superimposed spot image.

[0052] Exemplarily, the first target halo effect type is a target halo effect type whose corresponding occlusion attribute characterizes the need for the halo effect to be partially occluded by the virtual object, that is, the corresponding spot image of the first target halo effect type may include the light source partially occluded by the virtual object and the light effect (Lumen) of the light source itself. After generating the spot image corresponding to the first target halo effect type, step S104 may be implemented according to formula (1).

[0053] Final_Composite=Horizontal_Geo_Shape_Efect+Bloom_Efect formula (1)

[0054] Among them, Final_Composite represents the first superimposed spot image, Horizontal_Geo_Shape_Effect represents the spot image corresponding to the central strong exposure effect, and Bloom_Effect represents the spot image corresponding to the horizontal geometric spot effect.

[0055] S1042: Perform color processing on the first superimposed light spot image according to the virtual object to obtain a second superimposed light spot image.

[0056] Exemplarily, the light incident occlusion degree can be determined according to the virtual object, and then a first light blocking mask map can be generated according to the light incident occlusion degree, and then the first superimposed light spot image can be color processed according to the first light blocking mask map. For example, the part that is completely blocked by the virtual object is black, and the part that is completely unblocked by the virtual object is white. The area where the black and white transition occurs can be gradient processed to obtain a second superimposed light spot image. Figure 2 It is a schematic diagram of a first light blocking mask diagram provided in an embodiment of the present application.

[0057] For example, the second superimposed light spot image can be obtained by multiplying the first light blocking mask image with the first superimposed light spot image. Step S105 can be implemented according to formula (2).

[0058] Final_Composite *= Mask formula (2)

[0059] Among them, Final_Composite represents the second superimposed spot image, and Mask represents the first light blocking mask image.

[0060] S1043, superimposing the spot images corresponding to the second target halo effect type to obtain a third superimposed spot image.

[0061] Exemplarily, the second target halo effect type is a target halo effect whose corresponding occlusion attribute represents a target halo effect that does not need to be partially occluded by a virtual object, that is, the influencing factor of the second target halo effect type is the light effect of the light source itself. The spot images corresponding to the second target halo effect type can be superimposed to obtain a third superimposed spot image.

[0062] S1044: superimpose the second superimposed spot image and the third superimposed spot image to obtain a spot image with a composite halo effect, and render and display the spot image with the composite halo effect.

[0063] For example, Figure 3is a schematic diagram of a spot image with a composite halo effect provided in an embodiment of the present application. After obtaining the second superimposed spot image and the third superimposed spot image, the second superimposed spot image and the third superimposed spot image can be superimposed to obtain a spot image with a composite halo effect, and the spot image with a composite halo effect can be rendered and displayed. The second superimposed spot image and the third superimposed spot image can be superimposed according to formula (3) to obtain a spot image with a composite halo effect.

[0064] Final_Composite+=Horizontal_Shape_Effect+Light_Leaks_Effect+

[0065] Hex_Shape_Effect+Bubbles_Effect+Starbursts_Effect formula (3)

[0066] Among them, Final_Composite represents the spot image of the composite halo effect, Horizontal_Shape_Effect represents the horizontal spot effect, Light_Leaks_Effect represents the lens light leakage effect, Hex_Shape_Effect represents the hexagonal spot effect, Bubbles_Effect represents the spherical spot effect, and Starbursts_Effect represents the central star-shaped exposure effect.

[0067] This embodiment achieves the effect that part of the light sheet effect may be blocked by an object by determining a light blocking mask map and superimposing the light blocking mask map with the light spot image, thereby increasing the authenticity of the generated halo effect and improving the user experience.

[0068] Optionally, when the target halo effect type includes only the first target halo effect type, the above “rendering and displaying based on the spot image corresponding to the target halo effect type” can be implemented in the following manner:

[0069] The spot images corresponding to the first target halo effect type are superimposed to obtain a first superimposed spot image; the first superimposed spot image is color processed according to the virtual object to obtain a second superimposed spot image; and the spot image corresponding to the second superimposed spot image is rendered and displayed.

[0070] Optionally, when the target halo effect type includes only the second target halo effect type, the above “rendering and displaying based on the spot image corresponding to the target halo effect type” can be implemented in the following manner:

[0071] The spot images corresponding to the second target halo effect type are superimposed to obtain a third superimposed spot image; and rendering and display are performed based on the spot image corresponding to the third superimposed spot image.

[0072] In some embodiments, the above-mentioned rendering and display based on the spot image corresponding to the target halo effect type may include: determining the occlusion properties corresponding to the target halo effect type according to the virtual light source in the virtual scene and the virtual objects of the virtual scene; rendering and displaying based on the occlusion properties corresponding to the target halo effect type and the spot image corresponding to the target halo effect type.

[0073] Exemplarily, the occlusion attribute is used to characterize whether the target halo effect type is the first target halo effect type or the second target halo effect type, that is, the occlusion attribute is used to characterize whether the target halo effect type needs to be partially blocked by the virtual object, that is, the occlusion attribute can be used to determine whether a certain target halo effect type is the first target halo effect type or the second target halo effect type. When the target halo effect type is a halo effect type that needs to be partially blocked by the virtual object, the target halo effect type is the first target halo effect type, and when the target halo effect type does not need to be partially blocked by the virtual object, the target halo effect type is the second target halo effect type. Rendering and display can be performed based on the occlusion attribute corresponding to the target halo effect type and the spot image corresponding to the target halo effect type.

[0074] For example, the virtual object is a virtual character, a virtual object, a virtual vehicle, etc. in a game. In a virtual scene, different types of halo effects have different influencing factors. The halo effect can be divided into at least two types according to the influencing factors of the halo effect. The influencing factors of the first type of halo effect are the virtual object blocking the light source and the light source's own light effect (Lumen). The first type of halo effect can be called the first target halo effect type, and the influencing factors of the second type of halo effect are the light source's own light effect. The second type of halo effect can be called the second target halo effect type. The first type of halo effect can include a central strong exposure effect and a horizontal geometric spot effect, and the second type of halo effect can include a lens light leakage effect, a central strong exposure effect, a central star-shaped exposure effect, a spherical spot effect, and a horizontal spot effect. Then, according to the virtual light source and the virtual object in the current presentation field of view, the occlusion attribute corresponding to the target halo effect can be determined from a variety of halo effects, that is, according to the virtual light source and the virtual object in the current presentation field of view, it is determined from a variety of halo effects whether the target halo effect has the effect of being blocked by the virtual object.

[0075] In some embodiments, Figure 4 yes Figure 1 A schematic diagram of an implementation flow of S103 in FIG. Figure 1The illustrated S103 may include S401 to S402 .

[0076] S401: Determine the pixel position of the light sheet in the screen space.

[0077] S402 , rendering a light sheet with a shape at the pixel position according to the distance field data between the virtual light source and the pixel position, to obtain a light spot image corresponding to the target halo effect type.

[0078] Exemplarily, when the target halo effect types include lens light leakage effect, center strong exposure effect, center star-shaped exposure effect, spherical spot effect, horizontal spot effect and horizontal geometric spot effect, for lens light leakage effect, center strong exposure effect, center star-shaped exposure effect and spherical spot effect, the shape of the light sheet corresponding to the target halo effect type and the pixel position of the light sheet in the screen space can be determined, and then according to the distance field data between the virtual light source and the pixel position, the light sheet with the above shape is rendered at the pixel position to obtain a spot image corresponding to at least one target halo effect type among lens light leakage effect, center strong exposure effect, center star-shaped exposure effect and spherical spot effect. The above-mentioned spot image generation method is not applicable to the spot image generation of horizontal spot effect and horizontal geometric spot effect.

[0079] In some embodiments, when the target halo effect type includes a lens light leak effect, the shape of at least one light sheet of the lens light leak effect pair can be determined in a circular manner. Then, the light source position in the screen space is obtained, and the light source position in the screen space is the position where the light source is mapped on the screen. The UV coordinates of the screen pixels are used as the input of the length function, and the output of the length function is determined by the length function, and the output of the length function is multiplied by the UV coordinates of the screen pixels to obtain the distance (uvd) between the screen pixels and the light source in the screen. The length function is used to measure or return the length or number of elements of a data structure (such as a string, a list, an array, a vector, etc.). The UV coordinates (uvx) of the current pixel can be generated by the lerp function. Specifically, the UV coordinates of the screen pixels are used as the starting value, and uvd is used as the ending value. Interpolation is performed between UV and uvx according to a preset interpolation weight to obtain a new coordinate, which can represent the light sheet position corresponding to the lens light leak effect. The lerp function is used to interpolate between two values ​​to generate a new value between the two values. The lerp function is used to achieve smooth movement, rotation, scaling, and color gradient effects of objects. For example, in game development, it can be used to achieve effects such as smooth movement, rotation, and scaling of objects.

[0080] After determining the position of at least one light sheet corresponding to the lens light leakage effect, the second value can be determined according to the UV coordinates of the current pixel, the light source position, and the twenty-seventh preset coefficient; the second value and the twenty-eighth preset coefficient are subjected to a power operation to obtain a third value, wherein the power exponent of the power operation is the twenty-eighth preset coefficient; the difference between the twenty-ninth preset coefficient and the third value and the maximum value of the thirtieth preset coefficient are determined to obtain a fourth value; the product of the fourth value and the thirty-first preset coefficient is determined to obtain the dispersion performance of at least one light sheet in the RGB channels. Specifically, when determining the dispersion performance of different light sheets in different color channels, different parameter values ​​can be selected for the twenty-seventh preset coefficient and the thirty-first preset coefficient. Taking three light sheets as an example, the dispersion performance of the first light sheet in the RGB channels can be expressed by formula (4). For example, for the dispersion performance of the first light sheet in the R channel, the twenty-seventh preset coefficient can be selected as 0.2, and the thirtieth preset coefficient can be selected as 6.0; for the dispersion performance of the first light sheet in the G channel, the twenty-seventh preset parameter can be selected as 0.4, and the thirtieth preset coefficient can be selected as 5.0; for the dispersion performance of the first light sheet in the B channel, the twenty-seventh preset parameter can be selected as 0.6, and the thirtieth preset coefficient can be selected as 4.0.

[0081] f5=max(0.01-pow(length(uvx+0.2*Center), f5_radius),.0)*6.0;

[0082] f52=max(0.01-pow(length(uvx+0.4*Center), f5_radius),.0)*5.0;

[0083] f53=max(0.01-pow(length(uvx+0.6*Center), f5_radius),.0)*4.0; formula (4)

[0084] Among them, f5 represents the dispersion performance of the first light sheet in the R channel, f52 represents the dispersion performance of the first light sheet in the G channel, and f53 represents the dispersion performance of the first light sheet in the B channel. The max function is used to implement the maximum value operation. For example, if the max function input is (1, 2, 3), the max function output is 3. The pow function is used to implement the power operation. For example, if the pow function input is (x, y), the pow function output is x to the power of y.

[0085] The dispersion performance of the second light sheet in the RGB channels can be expressed by formula (5). For example, for the dispersion performance of the second light sheet in the R channel, the 27th preset coefficient can be selected as 0.3, and the 30th preset coefficient can be selected as 2.3; for the dispersion performance of the second light sheet in the G channel, the 27th preset parameter can be selected as 0.325, and the 30th preset coefficient can be selected as 3.0; for the dispersion performance of the second light sheet in the B channel, the 27th preset parameter can be selected as 0.35, and the 30th preset coefficient can be selected as 3.0.

[0086] f6=max(0.01-pow(length(uvx-0.3*Center),f6_radius),.0)*2.3;

[0087] f62=max(0.01-pow(length(uvx-0.325*Center),f6_radius),.0)*3.0;

[0088] f63 = max(0.01-pow(length(uvx-0.35*Center),f6_radius),.0)*3.0; Formula (5)

[0089] Among them, f6 represents the dispersion performance of the first light sheet in the R channel, f62 represents the dispersion performance of the first light sheet in the G channel, and f63 represents the dispersion performance of the first light sheet in the B channel.

[0090] The dispersion performance of the third light sheet in the RGB channels can be expressed by formula (6). For example, for the dispersion performance of the third light sheet in the R channel, the 27th preset coefficient can be selected as 0.4, and the 30th preset coefficient can be selected as 2.0; for the dispersion performance of the third light sheet in the G channel, the 27th preset parameter can be selected as 0.45, and the 30th preset coefficient can be selected as 3.0; for the dispersion performance of the third light sheet in the B channel, the 27th preset parameter can be selected as 0.5, and the 30th preset coefficient can be selected as 3.5.

[0091] f4=max(0.01-pow(length(uvx+0.4*Center),f4_radius),.0)*2.0;

[0092] f42=max(0.01-pow(length(uvx+0.45*Center),f4_radius),.0)*3.0;

[0093] f43 = max(0.01-pow(length(uvx+0.5*Center),f4_radius),.0)*3.5; Formula (6)

[0094] Among them, f4 represents the dispersion performance of the first light sheet in the R channel, f42 represents the dispersion performance of the first light sheet in the G channel, and f43 represents the dispersion performance of the first light sheet in the B channel.

[0095] In the above embodiment, uvx of different light sheets is different, and the difference in uvx is achieved by different interpolation in the lerp function.

[0096] Then, the dispersion performance of at least one light sheet in the RGB channel, the first preset color parameter and the first preset intensity parameter are multiplied to obtain a first product, and the distance field data between the virtual light source and the pixel position is multiplied by the second preset coefficient to obtain a second product, wherein the distance field data between the virtual light source and the pixel position can be the distance between the virtual light source and the pixel position determined by the distance function, and the distance function is used to determine the distance between two input points. The second product is added to the third preset coefficient to obtain a first sum, and the second product is divided by the first sum to obtain a first quotient value, which can be represented by a picture, and the first quotient is used to characterize the light spot image corresponding to the lens light leakage effect. Figure 5 It is a schematic diagram of the lens light leakage effect provided in an embodiment of the present application.

[0097] In some embodiments, when the target halo effect type includes a central strong exposure effect, the shape of the light sheet corresponding to the central strong exposure effect may be determined in a circular manner. The pixel position of the light sheet in the screen space is determined according to the position of the virtual light source in the screen space, that is, the position of the virtual light source in the screen space may be used as the pixel position of the light sheet in the screen space.

[0098] The above-mentioned method of rendering a light sheet with a shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a spot image corresponding to the target halo effect type may include: using the fourth preset coefficient, the distance field data between the virtual light source and the pixel position, the fifth preset coefficient and the sixth preset coefficient as inputs of the max function to obtain the output of the max function, using the output of the max function and the seventh preset coefficient as inputs of the pow function to obtain the output of the pow function, the max function is used to output the maximum value in the input data of the max function, and the pow function is used to implement power operation; rendering a light sheet with a shape at the pixel position according to the output of the pow function, the second preset color parameter, the second preset intensity parameter and the eighth preset coefficient to obtain a spot image corresponding to the target halo effect type.

[0099] Exemplarily, the distance field data between the virtual light source and the pixel position is multiplied by the fifth preset coefficient to obtain a third product, the fourth preset coefficient is subtracted from the third product to obtain a first difference, the first difference and the sixth preset coefficient are used as inputs of the max function to obtain the output value of the max function, wherein the max function is used to return the maximum value in a set of values, when the distance between the light source position and the current pixel position is large, the first difference may be a negative value, at this time, the max function can take the first difference as 0.0, thereby avoiding negative values. The preset coefficient is greater than 0, and can be used to control the diffusion range of the exposure effect. The smaller the preset coefficient value, the more concentrated the exposure effect is in the center. The output value of the max function and the seventh preset coefficient are used as inputs of the pow function to obtain the output value of the pow function, wherein the pow function is used to determine the specified power of a certain cardinality. The output value of the pow function, the second preset color parameter and the eighth preset coefficient are multiplied to obtain a fourth product. The fourth product is multiplied by the second preset intensity parameter to obtain a fifth product, and the fifth product can be represented by a picture, and the fifth product is used to characterize the spot image corresponding to the strong central exposure effect. The second preset color parameter may represent the color hue of the center strong exposure effect, and the second preset intensity parameter may be used to adjust the overall brightness of the center strong exposure effect. Figure 6 It is a schematic diagram of the central strong exposure effect provided by an embodiment of the present application.

[0100] In some embodiments, when the target halo effect type includes central star exposure, the third preset color coefficient and the sampled sample may be multiplied to obtain a star-shaped light spot. The sampled sample may be obtained by color sampling and texture sampling from a texture containing a star shape, and the sampled color of the sample may only be red. The star-shaped light spot may be an RGB color vector or other representation containing color, and the third preset color parameter is the color parameter of the star-shaped light spot.

[0101] Figure 7 The embodiment of this application provides Figure 4 A schematic diagram of an implementation flow of S402 in FIG. Figure 7 As shown, Figure 4 The illustrated S402 may include S701 to S703 .

[0102] S701 , rendering a light sheet having a shape at a pixel position according to distance field data between a virtual light source and a pixel position, a first preset contrast parameter, a first preset attenuation parameter, and a third preset intensity parameter to obtain a first image.

[0103] Exemplarily, the star-shaped light spot and the first preset contrast parameter can be used as inputs of the pow function, and the star-shaped light spot after contrast adjustment is output through the pow function, wherein the first preset contrast parameter is the contrast parameter of the star-shaped light spot. The first preset attenuation parameter can be divided by the distance field data between the virtual light source and the pixel position to obtain a second quotient value, and the second quotient value and the star-shaped light spot are multiplied to obtain a sixth product, and the value of the sixth product is assigned to the star-shaped light spot after contrast adjustment to obtain a star-shaped light spot after scaling, distance attenuation and contrast adjustment. The star-shaped light spot can be multiplied by the third preset intensity parameter to obtain a seventh product, and the value of the seventh product is assigned to the star-shaped light spot after scaling, distance attenuation and contrast adjustment to obtain a star-shaped light spot after adjusted exposure intensity, contrast and scaling and distance attenuation. The star-shaped light spot after adjusted exposure intensity, contrast and scaling and distance attenuation is the first image mentioned above, wherein the third preset intensity parameter can be used to adjust the overall brightness of the star-shaped light spot.

[0104] S702: Determine a second light blocking mask image according to the distance field data between the virtual light source and the pixel position, the second preset attenuation parameter, and the second preset contrast parameter.

[0105] Exemplarily, the second light blocking mask image is determined based on the distance field data between the virtual light source and the pixel position, the second preset attenuation parameter and the second preset contrast parameter. Specifically, the distance from the current pixel position to the light source position is determined, and then the second preset attenuation parameter is subtracted from the distance to obtain a second difference value, the second preset attenuation parameter and the preset coefficient are used as inputs of the max function, and the max function output value is determined by the max function, and the max function output value is subtracted from the second difference value to obtain a third difference value, and the third difference value and the second preset contrast parameter are used as inputs of the pow function, and the second light blocking mask image is output through the pow function, wherein the second preset contrast parameter is a contrast parameter of the second light blocking mask image.

[0106] S703, updating the first image according to the distance field data between the virtual light source and the pixel position, the second light blocking mask map, the fourth preset intensity parameter, the third preset color parameter and the ninth preset coefficient to obtain a spot image corresponding to the target halo effect type.

[0107] Exemplarily, the second preset color parameter, the second light blocking mask image, and the fourth preset intensity parameter are multiplied in sequence to obtain an eighth product, the eighth product is added to the first image to obtain a second sum, the sum of the distance field data between the virtual light source and the pixel position and the ninth preset coefficient is determined to obtain a third sum, and finally the second sum is divided by the third sum to obtain a third quotient value, which can be represented by a picture, and the third quotient value is used to characterize the spot image corresponding to the central star-shaped exposure effect. Figure 8 It is a schematic diagram of the central star-shaped exposure effect provided in an embodiment of the present application.

[0108] In some embodiments, when the target halo effect type includes a spherical spot effect, the color of the light sheet corresponding to the spherical spot effect may be initialized first, so that the color of the light sheet is black. The shape of at least one light sheet corresponding to the spherical spot effect is determined in a circular manner; and the pixel position of at least one light sheet in the screen space is determined. The specific method for determining the pixel position of at least one light sheet corresponding to the spherical spot effect in the screen space and determining the dispersion performance of at least one light sheet corresponding to the spherical spot effect can refer to the specific method for determining the pixel position of at least one light sheet corresponding to the lens light leakage effect in the screen space and determining the dispersion performance of at least one light sheet corresponding to the lens light leakage effect, which will not be repeated here.

[0109] The above-mentioned rendering of a light sheet with a shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a spot image corresponding to the target halo effect type may include: rendering a light sheet with a shape at the pixel position according to the dispersion performance of at least one light sheet, the distance field data between the virtual light source and the pixel position, the fifth preset intensity parameter, the fourth preset color parameter, the eleventh preset coefficient and the twelfth preset coefficient to obtain a spot image corresponding to the target halo effect type.

[0110] Exemplarily, the dispersion performance of at least one light sheet corresponding to the spherical light spot effect in the RGB channels can be determined according to formula (7).

[0111] Final_Color+=max(0.01-pow(length(uv+(Bubbles_Distance[Index]+Bubbles_Spot_Distance[Index])*light), Bubbles_Size[Index]), 0.0)*Bubbles_Emissive_Intensity[Index]*float3(1,0,0);

[0112] Final_Color+=max(0.01-pow(length(uv+Bubbles_Distance[Index]*light), Bubbles_Size[Index]), 0.0)*Bubbles_Emissive_Intensity[Index]*float3(0,1,0);

[0113] Final_Color+=max(0.01-pow(length(uv+(Bubbles_Distance[Index]-Bubbles_Spot_Distance[Index])*light)Bubbles_Size[Index]),0.0)*Bubbles_Emissive

[0114] _Intensity[Index]*float3(0,0,1; Formula (7)

[0115] The dispersion performance of the light sheet in the RGB channel, the fifth preset intensity parameter and the fourth preset color parameter are multiplied once to obtain a ninth product, the distance field data between the virtual light source and the pixel position is added to the eleventh preset coefficient to obtain a fourth sum, and the quotient of the ninth product and the fourth sum is determined to obtain a fourth quotient value, which can be represented by a picture and is used to characterize the spot image corresponding to the spherical spot effect. Fig. 9 It is a schematic diagram of the spherical light spot effect provided in an embodiment of the present application.

[0116] In some embodiments, when the target halo effect type includes a hexagonal light spot effect, the light spot color may be initialized to be black. First, the shape of at least one light sheet corresponding to the hexagonal light spot effect may be determined in a hexagonal manner. Then, the color of at least one light sheet corresponding to the hexagonal light spot effect may be determined according to formula (8).

[0117] Final_Color+=Get_Hex_Shape(UV,Light_Position*Hex_Block_Distance[Index

[0118] ],Hex_Block_Size[Index],Hex_Block_Color[Index].xyz) formula (8)

[0119] Among them, Get_Hex_Shape is a preset function that can output the color of at least one light sheet corresponding to the hexagonal light spot effect.

[0120] The sixth preset intensity parameter outputted by Get_Hex_Shape is multiplied to obtain the tenth product, the sum of the distance field data between the virtual light source and the pixel position and the thirteenth preset coefficient is determined to obtain the fifth sum, the quotient of the tenth product and the fifth sum is determined to obtain the fifth quotient value, which can be represented by a picture, and is used to characterize the spot image corresponding to the hexagonal spot effect. Fig.10 It is a schematic diagram of the hexagonal light spot effect provided by an embodiment of the present application.

[0121] Fig.11 FIG. 2 is another implementation flow diagram of the method for generating a halo effect provided in an embodiment of the present application. Fig.11 As shown, the method may also include S1101 to S1105.

[0122] S1101. Determine a pixel position of a light sheet corresponding to a horizontal light spot effect type in the screen space according to a position of a virtual light source in the screen space and a first preset offset parameter.

[0123] For example, the light spot color may be initialized to black, and then the pixel position of the light sheet in the screen space may be determined by formula (9).

[0124] UV = CenterUV + float2(0,Horizontal_Vertical_Offset[Index]) Formula (9)

[0125] Among them, float2 UV represents the pixel position of the light sheet in the screen space, CenterUV represents the position of the virtual light source in the screen space, Horizontal_Vertical_Offset[Index] represents the first preset offset parameter, and 0 is the preset coefficient.

[0126] S1102 : Determine a third light blocking mask image according to the pixel position of the light sheet in the screen space, the fourteenth preset coefficient, and the sixth preset color parameter.

[0127] Exemplarily, the pixel position of the light sheet in the screen space is used as the input of the length function, and the output of the length function is determined by the length function. The product of the output of the length function and the fourteenth preset coefficient is used as the input of the saturate function, and the output of the saturate function is determined by the saturate function. The saturate function is used to limit (or "saturate") the input value to a preset range. When the input value exceeds the preset range, the saturate function sets it to the boundary value of the range. The output of the saturate function and the sixth preset color parameter are used as the input of the pow function to obtain the output value of the pow function, and the output value of the pow function can represent the third light occlusion mask map.

[0128] S1103 . Determine the lumen of the light sheet corresponding to the transverse light spot effect type according to the contribution of the light to the lumen of the light sheet.

[0129] Exemplarily, the lumen of the light sheet may be determined according to formula (10).

[0130] Horizontal_Mask=1.0-smoothstep(0.0,Horizontal_Shape_Edge_Fade_Out_X[Index],abs(UV.x)-Horizontal_Shape_Scale[Index])

[0131] Horizontal_Mask*=1.0-smoothstep(0.0,Horizontal_Shape_Edge_Fade_Out_Y[Index],abs(UV.y)) formula (10)

[0132] Among them, Horizontal_Mask represents the luminance of the light sheet, and the basic principle of the smoothstep function is to map the input value (which can be called x) to the output value (which can be called y). It uses a "buffer" to place the input value between two thresholds (which can be called a and b). If the input value falls outside the buffer, the output value will be set to 0 or 1, depending on the position of the input value in the buffer. If the input value falls within the buffer, the output value will change according to the position of the input value, thereby achieving a smooth transition from one range to another.

[0133] S1104. Render a light sheet with a shape at the pixel position according to the seventh preset color parameter, the preset intensity coefficient of the seventh preset color parameter, the eighth preset color parameter, the preset intensity coefficient of the eighth preset color parameter, the third light blocking mask map, the lumen and the seventh preset intensity parameter to obtain a light spot image corresponding to the horizontal light spot effect type.

[0134] Exemplarily, a linear interpolation (lerp) function can be used to interpolate between the internal color and the external color according to the third light blocking mask map to obtain the output of the lerp function. Specifically, the starting value is the product of the seventh preset color parameter and the preset intensity coefficient of the seventh preset color parameter, the ending value is the product of the eighth preset color parameter and the preset intensity coefficient of the eighth preset color parameter, the interpolation is the third light blocking mask map, and the output of the lerp function is determined by the lerp function. The lumen of the light sheet is used as the input of the saturate function, and the output of the saturate function is determined by the saturate function. The output of the saturate function is multiplied by the output of the lerp function to obtain an eleventh product, and the eleventh product is multiplied by the seventh preset intensity parameter to obtain a twelfth product. The twelfth product can be represented by a picture, and the twelfth product is used to characterize the spot image corresponding to the transverse spot effect type. Fig.12 It is a schematic diagram of a spot image corresponding to the transverse spot effect type provided in an embodiment of the present application.

[0135] S1105 , rendering and displaying the spot image corresponding to the target halo effect type and the spot image corresponding to the horizontal spot effect type.

[0136] Exemplarily, after determining the spot image corresponding to the transverse spot effect type, the occlusion property of the spot image corresponding to the transverse spot effect type may be determined. If the spot image corresponding to the transverse spot effect type is a halo effect type that requires the halo effect to be partially blocked by a virtual object, the spot image corresponding to the transverse spot effect type and the spot image corresponding to the first target halo effect type are superimposed. If the spot image corresponding to the transverse spot effect type is a halo effect type that does not require the halo effect to be partially blocked by a virtual object, the spot image corresponding to the transverse spot effect type and the spot image corresponding to the second target halo effect type are superimposed.

[0137] Fig.13 FIG. 1 is another implementation flow diagram of the method for generating a halo effect provided in an embodiment of the present application. Fig.13 As shown, the method may also include S1301 to S1306.

[0138] S1301. Determine the pixel position of the light sheet corresponding to the horizontal geometric light spot effect type in the screen space according to the position of the virtual light source in the screen space, index data, the first preset sensitivity parameter, the fifteenth preset coefficient, the sixteenth preset coefficient, the seventeenth preset coefficient and the second preset offset parameter.

[0139] Exemplarily, the color of the light spot can be initialized to black. The pixel position of the light sheet in the screen space is initialized to the position of the virtual light source in the screen space, and then the fourth value can be determined. The product of the fourth value and the first preset sensitivity parameter is determined to be the thirteenth product. The pixel position of the light sheet in the screen space can be determined by the thirteenth product and the position of the virtual light source in the screen space. For a specific method, refer to formula (11).

[0140] Seed1=Center.x+Center.y

[0141] Seed2=sin(Index+sin(Seed*Horizontal_Geo_Block_Camera_Sensitivity)-cos(Index*5.0)+sin(Index*2.0+0.3))

[0142] BlockUV.x += Seed2 * Horizontal_Geo_Moveable_Distance formula (11)

[0143] Among them, Seed2 is the fourth value mentioned above, Horizontal_Geo_Moveable_Distance represents the first preset sensitivity parameter, Center represents the virtual light source position, BlockUV.x can represent the pixel position of the light sheet in the screen space, 5.0 is the fifteenth preset coefficient, 2.0 is the sixteenth preset coefficient, and 0.3 is the seventeenth preset coefficient.

[0144] S1302. Determine the attenuation parameter of the light sheet corresponding to the horizontal geometric light spot effect type according to the index data, the pixel position of the light sheet in the screen space, the second preset sensitivity parameter, the eighteenth preset coefficient, the nineteenth preset coefficient, the twentieth preset coefficient, the twenty-first preset coefficient and the third preset sensitivity parameter.

[0145] Exemplarily, the quotient of the twenty-first preset coefficient and the third preset sensitivity parameter can be determined to obtain a sixth quotient value, the quotient of the fourth value and the sixth quotient value can be determined to obtain a seventh quotient value, and the absolute value of the seventh quotient value can be determined, and the absolute value of the seventh quotient value can represent the attenuation parameter of the light sheet.

[0146] S1303: Determine a shape of the light sheet corresponding to the horizontal geometric spot effect type according to the attenuation parameter of the light sheet, the pixel position of the light sheet in the screen space, the first preset size parameter, the second preset size parameter, and the twenty-second preset coefficient.

[0147] For example, the shape of the light sheet can be determined by a preset function Create_Box_DistanceField function. For a specific method, refer to formula (12).

[0148] Box=Create_Box_DistanceField(BlockUV,float2(Horizontal_Geo_Block_Size_X[Index],Horizontal_Geo_Block_Size_Y[Index])+float2(Random_Scale,0))

[0149] Formula (12)

[0150] Among them, Create_Box_DistanceField represents the preset function, BlockUV represents the pixel position of the light sheet in the screen space, (Horizontal_Geo_Block_Size_X[Index] represents the first preset size parameter, Horizontal_Geo_Block_Size_Y[Index]) represents the second preset size parameter, Random_Scale represents the attenuation parameter of the light sheet, and 0 represents the twenty-second preset coefficient.

[0151] S1304, determining the color of the light sheet corresponding to the horizontal geometric light spot effect type according to the attenuation parameter of the light sheet, the twenty-third preset coefficient, the twenty-fourth preset coefficient, the pixel position of the light sheet in the screen space and the second preset offset parameter, the twenty-fifth preset coefficient, the twenty-sixth preset coefficient, the third preset attenuation parameter, the fourth preset attenuation parameter, the ninth preset color parameter and the shape of the light sheet.

[0152] Exemplarily, the color of the light sheet can be determined according to formula (12).

[0153] Random_Light=saturate(Random_Seed)*0.6+0.4;

[0154] Random_Light*=saturate(-(abs(CenterUV.x)-Horizontal_Geo_Moveable_Distance));

[0155] Final_Color+=(1.0-smoothstep(0,Horizontal_Geo_Edge_Fade_Out,Box))*step(Box,Horizontal_Geo_Edge_Fade_Out)*Horizontal_Geo_Block_Color[Index].xyz*Random_Light formula (12)

[0156] Among them, Final_Color represents the color of the light sheet, Horizontal_Geo_Moveable_Distance represents the second preset offset parameter, Horizontal_Geo_Edge_Fade_Out represents the third preset attenuation parameter, Horizontal_Geo_Edge_Fade_Out represents the fourth preset attenuation parameter, and Horizontal_Geo_Block_Color[Index] represents the ninth preset color parameter.

[0157] S1305 , rendering a light sheet having a shape at a pixel position according to the second preset offset parameter, the third preset offset parameter, the color of the light sheet, and the eighth preset intensity parameter, to obtain a light spot image corresponding to the horizontal geometric light spot effect type.

[0158] Exemplarily, the difference between the absolute value of the pixel position of the light sheet in the screen space and the second preset offset parameter is determined to be a fourth difference, the quotient of the fourth difference and the second preset offset parameter is an eighth quotient, and the opposite of the eighth quotient is determined. The opposite of the eighth quotient is used as the input of the saturate function, and the output value of the saturate function is determined by the saturate function. The output value of the saturate function and the third preset offset parameter are used as the input of the pow function to obtain the output of the pow function, and then the output of the pow function is determined. The product of the color of the light sheet and the eighth preset intensity parameter is determined to obtain the eighteenth product, and the product of the eighteenth product and the output of the pow function is determined to obtain the nineteenth product. The nineteenth product can be represented by a picture, and the nineteenth product is used to characterize the spot image corresponding to the horizontal geometric spot effect. Fig.14 It is a schematic diagram of a spot image corresponding to the horizontal geometric spot effect type provided in an embodiment of the present application.

[0159] S1306 , rendering and displaying the spot image corresponding to the target halo effect type and the spot image corresponding to the horizontal geometric spot effect type.

[0160] Exemplarily, after determining the spot image corresponding to the transverse geometric spot effect type, the occlusion property of the spot image corresponding to the transverse geometric spot effect type can be determined. If the spot image corresponding to the transverse geometric spot effect type is a halo effect type that requires the halo effect to be partially blocked by the virtual object, the spot image corresponding to the transverse geometric spot effect type and the spot image corresponding to the first target halo effect type are superimposed. If the spot image corresponding to the transverse geometric spot effect type belongs to a halo effect type that does not require the halo effect to be partially blocked by the virtual object, the spot image corresponding to the transverse geometric spot effect type and the spot image corresponding to the second target halo effect type are superimposed.

[0161] Corresponding to the halo effect generating method of the present application, the second embodiment of the present application further provides a halo effect generating device, such as Fig.15 As shown, the halo effect generating device 1500 includes:

[0162] A determination unit 1501 is used to determine a target halo effect type to be applied;

[0163] The determining unit 1501 is further used to determine the shape of the light sheet corresponding to the target halo effect type;

[0164] A generating unit 1502 is used to generate a light spot image corresponding to a target halo effect type according to a shape of the light sheet and distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is a target halo effect type representing a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type is a target halo effect type representing a halo effect that does not need to be partially blocked by a virtual object;

[0165] The rendering unit 1503 is used to render and display the spot image corresponding to the target halo effect type.

[0166] Optionally, the rendering unit 1503 is specifically used to determine the occlusion attribute corresponding to the target halo effect type according to the virtual light source in the virtual scene and the virtual object of the virtual scene, and the occlusion attribute is used to characterize that the target halo effect type is the first target halo effect type or the second target halo effect type; rendering and display are performed based on the occlusion attribute corresponding to the target halo effect type and the spot image corresponding to the target halo effect type.

[0167] Optionally, the rendering unit 1503 is specifically used to superimpose the spot images corresponding to the first target halo effect type to obtain a first superimposed spot image; perform color processing on the first superimposed spot image according to the virtual object to obtain a second superimposed spot image; superimpose the spot images corresponding to the second target halo effect type to obtain a third superimposed spot image; superimpose the second superimposed spot image and the third superimposed spot image to obtain a spot image with a composite halo effect; and render and display the spot image based on the composite halo effect.

[0168] Optionally, the rendering unit 1503 is specifically configured to generate a first light blocking mask image according to the virtual object; and perform color processing on the first superimposed light spot image according to the first light blocking mask image to obtain a second superimposed light spot image.

[0169] Optionally, the generating unit 1502 is specifically configured to determine a pixel position of the light sheet in the screen space; render a light sheet having a shape at the pixel position according to distance field data between the virtual light source and the pixel position, and obtain a light spot image corresponding to a target halo effect type.

[0170] Optionally, the target halo effect type includes a lens light leak effect, and a determination unit 1501 is specifically used to determine the shape of at least one light sheet in a circular manner; a generation unit 1502 is specifically used to determine the pixel position of the light sheet in the screen space according to the distance between the virtual light source and the current pixel in the screen space, the position of the current pixel and a first preset coefficient; the determination unit 1501 is also used to determine the dispersion performance of at least one light sheet; the generation unit 1502 is specifically used to render a light sheet with a shape at the pixel position according to the dispersion performance of at least one light sheet, the distance field data between the virtual light source and the pixel position, the first preset color parameter, the first preset intensity parameter, the second preset coefficient and the third preset coefficient, to obtain a light spot image corresponding to the target halo effect.

[0171] Optionally, the target halo effect type includes a central strong exposure effect, a determination unit 1501, specifically used to determine the shape of the light sheet in a circular manner; a generation unit 1502, specifically used to determine the pixel position of the light sheet in the screen space according to the position of the virtual light source in the screen space; determine a first value according to a fourth preset coefficient, distance field data between the virtual light source and the pixel position, and a fifth preset coefficient; determine a maximum value of the first value and the sixth preset coefficient; perform a power operation on the first value and the maximum value of the sixth preset coefficient to obtain a second value, wherein the power exponent of the power operation is a seventh preset coefficient; render a light sheet with a shape at the pixel position according to the second value, a second preset color parameter, a second preset intensity parameter and an eighth preset coefficient to obtain a light spot image corresponding to the central strong exposure effect.

[0172] Optionally, the target halo effect type includes a central star-shaped exposure effect, and a determination unit 1501 is specifically used to sample a texture storing a preset shape to obtain a sampled sample; determine the shape of a light sheet corresponding to the target halo effect according to the sampled sample; a generation unit 1502 is specifically used to determine the pixel position of the light sheet in the screen space according to the sampled sample, a virtual light source and a preset density parameter; render a light sheet with a shape at the pixel position according to the distance field data between the virtual light source and the pixel position, a first preset contrast parameter, a first preset attenuation parameter and a third preset intensity parameter to obtain a first image; determine a second light blocking mask map according to the distance field data between the virtual light source and the pixel position, a second preset attenuation parameter and a second preset contrast parameter; update the first image according to the distance field data between the virtual light source and the pixel position, the second light blocking mask map, the fourth preset intensity parameter, the third preset color parameter and the ninth preset coefficient to obtain a light spot image corresponding to the central star-shaped exposure effect.

[0173] Optionally, the target halo effect type includes a spherical spot effect, and the determination unit 1501 is specifically used to determine the shape of at least one light sheet in a circular manner; the generation unit 1502 is specifically used to determine the pixel position of the light sheet in the screen space according to the distance between the virtual light source and the current pixel in the screen space, the position of the current pixel and the tenth preset coefficient; the determination unit 1501 is also used to determine the dispersion performance of at least one light sheet; the generation unit 1502 is specifically used to render a light sheet with a shape at the pixel position according to the dispersion performance of at least one light sheet, the distance field data between the virtual light source and the pixel position, the fifth preset intensity parameter, the fourth preset color parameter, the eleventh preset coefficient and the twelfth preset coefficient, to obtain a spot image corresponding to the spherical spot effect.

[0174] Optionally, the target halo effect type includes a hexagonal spot effect, and the determination unit 1501 is specifically used to determine the shape of at least one light sheet in a hexagonal manner; the generation unit 1502 is specifically used to determine the pixel position of the light sheet in the screen space according to the hexagonal signed distance field; according to the distance field data between the virtual light source and the pixel position, the pixel position of the light sheet in the screen space, the first preset size parameter, the fifth preset color parameter, the sixth preset intensity parameter and the thirteenth preset coefficient, the light sheet with a shape is rendered at the pixel position to obtain a spot image corresponding to the hexagonal spot effect.

[0175] Alternatively, if Fig.15 As shown, the halo effect generating device 1500 further includes: a processing unit 1504 .

[0176] The processing unit 1504 is used to determine the pixel position of the light sheet corresponding to the horizontal light spot effect type in the screen space according to the position of the virtual light source in the screen space and the first preset offset parameter; determine the third light blocking mask map according to the pixel position of the light sheet in the screen space, the fourteenth preset coefficient and the sixth preset color parameter; determine the lumen of the light sheet according to the contribution of light to the lumen of the light sheet; render the light sheet corresponding to the horizontal light spot effect type at the pixel position according to the seventh preset color parameter, the preset intensity coefficient of the seventh preset color parameter, the eighth preset color parameter, the preset intensity coefficient of the eighth preset color parameter, the third light blocking mask map, the lumen and the seventh preset intensity parameter to obtain a light spot image corresponding to the horizontal light spot effect type; the rendering unit 1503 is specifically used to render and display based on the light spot image corresponding to the target halo effect type and the light spot image corresponding to the horizontal light spot effect type.

[0177] Optionally, the processing unit 1504 is further used to determine the pixel position of the light sheet corresponding to the horizontal geometric spot effect type in the screen space according to the position of the virtual light source in the screen space, the index data, the first preset sensitivity parameter, the fifteenth preset coefficient, the sixteenth preset coefficient, the seventeenth preset coefficient and the second preset offset parameter; determine the attenuation parameter of the light sheet corresponding to the horizontal geometric spot effect type according to the index data, the pixel position of the light sheet in the screen space, the second preset sensitivity parameter, the eighteenth preset coefficient, the nineteenth preset coefficient, the twentieth preset coefficient, the twenty-first preset coefficient and the third preset sensitivity parameter; determine the horizontal geometric spot effect type according to the attenuation parameter of the light sheet, the pixel position of the light sheet in the screen space, the second preset size parameter, the third preset size parameter and the nineteenth preset coefficient. type; determine the color of the light sheet corresponding to the horizontal geometric spot effect type according to the attenuation parameter of the light sheet, the twenty-second preset coefficient, the twenty-third preset coefficient, the pixel position of the light sheet in the screen space and the second preset offset parameter, the twenty-fourth preset coefficient, the twenty-fifth preset coefficient, the third preset attenuation parameter, the fourth preset attenuation parameter, the ninth preset color parameter and the shape of the light sheet; render the light sheet corresponding to the horizontal geometric spot effect type with a shape at the pixel position according to the second preset offset parameter, the third preset offset parameter, the color of the light sheet and the eighth preset intensity parameter to obtain a spot image corresponding to the horizontal geometric spot effect type; a rendering unit 1503 is specifically used to render and display based on the spot image corresponding to the target halo effect type and the spot image corresponding to the horizontal geometric spot effect type.

[0178] Corresponding to the method for generating a halo effect provided in the first embodiment of the present application, the third embodiment of the present application further provides an electronic device for generating a halo effect.

[0179] like Fig.16 , which is a structural block diagram of an example of an electronic device for a method for generating a halo effect provided in an embodiment of the present application.

[0180] In this embodiment, an optional hardware structure of the electronic device 1600 can be as follows: Figure 5 As shown, it includes: at least one processor 1601, at least one memory 1602 and at least one communication bus 1605; the memory 1602 contains a program 1603 and data 1604.

[0181] The bus 1605 may be a communication device for transmitting data between components inside the electronic device 1600, such as an internal bus (e.g., a CPU-memory bus, where the processor is a central processing unit, CPU for short), an external bus (e.g., a universal serial bus port, a peripheral component interconnect express port), etc.

[0182] In addition, the electronic device also includes: at least one network interface 1606, at least one peripheral interface 1607. The network interface 1606 provides wired or wireless communication related to an external network 1608 (for example, the Internet, an intranet, a local area network, a mobile communication network, etc.); in some embodiments, the network interface 1606 may include any number of network interface controllers (NICs), radio frequency (RF) modules, repeaters, transceivers, modems, routers, gateways, any combination of wired network adapters, wireless network adapters, Bluetooth adapters, infrared adapters, near field communication (NFC) adapters, cellular network chips, etc.

[0183] The peripheral interface 1607 is used to connect to the peripheral device, and the peripheral device can be the peripheral device 1 ( Fig.16 1609 in), peripheral 2 ( Fig.16 1610) and peripheral 3 ( Fig.16 1611 in the figure). Peripherals are peripheral devices, which may include but are not limited to cursor control devices (such as mice, touch pads or touch screens), keyboards, displays (such as cathode ray tube displays, liquid crystal displays). Displays or light emitting diode displays, video input devices (such as cameras or communication interfaces coupled to video files), etc.

[0184] The processor 1601 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.

[0185] The memory 1602 may include a high-speed RAM (full name: Random Access Memory) memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0186] The processor 1601 calls the program and data stored in the memory 1602 and executes the following steps:

[0187] determining the type of target halo effect to be applied;

[0188] Determine the shape of the light sheet corresponding to the target halo effect type;

[0189] Generate a light spot image corresponding to a target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is a target halo effect type representing a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type is a target halo effect type representing a halo effect that does not need to be partially blocked by a virtual object;

[0190] Rendering and display are performed based on the spot image corresponding to the target halo effect type.

[0191] Corresponding to the halo effect generating method provided in the first embodiment of the present application, the fourth embodiment of the present application provides a computer-readable storage medium storing a program of the halo effect generating method, the program is executed by a processor to perform the following steps:

[0192] determining the type of target halo effect to be applied;

[0193] Determine the shape of the light sheet corresponding to the target halo effect type;

[0194] Generate a light spot image corresponding to a target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is a target halo effect type representing a halo effect that needs to be partially blocked by a virtual object, and the second target halo effect type is a target halo effect type representing a halo effect that does not need to be partially blocked by a virtual object;

[0195] Rendering and display are performed based on the spot image corresponding to the target halo effect type.

[0196] It should be noted that for the detailed description of the devices, electronic devices and computer-readable storage media provided in the second, third and fourth embodiments of the present application, reference can be made to the relevant description of the first embodiment of the present application, and no further details will be given here.

[0197] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.

[0198] In a typical configuration, a node device in a blockchain includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0199] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0200] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), random access memory (RAM) of other attributes, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage media or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.

[0201] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0202] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.

Claims

1. A method for generating a halo effect, characterized in that: The method comprises: determining the target halo effect type to be applied; Determine the shape of the light sheet corresponding to the target halo effect type; generating a light spot image corresponding to the target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is the target halo effect type representing the halo effect that needs to be partially blocked by the virtual object, and the second target halo effect type is the target halo effect type representing the halo effect that does not need to be partially blocked by the virtual object; Rendering and display are performed based on the spot image corresponding to the target halo effect type.

2. The method according to claim 1, characterized in that The rendering and displaying of the spot image corresponding to the target halo effect type includes: Determining, according to a virtual light source in a virtual scene and a virtual object of the virtual scene, an occlusion attribute corresponding to the target halo effect type, wherein the occlusion attribute is used to characterize that the target halo effect type is the first target halo effect type or the second target halo effect type; Rendering and display are performed based on the occlusion attribute corresponding to the target halo effect type and the spot image corresponding to the target halo effect type.

3. The method according to claim 2, characterized in that The rendering and displaying based on the occlusion attribute corresponding to the target halo effect type and the spot image corresponding to the target halo effect type includes: Superimposing the spot images corresponding to the first target halo effect type to obtain a first superimposed spot image; Performing color processing on the first superimposed light spot image according to the virtual object to obtain a second superimposed light spot image; Superimposing the spot images corresponding to the second target halo effect type to obtain a third superimposed spot image; Superimposing the second superimposed light spot image and the third superimposed light spot image to obtain a light spot image with a composite halo effect; The spot image based on the composite halo effect is rendered and displayed.

4. The method according to claim 3, characterized in that The step of performing color processing on the first superimposed light spot image according to the virtual object to obtain a second superimposed light spot image includes: Generate a first light blocking mask map according to the virtual object; The first superimposed light spot image is color processed according to the first light blocking mask image to obtain a second superimposed light spot image.

5. The method according to claim 1, characterized in that The step of generating a light spot image corresponding to the target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet comprises: Determining a pixel position of the light sheet in screen space; The light sheet having the shape is rendered at the pixel position according to the distance field data between the virtual light source and the pixel position, so as to obtain a light spot image corresponding to the target halo effect type.

6. The method according to claim 5, characterized in that The target halo effect type includes a lens light leakage effect, and determining the shape of the light sheet corresponding to the target halo effect type includes: determining the shape of at least one of the light sheets in a circular manner; Determining the pixel position of the light sheet in the screen space includes: Determine the pixel position of the light sheet in the screen space according to the distance between the virtual light source and the current pixel in the screen space, the position of the current pixel and a first preset coefficient; Before rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type, the method further includes: determining a dispersion performance of at least one of the light sheets; The step of rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type includes: According to the dispersion performance of at least one of the light sheets, the distance field data between the virtual light source and the pixel position, the first preset color parameter, the first preset intensity parameter, the second preset coefficient and the third preset coefficient, the light sheet having the shape is rendered at the pixel position to obtain a light spot image corresponding to the lens light leakage effect.

7. The method according to claim 5, characterized in that The target halo effect type includes a central strong exposure effect, and determining a shape of a light sheet corresponding to the target halo effect type includes: Determining the shape of the light sheet in a circular manner; Determining the pixel position of the light sheet in the screen space includes: Determining a pixel position of the light sheet in the screen space according to the position of the virtual light source in the screen space; The step of rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type includes: Determine a first value according to a fourth preset coefficient, distance field data between the virtual light source and the pixel position, and a fifth preset coefficient; Determining a maximum value of the first value and a sixth preset coefficient; Performing a power operation on the first value and the maximum value of the sixth preset coefficient to obtain a second value, wherein the power exponent of the power operation is the seventh preset coefficient; The light sheet having the shape is rendered at the pixel position according to the second value, the second preset color parameter, the second preset intensity parameter and the eighth preset coefficient to obtain a light spot image corresponding to the central strong exposure effect.

8. The method according to claim 5, characterized in that The target halo effect type includes a central star-shaped exposure effect, and determining the shape of the light sheet corresponding to the target halo effect type includes: Sampling a texture storing a preset shape to obtain a sampling sample; Determining the shape of the light sheet corresponding to the central star-shaped exposure effect according to the sampling sample; Determining the pixel position of the light sheet in the screen space includes: Determine a pixel position of the light sheet in the screen space according to the sample, the virtual light source and a preset density parameter; The step of rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type includes: Rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position, a first preset contrast parameter, a first preset attenuation parameter, and a third preset intensity parameter to obtain a first image; Determining a second light blocking mask image according to the distance field data between the virtual light source and the pixel position, a second preset attenuation parameter and a second preset contrast parameter; According to the distance field data between the virtual light source and the pixel position, the second light blocking mask map, the fourth preset intensity parameter, the third preset color parameter and the ninth preset coefficient, the first image is updated to obtain a light spot image corresponding to the central star-shaped exposure effect.

9. The method according to claim 5, characterized in that The target halo effect type includes a spherical spot effect, and determining the shape of the light sheet corresponding to the target halo effect type includes: determining the shape of at least one of the light sheets in a circular manner; Determining the pixel position of the light sheet in the screen space includes: Determine the pixel position of the light sheet in the screen space according to the distance between the virtual light source and the current pixel in the screen space, the position of the current pixel and a tenth preset coefficient; Before rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type, the method further includes: determining a dispersion performance of at least one of the light sheets; The step of rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type includes: According to the dispersion performance of at least one of the light sheets, the distance field data between the virtual light source and the pixel position, the fifth preset intensity parameter, the fourth preset color parameter, the eleventh preset coefficient and the twelfth preset coefficient, the light sheet having the shape is rendered at the pixel position to obtain a light spot image corresponding to the spherical light spot effect.

10. The method according to claim 5, characterized in that The target halo effect type includes a hexagonal light spot effect, and determining the shape of the light sheet corresponding to the target halo effect type includes: Determining the shape of at least one of the light sheets in a hexagonal manner; Determining the pixel position of the light sheet in the screen space includes: Determine a pixel position of the light sheet in screen space according to the hexagonal signed distance field; The step of rendering the light sheet having the shape at the pixel position according to the distance field data between the virtual light source and the pixel position to obtain a light spot image corresponding to the target halo effect type includes: According to the distance field data between the virtual light source and the pixel position, the pixel position of the light sheet in the screen space, the first preset size parameter, the fifth preset color parameter, the sixth preset intensity parameter and the thirteenth preset coefficient, the light sheet having the shape is rendered at the pixel position to obtain a light spot image corresponding to the hexagonal light spot effect.

11. The method according to claim 1, characterized in that The method further comprises: Determining a pixel position in the screen space where a light sheet corresponding to a transverse light spot effect type is located according to the position of the virtual light source in the screen space and a first preset offset parameter; Determine a third light blocking mask image according to the pixel position of the light sheet in the screen space, a fourteenth preset coefficient and a sixth preset color parameter; Determine the lumen of the light sheet corresponding to the transverse light spot effect type according to the contribution of the light to the lumen of the light sheet; According to the seventh preset color parameter, the preset intensity coefficient of the seventh preset color parameter, the eighth preset color parameter, the preset intensity coefficient of the eighth preset color parameter, the third light blocking mask image, the lumen and the seventh preset intensity parameter, rendering the light sheet corresponding to the horizontal light spot effect type at the pixel position to obtain a light spot image corresponding to the horizontal light spot effect type; The rendering and displaying of the spot image corresponding to the target halo effect type includes: Rendering and display are performed based on the spot image corresponding to the target halo effect type and the spot image corresponding to the horizontal spot effect type.

12. The method according to claim 1, characterized in that The method further comprises: Determine the pixel position of the light sheet corresponding to the horizontal geometric spot effect type in the screen space according to the position of the virtual light source in the screen space, the index data, the first preset sensitivity parameter, the fifteenth preset coefficient, the sixteenth preset coefficient, the seventeenth preset coefficient, and the second preset offset parameter; Determine the attenuation parameter of the light sheet corresponding to the horizontal geometric spot effect type according to the index data, the pixel position of the light sheet in the screen space, the second preset sensitivity parameter, the eighteenth preset coefficient, the nineteenth preset coefficient, the twentieth preset coefficient, the twenty-first preset coefficient and the third preset sensitivity parameter; Determining a shape of the light sheet corresponding to the horizontal geometric spot effect type according to the attenuation parameter of the light sheet, the pixel position of the light sheet in the screen space, the second preset size parameter, the third preset size parameter and the nineteenth preset coefficient; Determine the color of the light sheet corresponding to the horizontal geometric light spot effect type according to the attenuation parameter of the light sheet, the twenty-second preset coefficient, the twenty-third preset coefficient, the pixel position of the light sheet in the screen space and the second preset offset parameter, the twenty-fourth preset coefficient, the twenty-fifth preset coefficient, the third preset attenuation parameter, the fourth preset attenuation parameter, the ninth preset color parameter and the shape of the light sheet; According to the second preset offset parameter, the third preset offset parameter, the color of the light sheet and the eighth preset intensity parameter, rendering a light sheet corresponding to the horizontal geometric light spot effect type having the shape at the pixel position to obtain a light spot image corresponding to the horizontal geometric light spot effect type; The rendering and displaying of the spot image corresponding to the target halo effect type includes: Rendering and display are performed based on the spot image corresponding to the target halo effect type and the spot image corresponding to the horizontal geometric spot effect type.

13. The method according to claim 1, characterized in that The determining of the target halo effect type to be applied includes: According to the virtual light source and the current presentation field of view, a target halo effect type to be applied is determined from a plurality of preconfigured halo effect types.

14. A halo effect generating device, characterized in that: The device comprises: a determination unit, used to determine a target halo effect type to be applied; The determination unit is further used to determine the shape of the light sheet corresponding to the target halo effect type; a generating unit, configured to generate a light spot image corresponding to the target halo effect type according to the shape of the light sheet and the distance field data between the virtual light source and the light sheet, wherein the target halo effect type includes a first target halo effect type and / or a second target halo effect type, the first target halo effect type is the target halo effect type representing the halo effect that needs to be partially blocked by the virtual object, and the second target halo effect type is the target halo effect type representing the halo effect that does not need to be partially blocked by the virtual object; A rendering unit is used to render and display the spot image corresponding to the target halo effect type.

15. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 13 is executed.

16. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 13.