Image rendering method and device, electronic equipment, storage medium and program product

By generating multiple halo layers and performing brightness perturbation processing, the problem of insufficient natural randomness and flexibility in halo rendering methods is solved, achieving a more layered and realistic halo rendering effect that adapts to the needs of different resolutions and dynamic viewing angles.

CN122199709APending Publication Date: 2026-06-12GUANGZHOU BOGUAN TELECOMM TECH LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU BOGUAN TELECOMM TECH LTD
Filing Date
2026-01-27
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing halo rendering methods are insufficient in terms of natural randomness and flexibility, resulting in halo effects that are highly static, have poor scalability, and are highly dependent on resources, making it difficult to meet the needs of different screen resolutions and dynamic viewing angles.

Method used

By generating multiple halo layers and determining the size and relative position of the halo layers based on preset generation rules, combined with brightness perturbation processing, the phenomenon of scattering halo superposition in the real atmosphere is simulated, reducing texture loading and resource overhead.

🎯Benefits of technology

It improves the visual dynamism, naturalness, and realism of halo rendering, enhances the flexibility and cross-platform adaptability of rendering effects, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199709A_ABST
    Figure CN122199709A_ABST
Patent Text Reader

Abstract

The present disclosure provides an image rendering method, device, electronic equipment, storage medium and program product, relating to the technical field of rendering, and the image rendering method comprises: generating a plurality of light ring layers in a scene; obtaining a first position of a light source and a second position of a first pixel point, wherein the first pixel point is a specified pixel point in the scene; for each light ring layer, determining a first brightness corresponding to the first pixel point based on the size of the light ring layer and the first relative position, the first position and the second position; performing brightness perturbation processing on the first brightness to obtain a target brightness of the first pixel point in the light ring layer, and rendering the first pixel point in the scene based on the target brightness of all light ring layers. Compared with related technologies, the present disclosure can achieve controllable and natural halo rendering effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of rendering technology, specifically to image rendering methods, apparatus, electronic devices, storage media, and program products. Background Technology

[0002] Sun halos are a common optical visual effect in game engines, film and television special effects, and virtual reality scenes. By simulating the scattering and refraction of light in the atmosphere, they can significantly enhance the realism, depth, and atmosphere of an image, and are widely used in high dynamic range lighting, open-world games, and realistic film and television rendering. However, current halo rendering methods have technical limitations in terms of natural randomness and flexibility, and there is an urgent need to optimize them. Summary of the Invention

[0003] This disclosure provides an image rendering method, apparatus, electronic device, storage medium, and program product to solve the problems of lack of natural randomness and flexibility in halo rendering in related technologies.

[0004] In a first aspect, this disclosure provides an image rendering method, the method comprising:

[0005] Multiple halo layers are generated in the scene. The size of the halo layer and the first relative position between the halo layer and the light source are determined based on preset generation rules. Obtain the first position of the light source and the second position of the first pixel, where the first pixel is one of the pixels in the scene; For each halo layer, the first brightness corresponding to the first pixel is determined based on the size of the halo layer and the first relative position, the first position and the second position; The first brightness is perturbed to obtain the target brightness of the first pixel in the halo layer. The first pixel in the scene is then rendered based on the target brightness of all halo layers.

[0006] Secondly, this disclosure provides an image rendering apparatus, the apparatus comprising: The generation module is used to generate multiple halo layers in the scene. The size of the halo layer and the first relative position between the halo layer and the light source are determined based on preset generation rules. The acquisition module is used to acquire the first position of the light source and the second position of the first pixel, wherein the first pixel is one of the pixels in the scene; The determination module is used to determine the first brightness of the first pixel in each of the multiple halo layers based on the size of the halo layers and the first relative position, the first position and the second position; The rendering module is used to perform brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer, and to render the first pixel in the scene based on the target brightness of all halo layers.

[0007] Thirdly, this disclosure provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the image rendering method described in the first aspect or any corresponding embodiment thereof.

[0008] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to perform the image rendering method described in the first aspect or any corresponding embodiment thereof.

[0009] Fifthly, this disclosure provides a computer program product, including computer instructions for causing a computer to execute the image rendering method described in the first aspect or any corresponding embodiment thereof.

[0010] In the image rendering method provided in this disclosure, the size of the halo layer and the relative position between the halo layer and the light source are generated based on preset generation rules. This eliminates the need to rely on a fixed pre-made halo, reducing the mechanical feel caused by repeated texture use and minimizing the resource overhead of texture loading. The generated multiple halo layers can simulate the complex optical phenomenon of a solar halo formed by the superposition of multi-layered randomly distributed scattering rings in the real atmosphere, making the halo more layered and enhancing the visual dynamism, naturalness, and realism of the rendering effect. Furthermore, a first brightness is determined based on the size, first relative position, first position, and second position. The brightness of a pixel is associated with the actual spatial position of the light source and the halo layer, allowing the pixel brightness to naturally decay with its spatial position. Simultaneously, brightness perturbation processing is applied to the first brightness, further improving the flexibility of image rendering and resulting in a more realistic effect compared to the simple brightness superposition in related technologies. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this disclosure; Figure 2This is a first flowchart of an image rendering method according to an embodiment of the present disclosure; Figure 3 This is a second flowchart of an image rendering method according to an embodiment of the present disclosure; Figure 4 This is a third flowchart of an image rendering method according to an embodiment of the present disclosure; Figure 5 This is a structural block diagram of an image rendering apparatus according to an embodiment of the present disclosure; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

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

[0014] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0015] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this disclosure, "a plurality of" means two or more, unless otherwise expressly specified.

[0016] A sun halo is an optical visual characteristic commonly found in game engines, film and television special effects, and virtual reality environments, used to simulate the optical phenomenon formed by light scattering in the atmosphere. As a core optical effect in rendered scenes, its visual performance directly affects the realism and immersion of the image. Related technologies utilize texture-based halo rendering methods, which use pre-rendered lens flare textures to render sun halos. However, texture-based halo rendering methods have the following drawbacks: First, the generated halo effect is highly dependent on the pre-rendered fixed texture, resulting in a strong static nature and a lack of natural randomness and physical variation. Second, when using different screen resolutions, dynamic viewpoint switching, or changes in lighting parameters, problems such as edge blurring and stretching distortion easily occur, making it difficult to maintain visual consistency across scenes. Third, texture-based halo rendering methods struggle to flexibly determine visual parameters such as the number of halos, brightness decay, and color gradations within the halo. Furthermore, simulating a halo simply by overlaying brightness lacks the restoration of physical laws such as atmospheric scattering and light refraction, failing to present natural physical responses in dynamic scenes, resulting in a mechanical and stiff halo effect. Fourthly, in terms of resources and performance, the texture-based halo rendering method requires loading multiple sets of high-resolution halo textures, which not only significantly increases the memory usage and resource loading time, but also increases the difficulty of cross-platform adaptation, making it difficult to meet the needs of lightweight operating scenarios such as mobile devices and embedded devices.

[0017] Therefore, optimizing the halo rendering effect and solving problems such as strong staticity, poor scalability, high resource dependence, and limited parameter control of halos are the current focus of the virtual scene rendering field.

[0018] As an optional application scenario of this invention, the specific application environment architecture or specific hardware architecture on which the image rendering method depends is described herein. For example... Figure 1 As shown, the architecture may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0019] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0020] According to an embodiment of this disclosure, an image rendering method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0021] This embodiment provides an image rendering method that can be used in the aforementioned terminal device. Figure 2 This is a flowchart of an image rendering method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps: S201 generates multiple halo layers in the scene.

[0022] The size of the halo layer and the first relative position between the halo layer and the light source are determined based on a preset generation rule.

[0023] Specifically, the size of the halo layer can be understood as the radius, diameter, etc., of the halo, which determines the coverage area of ​​the halo layer. The larger the size, the more pixels the halo layer covers, resulting in a wider and softer visual effect; the smaller the size, the more concentrated the halo layer coverage, resulting in a sharper visual effect.

[0024] The first relative position is the offset position of the halo in the halo layer relative to the center of the light source. It reflects the relative positional relationship between the halo layer and the light source and can show how far the halo layer is from the light source.

[0025] Preset generation rules are used to generate the size of the light source and its first relative position. For example, when the halo layer is outside the light source (i.e., away from the center of the screen), the first relative position can be set to a positive value, and when the halo layer is inside the light source (i.e., closer to the center of the screen), the first relative position can be set to a negative value.

[0026] In one possible implementation, the size and first relative position of the halo layer in the scene are generated using a random generation method. For example, random numbers are generated based on a preset pseudo-random number function. Further, the size and first relative position of the light source are generated based on the random numbers and preset constraints. The preset constraints can be that the generated size or first relative position conforms to its respective preset range, ensuring that the generated size and first relative position are both random and within a controllable preset range.

[0027] In another possible implementation, the size of the halo layer in the scene can be generated according to a preset ratio. For example, the size of the halo layer can be generated as 1.2 times, 1.3 times, etc., of a preset base size. The first relative positions are evenly distributed at fixed angles, such as dividing 360 degrees into 6 directions.

[0028] In addition, the size and first relative position of the halo layer in the scene can be specified according to actual needs.

[0029] In this embodiment, multiple halo layers are generated cyclically. One halo layer is generated within each cycle. The size of each halo layer and the first relative position between each halo layer and the light source are determined by a preset generation rule. Considering that sunlight passing through ice crystals or dust in the atmosphere will scatter and form multiple concentric or nearly concentric halos, this embodiment simulates the complex optical phenomenon of a solar halo formed by the superposition of multi-layered, randomly distributed scattering halos in the real atmosphere using multiple halo layers to enhance visual dynamism, naturalness, and realism. The size of these halos and the first relative position between light sources vary randomly, rather than being a single, rigid ring. This solves the problem of fixed ring shapes in texture-based halo rendering methods in related technologies, making the rendered halo more layered.

[0030] It should be noted that the specific implementation of determining the size of the halo layer and the first relative position between the halo layer and the light source based on the preset generation rules will be described in subsequent embodiments, and will not be repeated here.

[0031] S202, obtain the first position of the light source and the second position of the first pixel.

[0032] The first pixel is a specified pixel in the scene.

[0033] Specifically, the first pixel is a certain pixel in the scene. When the fragment shader executes pixel by pixel, the single pixel being calculated is the first pixel.

[0034] The first position refers to the position of the light source (such as the sun) in the scene coordinate system (such as the texture coordinate system or the UV coordinate system). Similarly, the second position is the position of the first pixel in the scene coordinate system.

[0035] In one possible implementation, the first and second positions are coordinates adjusted for screen aspect ratio. This ensures that the halo layer maintains its preset shape regardless of the rendering device's screen aspect ratio, preventing visual distortion due to device differences.

[0036] It should be noted that the specific correction methods for the first and second positions will be described in detail in subsequent embodiments, and will not be repeated here.

[0037] S203, for each halo layer, based on the size of the halo layer and the first relative position, first position and second position, determine the first brightness corresponding to the first pixel.

[0038] Specifically, the first brightness is the base brightness of a single-level halo layer determined by the halo layer size, first relative position, first position, and second position. It reflects the sensitivity of the first pixel in the current halo layer and is the core brightness contributor to rendering the halo layer. The first brightness is the brightness of the first pixel under the influence of the current halo layer. The larger the value of the first brightness, the brighter the pixel. If the first brightness is 0, the pixel will not exhibit the luminous effect of the current halo layer.

[0039] For example, the closer the halo is to the pixel, as determined by the first position, the second position, and the first relative position, the greater the brightness; the larger the size, the smoother the brightness decay. Furthermore, the center of the halo layer has the highest brightness, and the brightness decreases with distance from the center of the halo layer.

[0040] It should be noted that the specific implementation of determining the first brightness corresponding to the first pixel based on size, first relative position, first position and second position will be described in subsequent embodiments and will not be repeated here.

[0041] S204, perform brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer, and render the first pixel in the scene based on the target brightness of all halo layers.

[0042] Specifically, brightness perturbation processing refers to performing subtle and diverse brightness adjustments on the initial brightness level to simulate the subtle fluctuations and details of a real halo. For example, brightness perturbation processing includes, but is not limited to, inverse proportional decay control, periodic control, and polygonal perturbation control. Inverse proportional decay control is used to simulate the natural decay of halo energy over distance, avoiding rigid bright-dark boundaries in the halo layer. For example, inverse proportional decay control can be achieved using a power-law decay function. Periodic control is used to modulate subtle fluctuations in the initial brightness level to simulate the flickering effect of a real halo caused by atmospheric turbulence and density inhomogeneity. For example, periodic control of the initial brightness level can be achieved using high-frequency periodic functions, such as sine and cosine functions. Polygonal perturbation control is used to spatially constrain the initial brightness level, changing the circular shape of the halo layer to simulate the irregular boundaries of the halo caused by uneven distribution of the scattering medium. For example, polygonal perturbation control of the initial brightness level can be achieved through angle and shape masking, making the halo layer exhibit a polygonal jagged effect, more closely resembling the irregular shape of a real halo. It should be noted that the specific implementation method of performing brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer will be described in subsequent embodiments and will not be repeated here.

[0043] It is understandable that the target brightness can include the first brightness, the brightness after brightness perturbation of the first brightness, or only the first brightness or the brightness after brightness perturbation of the first brightness. The appropriate target brightness can be selected to render the halo layer according to the actual rendering requirements.

[0044] Based on the target brightness (i.e., the brightness values ​​representing pixels), for example, for each halo layer, the target brightness corresponding to that halo layer is combined with the preset visual parameters such as color and transparency of the halo layer to convert the brightness value into an RGB color visible to the pixel, and then output to the position of the corresponding first pixel on the screen, ultimately presenting the halo visual effect of that pixel on the halo layer. Finally, under the superposition of multiple halo layers, the final halo visual effect of the first pixel is obtained.

[0045] For example, taking the sun as the light source, when the target brightness is 0.7 (i.e., medium-high brightness), it is blended with warm colors (0.8, 0.75, 0.6) and rendered as warm-toned medium-bright pixels; when the target brightness is 0.1 (i.e., low brightness), it is blended into a light warm-toned dark area. Furthermore, if a semi-transparent effect needs to be overlaid, the brightness and transparency are set to a positive correlation, such as a brightness of 0.7 corresponding to transparency of 0.8, and a brightness of 0.1 corresponding to transparency of 0.2, so that the halo naturally blends into the scene.

[0046] In this embodiment, the size of the halo layer and the relative position between the halo layer and the light source are generated based on preset generation rules. This eliminates the need to rely on a fixed pre-made halo, reducing the mechanical feel caused by repeated texture use and minimizing the resource overhead of texture loading. The generated multiple halo layers can simulate the complex optical phenomenon of a solar halo formed by the superposition of multi-layered randomly distributed scattering rings in the real atmosphere, making the halo more layered and enhancing the visual dynamism, naturalness, and realism of the rendering effect. Furthermore, a first brightness is determined based on the size, first relative position, first position, and second position. The brightness of a pixel is associated with the actual spatial position of the light source and the halo layer, allowing the pixel brightness to naturally decay with its spatial position. Simultaneously, brightness perturbation processing is applied to the first brightness, further improving the flexibility of image rendering and resulting in a more realistic effect compared to the simple brightness superposition in related technologies.

[0047] In some embodiments, based on the foregoing embodiments, before generating multiple halo layers in the scene, the method provided in this disclosure further includes the following: According to the preset generation rules, the size of the halo layer and the first relative position between the halo layer and the light source are determined.

[0048] Optionally, for each halo layer, the size of the halo layer is determined as follows: First, based on the first preset random seed and the halo identifier of the halo layer, the size control parameters of the halo layer are generated.

[0049] Specifically, the halo identifier is used to distinguish between multiple generated halo layers. For example, the halo index value is used as the halo identifier.

[0050] The first preset random seed is a pre-set value used to drive the ordered random generation of the halo layer size control parameters. The size control parameters are generated based on the first preset random seed and the halo identifier, and are pseudo-random numbers within a standardized range, such as [0,1), used to control the size of the halo.

[0051] Then, based on the size control parameters, the preset size is controlled exponentially to obtain the size of the halo layer.

[0052] In one possible scenario, based on size control parameters, a power function is used to exponentially control the preset size, adjusting the distribution characteristics and dispersion of the halo layer size to achieve flexible adjustment of the halo's visual style. For example, the size of the halo layer is determined using the following formula:

[0053] Where s is the size of the halo layer; pow is a power function; f1 is a size control parameter; a is a preset size; b is a preset power control parameter used to adjust the size distribution characteristics; and c is a preset lower limit value for the size. For example, a is 1.8, b is 3, and c is 1.41.

[0054] In this way, by using the first preset random seed and halo identifier, differentiated size control parameters are generated. Then, through power control, the size of each halo layer is different, which can accurately simulate the complex optical phenomenon of multi-layered and randomly distributed halos in the real atmosphere. While reducing the memory and performance overhead of texture loading, it avoids the mechanical feel of the picture caused by repeated use of textures, and enhances the visual dynamism, naturalness and layering.

[0055] Optionally, for each halo layer, the first relative position between the halo layer and the light source is determined as follows: First, based on the second preset random seed and the halo identifier of the halo layer, the relative position control parameters of the halo layer are generated.

[0056] Specifically, the second preset random seed is also a preset value, used to drive the relative position of the halo layer and the light source. The relative position control parameter is generated based on the second preset random seed and the halo identifier, and is a pseudo-random number within a standardized range, such as [0,1), used to control the offset distribution of the halo layer.

[0057] Then, based on the relative position control parameters, the offset distribution of the halo layer relative to the light source is controlled to obtain the first relative position between the halo layer and the light source.

[0058] For example, the first relative position is determined by the following formula:

[0059] Wherein, d is the first relative position; f2 is the relative position control parameter; e is the preset amplification coefficient, used to expand the value range of f2, for example, the value is 3; g1 and g2 are preset offset adjustment values, for example, g1 and g2 are 0.2 and -0.5 respectively.

[0060] In this way, by using the second preset random seed and halo identifier, differentiated relative position control parameters are generated. Then, the first relative position is determined by the relative position control parameters, so that multiple halo layers are naturally distributed on both sides of the light source, simulating the complex optical linearity of multi-layered and randomly distributed halos in the real atmosphere, avoiding the problem of rigid halos and concentration on one side of the light source, and improving the realism and layering of the halo visual.

[0061] In this embodiment, the first pixel can be rendered multiple times through multiple loops, thereby creating a visually layered effect with natural randomness. Specifically, according to a preset number of loops, in each loop, according to a preset generation rule, the size of the halo layer in the scene and the first relative position between the halo layer and the light source are generated within this loop; based on the size, the first relative position, the first position, and the second position, the first brightness corresponding to the first pixel in this loop is determined; brightness perturbation processing is performed on the first brightness corresponding to all loops to obtain the target brightness corresponding to each halo layer, and the first pixel in the scene is rendered based on all target brightnesses. For example, all target brightnesses are summed, and the first pixel is rendered based on the summed brightness.

[0062] This embodiment provides an image rendering method that can be used in the aforementioned terminal devices, such as mobile phones and tablet computers. Figure 3 This is a flowchart of an image rendering method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps: S301 generates multiple halo layers in the scene. The size of the halo layers and their initial relative positions to the light source are determined based on preset generation rules. See details in [link to documentation]. Figure 2 Step S201 of the illustrated embodiment will not be described again here.

[0063] S302, obtain the first position of the light source and the second position of the first pixel. See details below. Figure 2 Step S202 of the illustrated embodiment will not be described again here.

[0064] S303, for each halo layer, based on the size of the halo layer and the first relative position, first position and second position, determine the first brightness corresponding to the first pixel.

[0065] Specifically, step S303 includes: S3031, based on the first position and the first relative position, determine the position corresponding to the first halo in the halo layer.

[0066] The first aura is used to construct the reference ring structure of the aura layer.

[0067] Specifically, the first halo refers to a halo within the halo layer that constitutes the core ring-shaped luminous effect, serving as the basic visual unit of the light source. The center of the first halo coincides with the center of its respective halo layer. The size of the first halo serves as the reference size for its respective halo layer. The position of the first halo is determined by the first relative position between its respective halo layer and the light source, as well as the first position of the light source within the scene. Specifically, the first halo is formed by offsetting along the first relative position direction with the light source position as the reference point. It can be understood that for multiple halo layers in a scene, each halo layer contains its corresponding first halo. The position corresponding to the first halo within a halo layer is the position of the first halo's center within the scene's positional system. For example, taking the first position as the first coordinate, the second position as the second coordinate, and the first phase position as the first relative coordinate, multiplying the first relative coordinate by the first coordinate yields the coordinates corresponding to the first halo, i.e., the position corresponding to the first halo. For example, assuming the first coordinate of the light source is (0.1, 0.0) (the light source is in the center of the screen) and the first relative coordinate is 0.6, then the coordinates corresponding to the first halo are (0.1, 0.0) × (0.6) = (0.06, 0.0).

[0068] S3032, based on the position corresponding to the first halo and the second position, determine the first distance between the first pixel and the first halo.

[0069] Specifically, the first distance represents the straight-line distance from the first pixel to the center of the first halo. The smaller the distance, the closer the first pixel is to the core light-emitting area of ​​the first halo; the larger the distance, the more significant the brightness attenuation. For example, the Euclidean distance between the position corresponding to the first halo and the second position is used as the first distance.

[0070] S3033, based on the first distance, size and preset sharpness, performs power-law attenuation control on the first preset brightness to obtain the first brightness.

[0071] Specifically, sharpness indicates the clarity or steepness of the halo's edge. Greater sharpness indicates a clearer or steeper halo edge.

[0072] In one possible implementation, a first preset brightness is obtained by power-law attenuation control based on a first distance, size, and preset sharpness. Specific steps include: First, based on the first distance, size, and preset sharpness, the brightness of the first pixel is controlled by power-law attenuation to obtain the first brightness adjustment value.

[0073] Specifically, power-law attenuation control refers to a brightness attenuation method based on a power function. In this embodiment, power-law attenuation control takes the first distance as the core and combines the exponential combination of size and preset sharpness to accurately amplify the brightness difference between near and far light, making the ring shape outline of the first halo clear. Moreover, by adjusting the size and sharpness, the width and edge softness / hardness of the halo can be flexibly customized to adapt to different rendering needs.

[0074] The larger the first brightness adjustment value, the higher the percentage of brightness reduction required for the pixel; the smaller the value, the smaller the percentage of reduction.

[0075] For example, the first distance is used as the base of a preset power function, and the product of the size and the preset sharpness is used as the exponent of the preset power function. The first brightness adjustment value is obtained through this preset power function.

[0076] Then, based on the first brightness adjustment value, the first preset brightness is adjusted to obtain the first brightness.

[0077] Specifically, the first preset brightness is used as a reference value for attenuating the effective light-emitting area of ​​the first halo, and is used to determine the threshold for whether a pixel belongs to the halo light-emitting area.

[0078] For example, the difference between the first preset brightness and the first brightness adjustment value is used as the first brightness. It can be understood that the pixel will only present the first halo illumination effect when the first preset brightness and the first brightness adjustment value are positive; when the first preset brightness and the first brightness adjustment value are not positive, the pixel will not present the first halo illumination effect.

[0079] In addition, the difference can be amplified according to a preset ratio based on actual rendering needs to obtain the first brightness.

[0080] S304 performs brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer, and renders the first pixel in the scene based on the target brightness of all halo layers. See details below. Figure 2 Step S204 of the illustrated embodiment will not be described again here.

[0081] In this embodiment, based on the first distance between the first pixel and the first halo, the spatial position of the pixel is directly correlated with brightness attenuation. Furthermore, the halo radius is controlled by its size, and the sharpness or steepness of the halo edge within the halo is controlled by a preset sharpness setting, allowing brightness to naturally decrease with distance, conforming to the visual perception of the light source. Throughout the process of determining the brightness corresponding to a pixel, there is no need to rely on pre-made halo textures, which reduces video memory usage and adapts to scenes with different light source positions, enhancing the realism and flexibility of light source rendering.

[0082] In some embodiments, based on any of the foregoing embodiments, a brightness perturbation process is performed on the first brightness to obtain the target brightness of the first pixel in the halo layer, specifically including the following steps: a1, according to the first preset adjustment rule, adjust the first relative position to obtain the second relative position between the halo layer and the light source.

[0083] Specifically, the first preset adjustment rule is a rule for adjusting the initial relative position relationship (i.e., the first relative position) between the halo layer and the light source. It is used to generate the position reference of the second halo (also known as the secondary halo) in the halo layer, which works with the first halo to form a multi-layer halo effect.

[0084] For example, the first preset adjustment rule can perform scaling, offsetting, rotation, or combination operations on the first relative position. For instance, by multiplying the X and Y components of the first relative position by a scaling factor, the magnitude of the offset is changed, thereby controlling the distance between the halo layer and the light source. When the scaling factor is greater than 1, the halo layer is farther from the light source; when it is less than 1, the halo layer is closer to the light source, avoiding excessive concentration or dispersion of the halo layer caused by a single offset magnitude. Alternatively, a fixed offset can be superimposed on the first relative position, causing the halo layer to shift slightly in one direction. Or, using the first position of the light source (i.e., the center of the light source) as the rotation axis, the offset direction of the first relative position can be changed through a rotation matrix, causing the offset direction of the halo layer to rotate around the light source (e.g., from the lower right to the lower left or upper left), breaking the monotony of offset in the same direction and simulating the multi-directional irregular distribution of natural halos.

[0085] The second relative position is the secondary relative distance between the secondary ring and the light source in the halo layer obtained after adjusting the first relative position according to the first preset adjustment rule. This determines the distance of the secondary ring around the light source, so as to supplement the formation of a hierarchical halo layer.

[0086] In one possible implementation, the first relative position is multiplied by a preset scaling factor (such as 0.5, which is to shrink to half of the first relative position) to ensure that the secondary halo is associated with the position of the initial halo and does not detach from the light source.

[0087] a2, based on the second relative position and the first position, determines the position corresponding to the second halo in the halo layer.

[0088] The second halo is used to fill the halo layer.

[0089] Specifically, the second halo refers to the ring-shaped luminous layer within the halo layer, serving as secondary compensation and visually enhancing and extending the hierarchy of the first halo. The center of the second halo is offset from the center of the first halo, with the direction and distance of this offset determined by the second relative position. The size of the second halo can be adjusted based on the size of the first halo, for example, by scaling it proportionally. Understandably, for multiple halo layers in a scene, each halo layer contains its corresponding second halo. The position corresponding to the second halo is the location of its center in the scene coordinate system, determining the specific position of the second halo around the light source. For example, continuing with the first coordinate as the first value and the second relative position as the second relative coordinate, multiplying the second relative coordinate by the first coordinate yields the coordinates corresponding to the second halo. The coordinates corresponding to the second halo are determined based on the second relative coordinates and the first coordinates, that is, the position of the second halo. This ensures that the second halo is always anchored to the light source distribution and forms an orderly spatial hierarchy with the first halo, avoiding the visual disharmony of the secondary halo being separated from the light source. Furthermore, by adjusting the scaling factor of the first preset adjustment rule, the distance of the second halo can be flexibly controlled to adapt to different halo layer layout requirements.

[0090] a3, based on the position corresponding to the second halo and the second position, determines the second distance between the first pixel and the second halo.

[0091] Specifically, the second distance is the distance from the first pixel to the center of the second halo. For example, based on the position corresponding to the second halo and the second position, the Euclidean distance between the first pixel and the second halo is calculated and used as the second distance.

[0092] a4, based on the second distance, performs inverse proportional attenuation control on the second preset brightness to obtain the second brightness corresponding to the first pixel.

[0093] Specifically, inverse proportional decay control refers to a decay method where brightness decreases inversely with the distance from the pixel to the center of the second halo (also known as the secondary halo) in the halo layer. The smaller the distance, the brighter the brightness; the larger the distance, the weaker the brightness. Compared to power-law decay, inverse proportional decay control is gentler and can generate the natural glow effect of the secondary halo. The brightness of the second halo is achieved through inverse proportional decay control, which is gentler than the first halo and is used to create a diffuse scattering effect of the light source.

[0094] The second brightness is the luminance of the first pixel in the second halo (also known as the secondary halo). As a supplement to the first brightness, it is superimposed on the first brightness to make the halo layer richer.

[0095] For example, an inverse proportional attenuation control (i.e., approximately inverse square but softer than inverse square) is achieved based on the 1 / attenuation kernel function to form a soft bright spot (i.e., the second halo). The second preset brightness is inversely attenuated using the 1 / attenuation kernel function. For example, the second preset brightness is multiplied by the 1 / attenuation kernel function to obtain the second brightness.

[0096] a5, based on the second brightness, performs brightness perturbation processing on the first brightness to obtain the target brightness.

[0097] For example, the first brightness and the second brightness can be used as the target brightness. Alternatively, the first brightness and the second brightness can be weighted and summed, and the resulting weighted sum can be used as the target brightness.

[0098] In this embodiment, a second relative position is generated through a first preset adjustment rule to construct a second halo in the light source. This halo forms a two-layer structure with the first halo, consisting of a core sharp ring and a secondary diffuse ring. This avoids the problem of a single halo having a monotonous halo layer, making the visual representation of the solar light source more closely resemble the actual physical scattering effect. The inverse proportional attenuation control is gentler than power-law attenuation, simulating the self-reflective diffusion effect of light, resulting in a transition from near-bright to far-soft in the second halo, enhancing the naturalness of the halo. Furthermore, by adjusting the first preset adjustment rule (such as adjusting the scaling factor) and the attenuation intensity factor, the style of the second halo in the halo layer is optimized to meet different rendering needs and improve rendering flexibility.

[0099] In some embodiments, based on any of the foregoing embodiments, the first brightness is subjected to brightness perturbation processing to obtain the target brightness, specifically including the following steps: b1, according to the second preset adjustment rule, adjust the first relative position to obtain the third relative position between the halo layer and the light source.

[0100] Specifically, the second preset adjustment rule is used to adjust the initial relative positional relationship (i.e., the first relative position) between the halo layer and the light source, thereby generating the positional reference for the third halo and forming a differentiated spatial hierarchy of halo layers with the first and second halo layers. For example, the second preset adjustment rule can perform scaling, offsetting, rotation, or combination operations on the first relative position. The second preset adjustment rule is similar to the first preset adjustment rule and will not be described further here.

[0101] The third relative position is the relative distance between the center of the third halo and the light source in the halo layer obtained after the first relative position is adjusted by the second preset adjustment rule. It is used to determine the spatial position of the third halo around the light source.

[0102] For example, suppose the second preset adjustment rule is to multiply the first relative position by 0.8 (i.e., scaling) and add 0.03 (i.e., offset). When the first relative position is 0.6, the third relative position is 0.6×0.8+0.03=0.51.

[0103] b2, based on the third relative position and the first position, determines the position corresponding to the third halo in the halo layer.

[0104] The third ring is used to simulate the optical interference pattern in the ring layer.

[0105] Specifically, the third halo is a three-tiered ring-shaped luminescent layer within the halo layer, serving as a visual supplement to the first and second halo layers. Its brightness varies with the spatial position of the pixels relative to the third halo. The center of the third halo is offset from the center of the first halo, with the direction and distance of this offset determined by the relative position. The size of the third halo can be obtained by adjusting the size of the first halo, for example, by reducing the size of the first halo by a preset ratio. Understandably, for multiple halo layers in a scene, each halo layer contains its corresponding third halo. For example, the third halo can simulate effects such as fine lines and ripples, thereby diversifying the halo's form.

[0106] Since the position of the third halo is determined based on the third relative position and the first position, it can ensure that the third halo is always anchored to the light source distribution, and the texture of the third halo is precisely matched with the spatial position of the first halo, avoiding texture offset or distortion.

[0107] b3, based on the position corresponding to the third halo and the second position, determines the third distance between the first pixel and the third halo.

[0108] The third distance between the first pixel and the third halo is determined in a similar way to the first and second distances mentioned above, and will not be repeated here.

[0109] b4, based on the third distance, periodically controls the third preset brightness to obtain the third brightness corresponding to the first pixel.

[0110] The third brightness is the luminance of the first pixel in the third halo. It is obtained by periodically controlling the third distance and is used to supplement the first brightness and the second brightness. When superimposed with the first brightness and the second brightness, it makes the halo layer present a periodic texture and shape effect.

[0111] For example, based on trigonometric functions, the third preset brightness is modulated, such as by sine or cosine functions, so that the brightness of the pixel changes periodically with the pixel relative to the third distance, thereby forming detail flickering and interference fringes.

[0112] In one possible implementation, the third distance is used as input to a preset periodic function (such as a sine function) to obtain the third brightness. The third preset brightness serves as a preset parameter in the preset periodic function. The period of the preset periodic function can be set according to actual needs, such as setting it to a high-frequency periodic function, so that the brightness changes periodically with the third distance, forming dense and delicate interference fringes.

[0113] Of course, power-law decay can also be combined with periodic control to obtain a third brightness. Based on the third distance, ultra-low power-law decay control and periodic control are applied to the brightness corresponding to the first pixel to obtain the third brightness corresponding to the first pixel, which is then used to render the first pixel based on the first brightness and the third brightness. For example, the third distance can be used as the base of a preset power function to obtain the brightness corresponding to power-law decay control. Based on this, the third distance can be used as the input parameter of a preset periodic function to obtain the brightness corresponding to periodic control. The brightness corresponding to power-law decay control and the brightness corresponding to periodic control can be superimposed to obtain the third brightness.

[0114] b5, based on the third brightness, performs brightness perturbation processing on the first brightness to obtain the target brightness.

[0115] For example, the first brightness, the second brightness, and the third brightness can be used as the target brightness. Alternatively, the first brightness, the second brightness, and the third brightness can be weighted and summed, and the resulting weighted sum can be used as the target brightness.

[0116] In this embodiment, periodic control can simulate the natural physical phenomenon of a solar halo. Compared to a single ring halo, the rendering effect is closer to a realistic natural effect. Furthermore, a third relative position is generated through a second preset adjustment rule, so that the third position, together with the first and second halos, forms a three-layer structure of a core sharp ring, a secondary diffuse ring, and a tertiary periodic texture ring. The spatial hierarchy is clear, avoiding the visual clutter caused by multiple overlapping halos and enhancing the overall immersiveness of the halo. In addition, by adjusting the parameters in the periodic control, such as the period frequency, the flexibility of halo rendering is further improved.

[0117] This embodiment provides an image rendering method that can be used in the aforementioned mobile terminals, such as mobile phones and tablet computers. Figure 4 This is a flowchart of an image rendering method according to an embodiment of the present invention, such as... Figure 4 As shown, the process includes the following steps: S401 generates multiple halo layers in the scene. The size of the halo layers and their initial relative positions to the light source are determined based on preset generation rules. See details in [link to documentation]. Figure 2 Step S201 of the illustrated embodiment will not be described again here.

[0118] S402, obtain the pixel resolution corresponding to the scene.

[0119] Specifically, the pixel resolution corresponding to the scene is the screen pixel size of the final rendered output of the scene, that is, the combination of the horizontal and vertical pixel counts. In this embodiment of the disclosure, the pixel resolution serves as the benchmark for texture position transformation, determining the accuracy and adaptability of the position mapping. For example, the pixel resolution is 1920×1080, that is, 1920 pixels horizontally and 1080 pixels vertically.

[0120] S403, based on pixel resolution, transforms the fourth position and the fifth position respectively to obtain the first position corresponding to the fourth position and the second position corresponding to the fifth position.

[0121] The fourth position is the texture coordinate of the light source, and the fifth position is the texture coordinate of the first pixel.

[0122] Specifically, the fourth position is the normalized coordinate of the light source in texture space (such as UV space), and the exemplary texture coordinate range is usually [0, 1]. The fifth position is the normalized coordinate of the first pixel in texture space, which is the default input coordinate of each pixel in the fragment shader. The horizontal coordinate corresponds to the horizontal direction of the screen, and the vertical coordinate corresponds to the vertical direction of the screen. The fifth position of each pixel is unique and covers the entire texture space. For example, at a resolution of 1920×1080, the fifth position of the pixel at the top left corner of the screen is (0.0, 1.0) (if the V-axis is positive upwards), the fifth position of the pixel at the bottom right corner of the screen is (1.0, 0.0), and the fifth position of the pixel at the center of the screen is (0.5, 0.5).

[0123] The first position refers to the scene coordinates obtained after pixel resolution conversion of the fourth position of the light source. The origin is located at the center of the screen, and the coordinate range is usually [-0.5, 0.5]. For example, if the scene pixel resolution is 1920×1080 (i.e., aspect ratio 16:9), and the fourth position of the light source is (0.5, 0.5), then the converted first position is (0.0, 0.0) (i.e., the center of the screen).

[0124] The second position is the scene coordinate obtained after pixel resolution conversion of the fifth position of the first pixel. It uses the same coordinate system as the first position, such as the center of the screen as the origin, with a range of [-0.5, 0.5].

[0125] In this way, the transformation from texture coordinates to scene coordinates is completed based on pixel resolution, ensuring that the coordinate transformation is aligned with the rendering output size and avoiding positional offset caused by resolution mismatch. The fourth position of the light source is converted to the first position, and the fifth position of the pixel is converted to the second position. This not only unifies the position system of the two, but also avoids stretching distortion under different resolution screens through aspect ratio correction, ensuring the consistency and accuracy of halo rendering in cross-resolution and cross-platform scenarios.

[0126] S404, for each halo layer, based on the size of the halo layer and its first relative position, first position, and second position, determine the first brightness corresponding to the first pixel. See details below. Figure 2 Step S203 of the illustrated embodiment will not be described again here.

[0127] S405 performs brightness perturbation processing on the first brightness level to obtain the target brightness of the first pixel in the halo layer. Based on the target brightness of all halo layers, the first pixel in the scene is rendered. See details below. Figure 2 Step S204 of the illustrated embodiment will not be described again here.

[0128] In some embodiments, the first brightness is subjected to brightness perturbation processing to obtain the target brightness of the first pixel in the halo layer, specifically including the following steps: c1, based on the position of the first halo, the number of sides of the preset polygon, and the size of the halo layer where the first halo is located, determines the preset polygon corresponding to the first halo in the scene.

[0129] Specifically, the preset polygon is used to simulate the physical scattering effect of a natural halo. For example, the preset polygon can have 6 or 8 sides. The preset scaling factor is used to adjust the size of the preset polygon so that its outline matches the annular range of the first halo, for example, slightly larger than the effective luminous radius of the first halo, thus ensuring that the area inside the polygon is the core region of the first halo, and the area outside the polygon is the disturbance attenuation region. For example, the preset polygon is set to a regular hexagon (i.e., the preset polygon has 6 sides), the preset scaling factor is 1.2, and a regular hexagonal outline surrounding the light source is formed with the first halo position (0.0, 0.0) as the center and an outer circle radius of 0.36.

[0130] In one possible implementation, in c1 above, the preset polygon is determined as follows: First, the position of the center of the preset polygon is determined based on the position corresponding to the first halo.

[0131] Optionally, the position corresponding to the first halo can be used as the center of the preset polygon. Alternatively, the position corresponding to the first halo can be offset or adjusted, and the adjusted position can be used as the center of the preset polygon.

[0132] Optionally, the position of the center of the preset polygon is determined based on the first position and the position corresponding to the first halo. For example, taking coordinates as an example, the first coordinate (i.e., the first coordinate) and the coordinate corresponding to the first halo (i.e., the position of the first halo) are weighted to obtain the position of the center of the preset polygon.

[0133] Then, based on the size determination, the radius of the circumcircle of the preset polygon is determined to ensure that the size of the preset polygon is adapted to the first halo.

[0134] For example, the radius of the circumcircle of the preset polygon is obtained by multiplying the size by a preset scaling factor.

[0135] Next, based on the preset number of sides of the polygon, the polar angle of each vertex in the preset polygon is determined.

[0136] Finally, the position of each vertex is determined based on the polar angle and the radius of the circumcircle. This forms the preset polygon.

[0137] In another possible implementation, in c1 above, the preset polygon is determined as follows: First, the second position is scaled by a preset scaling factor, while offsetting it based on the positions corresponding to the first position and the first halo, to ensure that the pixel position is aligned with the preset polygon space.

[0138] Then, based on the position corresponding to the first halo, the polar angle corresponding to the first pixel is determined, that is, the angle between the line connecting the first pixel and the center of the first halo and the X-axis.

[0139] Next, the polar angle corresponding to the first pixel is divided equally according to the preset number of polygons, and the first pixel is assigned to the nearest polygon sector among the preset polygons.

[0140] Finally, the deviation between the polar angle corresponding to the first pixel and the center angle of the nearest polygon sector is calculated. Combined with the first distance between the first pixel and the first halo, a hard edge mask is generated. The mask value of the hard edge mask is close to 1 to indicate that it is inside the preset polygon, and close to 0 to indicate that it is outside the preset polygon, thereby indirectly defining the polygon outline.

[0141] c2, if the first pixel is located within the preset edge area corresponding to the preset polygon, then based on the distance between the first pixel and the preset polygon, polygon perturbation control is performed on the fourth preset brightness to obtain the fourth brightness.

[0142] Specifically, the preset edge region is the "inner and outer transition zone" of the preset polygon, a narrow interval between the "inner part" and the "outer part" of the polygon. This region is the core range of brightness perturbation. By adjusting the brightness within this region, a smooth transition between the hard edge of the polygon and the halo background is achieved, avoiding jagged edges. For example, taking a regular hexagon as the preset polygon, the width of the preset edge region is 0.01, which is a 0.01 interval extending outward from the inner boundary of the polygon.

[0143] The distance between the first pixel and the preset polygon is the shortest straight-line distance from the first pixel to the boundary of the preset polygon. Polygon perturbation control refers to controlling the brightness of pixels near the preset polygon. For example, the smaller the distance, i.e., the closer to the polygon boundary, the stronger the perturbation effect; the larger the distance, the weaker the perturbation effect. Taking a hexagonal preset polygon as an example, when the distance from the first pixel to the regular hexagon is 0.04, the brightness after perturbation control is 0.08 (i.e., strong perturbation); when the distance is 0.14, the brightness is 0.02 (i.e., weak perturbation); when the distance exceeds 0.2, the brightness is 0 (i.e., no perturbation), forming a perturbation effect where the hexagonal outline gradually changes outward.

[0144] In one possible implementation, the fourth brightness can be determined by linear attenuation, inverse proportional attenuation, or power-law attenuation based on the distance between the first pixel and the preset polygon.

[0145] c3, based on the fourth brightness, performs brightness perturbation processing on the first brightness to obtain the target brightness.

[0146] For example, the first brightness, the second brightness, the third brightness, and the fourth brightness can be used as the target brightness. Alternatively, the first brightness, the second brightness, the third brightness, and the fourth brightness can be weighted and summed, and the resulting weighted sum can be used as the target brightness.

[0147] In one possible implementation, the method provided in this disclosure embodiment further includes the following: First, the second position is transformed according to the preset position transformation rules to obtain the third position of the first pixel in the preset shape space.

[0148] Specifically, the preset position conversion rule refers to converting the coordinates of the first pixel in the scene coordinate system (i.e., the second position) into the coordinates in the preset shape space (i.e., the third position), in order to unify the spatial scale of pixel coordinates and preset polygons.

[0149] For example, the preset position transformation rule can be the first coordinate corresponding to the first position multiplied by a preset scaling factor and then superimposed with a preset offset. Taking a preset scaling factor of 1.5 and a preset offset of (0.1, -0.05) as an example, if the second position is the second coordinate (0.2, 0.3), then the third position, i.e. the third coordinate, is (1.5×0.2-0.05, 1.5×0.3-0.05).

[0150] In this way, the preset position transformation rule maps the position in the scene coordinate system to the preset shape space, isolates the scale interference of different light source positions, ensures the spatial adaptability of the preset polygon and the first halo, and avoids polygon offset.

[0151] Then, taking the preset reference point in the preset shape space as the center, and based on the position of the third position and the position of the preset reference point, the polar angle and the fourth relative position of the first pixel relative to the preset reference point are determined.

[0152] Specifically, the preset reference point is a fixed reference position in the preset shape space. For example, the center of the space is used as the preset reference point.

[0153] The polar angle refers to the azimuth angle of the first pixel relative to a preset reference point in the preset shape space; that is, the angle between the line connecting the third position and the reference point and the positive X-axis. The fourth relative position refers to the relative offset of the third position relative to the preset reference point. For example, using coordinates to represent position, subtracting the coordinates of the preset reference point from the third coordinate (i.e., the third position) gives the fourth relative coordinate. The azimuth angle of the fourth relative coordinate is calculated using the atan2(y, x) function, where y is the ordinate value and x is the abscissa value in the fourth relative coordinate.

[0154] Next, based on the number of sides of the preset polygon, the angle step size corresponding to each side of the preset polygon is determined.

[0155] Specifically, the angle step size refers to the interval between the central angles of two adjacent sides in the preset polygon, which can be obtained by dividing the circumference angle by the number of sides of the preset polygon.

[0156] Finally, the positional information between the first pixel and the preset polygon is determined based on the polar angle, the fourth relative position, and the angular step size.

[0157] The location information is used to indicate whether the first pixel is located within a preset edge region.

[0158] Optionally, the polar angle is divided equally according to the angle step size and assigned to the nearest polygonal sector, and the center angle of the nearest polygonal sector is determined; the deviation between the polar angle and the center angle of the preset polygonal sector is calculated using a preset trigonometric function; based on the deviation and the distance indicated by the fourth relative position, the deviation value from the first pixel to the polygon boundary is obtained. If the deviation value is within the preset deviation value range, the first pixel is determined to be within the preset edge region; otherwise, the first pixel is determined to be outside the preset edge region.

[0159] For example, if the polar angle is 0.18, the fourth relative position is also represented by coordinates as (0.55, 0.1), the angle step is 1.047 radians (i.e., 60 degrees), and the preset threshold is set to 0.5, then dividing the polar angle 0.18 evenly according to the angle step yields 0.5 + 0.18 / 1.047 ≈ 0.672. The center angle of the sector is 0, and the deviation between the polar angle and the center angle is 0 - 0.18 = -0.18 radians. The distance between the first pixel and the preset reference point is 0.559, and the deviation value is cos(-0.18) × 0.559 ≈ 0.551, meaning the deviation value is not within the preset deviation value range (0.5, 0.51). Therefore, it is determined that the first pixel is not in the preset edge region.

[0160] In this way, by using polar angle quantization and sector center angle deviation distance constraints, it is possible to accurately determine whether the first pixel is outside the polygon, and the calculation of the deviation value has a sector boundary gradient effect (such as the deviation value slowly decreasing when approaching the edge of the polygon), which provides a smooth transition basis for subsequent polygon outside disturbance control and avoids the visual abruptness caused by hard edge judgment.

[0161] In this embodiment of the disclosure, the preset polygon simulates the real physical cause of the solar halo, which is closer to the natural phenomenon than a pure ring halo. The perturbation control outside the polygon makes the edge of the light source show the details of the gradual attenuation of the edges, thus improving the rendering effect.

[0162] In some embodiments, based on any of the foregoing embodiments, the first position includes a first coordinate, the second position includes a second coordinate, and before rendering the first pixel in the scene based on the target brightness of all halo layers, the method provided in this disclosure embodiment further includes the following: Based on the first preset color parameter and the second preset color parameter, the color parameter of the coordinate between the first preset coordinate and the second preset coordinate is interpolated to obtain the first color parameter corresponding to the second coordinate. The first preset color parameter is the reference color parameter corresponding to the first preset coordinate in the preset coordinate direction in the scene, and the second preset color parameter is the reference color parameter corresponding to the second preset coordinate in the preset coordinate direction.

[0163] Specifically, the first preset color parameter and the second preset color parameter serve as the starting and ending reference colors for the color difference, respectively. For example, the preset coordinate direction can be the direction of the V-axis. The first preset color parameter is the sky background color, used to control the base color of the lower half / low-brightness area of ​​the sky in the scene. The second preset color parameter is the sky highlight color, used to control the base color of the upper half / highlightness area of ​​the sky. The first preset coordinate and the second preset coordinate serve as the starting and ending positions for the color difference, respectively. In this embodiment, by interpolating the color parameters of the coordinates between the first and second preset coordinates, a smooth color transition in the scene is achieved, generating a vertically gradient sky that closely matches a realistic solar halo scene.

[0164] In one possible implementation, a linear interpolation function is used to interpolate the color parameters of the coordinates between the first and second preset coordinates based on the first and second preset color parameters, thereby obtaining the first color parameter corresponding to the second coordinate.

[0165] In another possible implementation, based on the first preset color parameter and the second preset color parameter, the color parameter of the coordinate between the first preset coordinate and the second preset coordinate is interpolated to obtain the first color parameter corresponding to the second coordinate. Specifically, this includes the following steps: First, based on the first preset color parameter and the second preset color parameter, the color parameter of the coordinate between the first preset coordinate and the second preset coordinate is interpolated to obtain the second color parameter corresponding to the second coordinate.

[0166] Then, based on the current moment, the second color parameter is periodically adjusted to obtain the first color parameter.

[0167] Optionally, based on the current moment, the RGB channels of the second color parameter are cyclically fine-tuned using a preset trigonometric function (such as a sine function or a cosine function) to create dynamic effects such as gradual color changes over time. Specifically, the current moment is used as the input parameter of the preset trigonometric function to obtain the color adjustment amount of the first pixel at the current moment. Based on the color adjustment amount, the second color parameter is adjusted to obtain the first color parameter.

[0168] In this way, by periodically adjusting based on the current moment, the colors in the scene fluctuate periodically over time, enhancing the immersion and vividness of the scene compared to static colors. Furthermore, by adjusting the interpolation method and period length, the flexibility and controllability of scene rendering can be enhanced.

[0169] In one possible implementation, based on any of the foregoing embodiments, in S204 above, the first pixel in the scene is rendered based on the target brightness of all halo layers, specifically including the following: The first pixel is rendered based on the first color parameter and all target brightness.

[0170] For example, for each halo layer, the first pixel is rendered based on the target brightness and the first color parameter corresponding to that halo layer. Here, brightness is used as a color intensity factor; the higher the brightness, the more vibrant the color, and the lower the brightness, the dimmer the color.

[0171] For example, when the target brightness includes a first brightness, a second brightness, a third brightness, and a fourth brightness, for the first halo layer, the first brightness, the second brightness, the third brightness, and the fourth brightness are multiplied by a first color parameter respectively to obtain multiple multiplied color parameters; the multiple multiplied color parameters are summed to obtain the pixel color of the first pixel in the first halo layer, and the first pixel is rendered using the pixel color of the first pixel in the first halo layer. Here, the first halo layer is one of multiple halo layers. In this way, the first pixel is rendered sequentially using the target brightness corresponding to multiple halo layers, thereby achieving the light source rendering effect of the first pixel.

[0172] In another possible implementation, S204 above specifically includes the following: First, based on the first distance, the preset color parameters are shifted by a three-channel cosine phase using a preset cosine function to generate the third color parameter corresponding to the first pixel.

[0173] Specifically, the preset color parameters serve as the basic reference color parameters and are the original color base for the three-channel cosine phase shift. They typically correspond to the core hue of the halo, such as warm yellow or bright white.

[0174] Three-channel cosine phase shift refers to adjusting the phase of the three RGB channels of a preset color parameter based on a first distance and a preset cosine function. By utilizing the periodicity and smoothness of the cosine function, each color channel exhibits a fluctuating and gradual change with the first distance, avoiding the abruptness of a single gradient. At the same time, the parameters of the three channel shifts can be set differently to ensure rich color gradations.

[0175] Then, the target brightness corresponding to each halo layer is multiplied by the third color parameter and then superimposed with the first color parameter to obtain the final pixel color of the first pixel in each halo layer. The first pixel is then rendered sequentially based on the final pixel color of each halo layer.

[0176] It is understandable that when the target brightness includes multiple brightness levels, such as the first brightness level, the second brightness level, etc., for each halo layer, the multiple brightness levels are multiplied by the third color parameter and summed, and then the first color parameter is added to obtain the final pixel color of the first pixel in each halo layer.

[0177] The first brightness is the base brightness of the halo core, i.e., the core brightness of the first ring. The second brightness is a soft bright spot with an approximate 1 / r decay, used for brightness filling and transition. The third brightness is the periodic texture brightness, i.e., the brightness of the second ring, serving as the stripe / ripple brightness of the light source. The fourth brightness is the polygon perturbation brightness, adding perturbation brightness to the edges outside the polygons. All target brightnesses are multiplied by the third color parameter, summed, and then superimposed with the first color parameter to achieve a natural variation in the multi-ring layering.

[0178] In some embodiments, based on any of the foregoing embodiments, the first brightness is subjected to brightness perturbation processing to obtain the target brightness of the first pixel in the halo layer, and the following content is also included: First, based on the first position and the second position, the polar angle between the first pixel and the light source is determined.

[0179] Specifically, the polar angle between the first pixel and the light source refers to the azimuth angle of the first pixel relative to the light source, that is, the angle between the line connecting the first pixel and the light source and the positive direction of the U-axis.

[0180] Then, based on the polar angle, the fifth preset brightness is modulated to obtain the fifth brightness corresponding to the first pixel.

[0181] Specifically, the angle modulation control is based on the polar angle. A preset modulation function (such as a trigonometric function or a piecewise function) is used to differentially adjust the brightness, causing pixels with different polar angles to exhibit different brightness levels. This simulates the directionality and angular characteristics of the light source. The fifth preset brightness value is a preset parameter value in the preset modulation function. This embodiment does not limit the specific form of the modulation function; different preset modulation functions can be used to achieve different rendering effects to meet rendering requirements.

[0182] In one possible implementation, a fine first lob is generated using higher-order radial attenuation and multi-frequency angle sinusoidal modulation.

[0183] For example, radial attenuation can be achieved by combining an inverse proportional function and a preset power function, using the distance between the pixel and the light source as input parameters in both functions. Based on radial attenuation, the brightness obtained by radial attenuation is angularly modulated using preset sine and cosine functions, with the polar angle used as input parameters for the preset sine and cosine functions, thus obtaining the fifth brightness level.

[0184] In another possible implementation, a smoother attenuation is used to superimpose different frequencies to form a second lob.

[0185] For example, the exponent of the aforementioned preset power function can be set to a value less than 1, thereby achieving a smoother decrease in brightness. Based on this, the brightness obtained by using the polar angle as the input parameter of the preset sine function and the preset cosine function is superimposed with the brightness obtained by the smoother decrease, thus obtaining the fifth brightness.

[0186] Of course, the first and second petals can also be superimposed to form complementary textures.

[0187] Finally, based on the fifth brightness level, the first brightness level is subjected to brightness perturbation processing to obtain the target brightness level.

[0188] For example, the first brightness and the fifth brightness can be used as the target brightness. Alternatively, the first brightness and the fifth brightness can be weighted and summed, and the resulting weighted sum can be used as the target brightness.

[0189] In this embodiment of the disclosure, the brightness of the halo of a light source varies in different directions in a real scene. By polar angle modulation, the natural directionality of the light source can be simulated, enhancing the realism of the rendering and making the rendering effect more layered.

[0190] In some embodiments, the method provided in this disclosure further includes the following: First, based on the first position and the first position, the fourth distance between the light source and the first pixel is determined.

[0191] Then, based on the fourth distance, the brightness corresponding to the first pixel is attenuated inversely proportionally and / or exponentially to obtain the sixth brightness.

[0192] Finally, the target brightness is determined based on the first brightness and the sixth brightness.

[0193] Considering that light brightness decreases with increasing distance from the light source during propagation, this law is simulated through inverse proportional decay. Pixels near the light source have high brightness, while pixels farther away have low brightness, achieving a smooth brightness transition and making effects such as sunlight halos and light sources more realistic. Simultaneously, global exponential decay ensures that the energy decay of global illumination follows physical laws, guaranteeing a smooth outward decline in brightness.

[0194] For example, the first brightness and the sixth brightness can be used as the target brightness. Alternatively, the first brightness and the sixth brightness can be weighted and summed, and the resulting weighted sum can be used as the target brightness.

[0195] Understandably, the target brightness can be determined by at least one or more of the first brightness, second brightness, third brightness, fourth brightness, fifth brightness, and sixth brightness. For example, the target brightness can be determined by at least one or more of the first brightness, second brightness, third brightness, fourth brightness, fifth brightness, and sixth brightness. Alternatively, a weighted sum can be taken from multiple values ​​of the first brightness, second brightness, third brightness, fourth brightness, fifth brightness, and sixth brightness, and the resulting weighted sum can be used as the target brightness.

[0196] Furthermore, the final pixel color corresponding to the first pixel can be uniformly scaled, thereby achieving rapid adaptation to different platforms and display devices. In this disclosure, execution occurs during the fragment shading stage of the GPU, without relying on CPU participation or external resource loading, and can be directly deployed in mainstream rendering engines (such as Unity and Unreal Engine) and graphics APIs (such as OpenGL, Vulkan, and DirectX).

[0197] This embodiment also provides an image rendering apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0198] This embodiment provides an image rendering device, such as... Figure 5 As shown, it includes: The generation module 501 generates multiple halo layers in the scene. The size of the halo layer and the first relative position between the halo layer and the light source are determined based on preset generation rules. The acquisition module 502 is used to acquire the first position of the light source and the second position of the first pixel, wherein the first pixel is a specified pixel in the scene; The determining module 503 is used to determine the first brightness corresponding to the first pixel point for each halo layer based on the size of the halo layer and the first relative position, the first position and the second position; The rendering module 504 is used to perform brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer, and to render the first pixel in the scene based on the target brightness of all halo layers.

[0199] In one possible implementation, the determining module 503 is specifically used to determine the position corresponding to the first halo in the halo layer based on the first position and the first relative position, wherein the first halo is used to construct the reference ring structure of the halo layer; Based on the position corresponding to the first halo and the second position, determine the first distance between the first pixel and the first halo; Based on the first distance, size and preset sharpness, the brightness of the first pixel is controlled by power-law attenuation to obtain the first brightness adjustment value; Based on the first brightness adjustment value, the first preset brightness is adjusted to obtain the first brightness.

[0200] In one possible implementation, the determining module 503 is further configured to adjust the first relative position according to the first preset adjustment rule to obtain the second relative position between the halo layer and the light source; Based on the second relative position and the first position, the position corresponding to the second halo in the halo layer is determined, wherein the second halo is used to fill the halo layer; Based on the position corresponding to the second halo and the second position, determine the second distance between the first pixel and the second halo; Based on the second distance, the second preset brightness is inversely attenuated to obtain the second brightness corresponding to the first pixel. Based on the second brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

[0201] In one possible implementation, the determining module 503 is further configured to adjust the first relative position according to the second preset adjustment rule to obtain the third relative position between the halo layer and the light source; Based on the third relative position and the first position, the position corresponding to the third ring in the ring layer is determined, wherein the third ring is used to simulate the optical interference pattern in the ring layer; Based on the position corresponding to the third halo and the second position, determine the third distance between the first pixel and the third halo; Based on the third distance, the third preset brightness is periodically controlled to obtain the third brightness corresponding to the first pixel. Based on the third brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

[0202] In one possible implementation, the determining module 503 is further configured to determine, based on the position of the first halo, the number of sides of the preset polygon, and the size of the halo layer where the first halo is located, the preset polygon in the scene. If the first pixel is located within the preset edge region corresponding to the preset polygon, then based on the distance between the first pixel and the preset polygon, the fourth preset brightness is subjected to polygon perturbation control to obtain the fourth brightness; based on the fourth brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

[0203] In one possible implementation, the determining module 503 is further configured to transform the second position according to a preset position transformation rule to obtain the third position of the first pixel in a preset shape space. Using a preset reference point in the preset shape space as the center, and based on the third position and the position of the preset reference point, determine the polar angle and the fourth relative position of the first pixel relative to the preset reference point; Based on the number of sides of a preset polygon, determine the angle step size corresponding to each side of the preset polygon. Based on the polar angle, the fourth relative position, and the angle step, the position information between the first pixel and the preset polygon is determined. The position information is used to indicate whether the first pixel is located within the preset edge area.

[0204] In one possible implementation, the acquisition module 502 is further configured to acquire the pixel resolution corresponding to the scene before acquiring the first position of the light source and the second position of the first pixel. Based on pixel resolution, the fourth and fifth positions are transformed to obtain the first position corresponding to the fourth position and the second position corresponding to the fifth position. The fourth position is the texture coordinate of the light source, and the fifth position is the texture coordinate of the first pixel.

[0205] In one possible implementation, the first position includes a first coordinate, the second position includes a second coordinate, and the determining module 503 is further configured to interpolate the color parameters of the position between the first preset position and the second preset position based on the first preset color parameter and the second preset color parameter to obtain the first color parameter corresponding to the second position, wherein the first preset color parameter is a reference color parameter corresponding to the first preset position in the preset position direction in the scene, and the second preset color parameter is a reference color parameter corresponding to the second preset position in the preset position direction; Rendering module 504 is specifically used to render the first pixel based on the first color parameter and all target brightness.

[0206] In one possible implementation, the determining module 503 is specifically used to interpolate the color parameters of the position between the first preset position and the second preset position based on the first preset color parameters and the second preset color parameters to obtain the second color parameters corresponding to the second position. Based on the current moment, the second color parameter is periodically adjusted to obtain the first color parameter.

[0207] In one possible implementation, the determining module 503 is further configured to determine the polar angle between the first pixel and the light source based on the first position and the second position; Based on the polar angle, the fifth preset brightness is modulated and controlled to obtain the fifth brightness corresponding to the first pixel; based on the fifth brightness, the first brightness is perturbed to obtain the target brightness.

[0208] The image rendering apparatus provided in this disclosure generates the size of the halo layer and the relative position between the halo layer and the light source based on preset generation rules. This eliminates the need to rely on fixed pre-made halos, reducing the mechanical feel caused by repeated texture use and minimizing the resource overhead of texture loading. The generated multiple halo layers can simulate the complex optical phenomenon of a solar halo formed by the superposition of multi-layered randomly distributed scattering halos in the real atmosphere, making the halo more layered and enhancing the visual dynamism, naturalness, and realism of the rendering effect. Furthermore, a first brightness is determined based on the size, first relative position, first position, and second position. The brightness of a pixel is associated with the actual spatial position of the light source and the halo layer, allowing the pixel brightness to naturally decay with its spatial position. Simultaneously, brightness perturbation processing is applied to the first brightness, further improving the flexibility of image rendering and resulting in a more realistic effect compared to simple brightness superposition in related technologies.

[0209] The image rendering apparatus provided in this disclosure can execute the image rendering method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0210] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.

[0211] The following is a detailed reference. Figure 6 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present disclosure. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1301, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1302 or a program loaded from memory 1308 into random access memory (RAM) 1303. The RAM 1303 also stores various programs and data required for the operation of the electronic device. The processor 1301, ROM 1302, and RAM 1303 are interconnected via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0212] Typically, the following devices can be connected to I / O interface 1305: input devices 1306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 1308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1309. Communication device 1309 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0213] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1309, or installed from memory 1308, or installed from ROM 1302. When the computer program is executed by processor 1301, it performs the functions defined in the image rendering method of embodiments of this disclosure.

[0214] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0215] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implement the image rendering method shown in the above embodiments.

[0216] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0217] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. An image rendering method, characterized in that, The method includes: Multiple halo layers are generated in the scene, and the size of the halo layer and the first relative position between the halo layer and the light source are determined based on a preset generation rule; Obtain the first position of the light source and the second position of the first pixel, wherein the first pixel is a specified pixel in the scene; For each of the halo layers, the first brightness corresponding to the first pixel is determined based on the size of the halo layer and the first relative position, the first position, and the second position; The first brightness is subjected to brightness perturbation processing to obtain the target brightness of the first pixel in the halo layer, and the first pixel in the scene is rendered based on the target brightness of all halo layers.

2. The method according to claim 1, characterized in that, Determining the first brightness corresponding to the first pixel based on the size of the halo layer and the first relative position, the first position, and the second position includes: Based on the first position and the first relative position, the position corresponding to the first ring in the ring layer is determined, wherein the first ring is used to construct the reference ring structure of the ring layer; Based on the position corresponding to the first halo and the second position, a first distance between the first pixel and the first halo is determined; Based on the first distance, the size, and the preset sharpness, the first preset brightness is obtained by power-law attenuation control.

3. The method according to claim 1 or 2, characterized in that, The step of performing brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer includes: According to the first preset adjustment rule, the first relative position is adjusted to obtain the second relative position between the halo layer and the light source; Based on the second relative position and the first position, the position corresponding to the second halo in the halo layer is determined, wherein the second halo is used to fill the halo layer; Based on the position corresponding to the second halo and the second position, a second distance between the first pixel and the second halo is determined; Based on the second distance, the second preset brightness is inversely attenuated to obtain the second brightness corresponding to the first pixel. Based on the second brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

4. The method according to claim 1 or 2, characterized in that, The step of performing brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer includes: According to the second preset adjustment rule, the first relative position is adjusted to obtain the third relative position between the halo layer and the light source; Based on the third relative position and the first position, the position corresponding to the third halo in the halo layer is determined, wherein the third halo is used to simulate the optical interference pattern in the halo layer; Based on the position corresponding to the third halo and the second position, a third distance between the first pixel and the third halo is determined; Based on the third distance, the third preset brightness is periodically controlled to obtain the third brightness corresponding to the first pixel. Based on the third brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

5. The method according to claim 2, characterized in that, The step of performing brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer includes: Based on the position corresponding to the first halo, the number of sides of the preset polygon, and the size of the halo layer where the first halo is located, a preset polygon corresponding to the first halo is determined in the scene; If the first pixel is located within the preset edge region corresponding to the preset polygon, then based on the distance between the first pixel and the preset polygon, polygon perturbation control is applied to the fourth preset brightness to obtain the fourth brightness. Based on the fourth brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

6. The method according to claim 5, characterized in that, The method further includes: According to the preset position transformation rules, the second position is transformed to obtain the third position of the first pixel in the preset shape space; Centered on a preset reference point in the preset shape space, the polar angle and fourth relative position of the first pixel relative to the preset reference point are determined based on the third position and the position of the preset reference point. Based on the number of sides of the preset polygon, determine the angle step size corresponding to each side of the preset polygon; Based on the polar angle, the fourth relative position, and the angular step size, the position information between the first pixel and the preset polygon is determined, and the position information is used to indicate whether the first pixel is located within the preset edge region.

7. The method according to claim 1 or 2, characterized in that, Before obtaining the first position of the light source and the second position of the first pixel, the method further includes: Obtain the pixel resolution corresponding to the scene; Based on the pixel resolution, the fourth position and the fifth position are transformed respectively to obtain the first position corresponding to the fourth position and the second position corresponding to the fifth position, wherein the fourth position is the texture coordinate of the light source and the fifth position is the texture coordinate of the first pixel.

8. The method according to claim 1 or 2, characterized in that, The first position includes a first coordinate, and the second position includes a second coordinate; before rendering the first pixel in the scene based on the target brightness of all the halo layers, the method further includes: Based on the first preset color parameter and the second preset color parameter, the color parameter of the coordinate between the first preset coordinate and the second preset coordinate is interpolated to obtain the first color parameter corresponding to the second coordinate. The first preset color parameter is a reference color parameter corresponding to the first preset coordinate in the preset coordinate direction in the scene, and the second preset color parameter is a reference color parameter corresponding to the second preset coordinate in the preset coordinate direction. The rendering of the first pixel in the scene based on the target brightness of all the halo layers includes: The first pixel is rendered based on the first color parameter and all the target brightness values.

9. The method according to claim 8, characterized in that, The step of interpolating the color parameters of the coordinates between the first preset coordinates and the second preset coordinates based on the first preset color parameters and the second preset color parameters to obtain the first color parameters corresponding to the second coordinates includes: Based on the first preset color parameter and the second preset color parameter, the color parameter of the coordinate between the first preset coordinate and the second preset coordinate is interpolated to obtain the second color parameter corresponding to the second coordinate. Based on the current moment, the second color parameter is periodically adjusted to obtain the first color parameter.

10. The method according to claim 1 or 2, characterized in that, The step of performing brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer includes: Based on the first position and the second position, determine the polar angle between the first pixel and the light source; Based on the polar angle, the fifth preset brightness is modulated and controlled to obtain the fifth brightness corresponding to the first pixel. Based on the fifth brightness, the first brightness is subjected to brightness perturbation processing to obtain the target brightness.

11. The method according to claim 1, characterized in that, Before the multiple halo layers in the generated scene, the method further includes: For each of the halo layers, size control parameters for the halo layer are generated based on a first preset random seed and the halo identifier of the halo layer; Based on the size control parameters, the preset size is controlled exponentially to obtain the size of the halo layer.

12. The method according to claim 1 or 11, characterized in that, Before the multiple halo layers in the generated scene, the method further includes: For each of the halo layers, relative position control parameters of the halo layer are generated based on the second preset random seed and the halo identifier of the halo layer; Based on the relative position control parameters, the offset distribution of the halo layer relative to the light source is controlled to obtain the first relative position between the halo layer and the light source.

13. An image rendering apparatus, characterized in that, The device includes: A generation module is used to generate multiple halo layers in a scene. The size of the halo layer and the first relative position between the halo layer and the light source are determined based on a preset generation rule. The acquisition module is used to acquire the first position of the light source and the second position of the first pixel, wherein the first pixel is one of the pixels in the scene; The determining module is configured to determine, for each of the halo layers, the first brightness corresponding to the first pixel based on the size of the halo layer and the first relative position, the first position and the second position; The rendering module is used to perform brightness perturbation processing on the first brightness to obtain the target brightness of the first pixel in the halo layer, and to render the first pixel in the scene based on the target brightness of all the halo layers.

14. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the image rendering method of any one of claims 1 to 12 by executing the computer instructions.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the image rendering method according to any one of claims 1 to 12.

16. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the image rendering method according to any one of claims 1 to 12.