Methods and apparatus for generating lens flare, electronic devices

By generating a set of facets and sampling texture coordinates, the lens flare generation process is simplified, improving the realism of the generated effect and the visual experience, and solving the problem of complex and poor effect in the existing technology of lens flare generation.

CN115546082BActive Publication Date: 2025-10-31NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211157998.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-22
Publication Date
2025-10-31
Estimated Expiration
2042-09-22

AI Technical Summary

Technical Problem

Existing technologies for generating lens flares are complex and produce poor results, failing to effectively simulate the dynamic effects of real-world scenes.

Method used

A set of facets is generated based on the attribute information of the lens flare, a set of sequence images is obtained, and the lens flare is generated by sampling texture coordinates, which simplifies the generation process and improves the visual effect.

Benefits of technology

The process of generating lens flare has been simplified, improving the realism of the generated effect and the visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546082B_ABST
    Figure CN115546082B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, and electronic device for generating lens flare. The method includes: generating a set of patches corresponding to the lens flare based on its attribute information; obtaining a set of sequence maps corresponding to the patch set; determining the sampled texture coordinates of the multi-frame textures based on the original texture coordinates of the patch set and the region information of the areas where the multi-frame textures are located in the sequence map set; sampling the sequence map set based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the patch set; and generating the lens flare based on the texture information of the patch set. This application solves the technical problems of complex lens flare generation processes and poor generation effects in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing, and more specifically, to a method and apparatus for generating lens flare, and an electronic device. Background Technology

[0002] Currently, when generating lens flares in virtual scenes such as games or animations, multiple lens flare maps are usually simply superimposed. However, since the shape and position of the maps are mostly fixed, in order to ensure that the generated lens flare effect is more in line with the real scene, the system needs to adjust the maps in real time according to the position of the virtual camera and the position of the light source. The whole process of generating lens flares is quite complicated. Furthermore, since the horizontal light and main light ray maps used to generate lens flares do not have the dynamic effects of the real scene, the generated lens flare effect is also poor.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This disclosure provides at least some embodiments of a method and apparatus for generating lens flare, as well as an electronic device, to at least solve the technical problems in the related art where the lens flare generation process is complex and the generation effect is poor.

[0005] According to one embodiment of this disclosure, a method for generating lens flare is provided. The method includes: generating a set of facets corresponding to the lens flare based on the attribute information of the lens flare, wherein the set of facets includes: ray facets, a first halo facet, multiple spot facets, and a second halo facet; obtaining a set of sequence maps corresponding to the set of facets, wherein the set of sequence maps includes a first light source sequence map and a second light source sequence map, the first light source sequence map being composed of a ray map corresponding to the ray facets, a first halo map corresponding to the first halo facets, and multiple spot map frames corresponding to the multiple spot facets, and the second light source sequence map being composed of multiple second halo map frames corresponding to the second halo facets; determining the sampled texture coordinates of the multiple map frames based on the original texture coordinates of the set of facets and the region information of the area where the multiple map frames are located in the set of sequence maps; sampling the set of sequence maps based on the sampled texture coordinates of the multiple map frames to obtain the texture information of the set of facets; and generating a lens flare based on the texture information of the set of facets.

[0006] According to one embodiment of this disclosure, a lens flare generation apparatus is also provided. The apparatus includes: a patch generation module, configured to generate a patch set corresponding to the lens flare based on the attribute information of the lens flare, wherein the patch set includes: a ray patch, a first flare patch, multiple spot patches, and a second flare patch; and a sequence image acquisition module, configured to acquire a sequence image set corresponding to the patch set, wherein the sequence image set includes a first light source sequence image and a second light source sequence image, the first light source sequence image consisting of a ray texture corresponding to the ray patch, a first spot patch corresponding to the first flare patch, and a second spot patch. The system consists of a halo map and multiple frames of halo maps corresponding to multiple halo patches. The second light source sequence map is composed of multiple frames of second halo maps corresponding to the second halo patches. The texture coordinate generation module is used to determine the sampled texture coordinates of the multi-frame maps based on the original texture coordinates of the patch set and the region information of the area where the multi-frame maps are located in the sequence map set. The sequence map acquisition module is used to sample the sequence map set based on the sampled texture coordinates of the multi-frame maps to obtain the texture information of the patch set. The lens flare generation module is used to generate lens flares based on the texture information of the patch set.

[0007] According to one embodiment of the present disclosure, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the lens flare generation method of any of the above claims when running.

[0008] According to one embodiment of this disclosure, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the lens flare generation method of any of the preceding claims.

[0009] In at least some embodiments of this disclosure, a set of patches corresponding to the lens flare is generated based on the attribute information of the lens flare; a set of sequence maps corresponding to the set of patches is obtained; the sampled texture coordinates of the multi-frame textures are determined based on the original texture coordinates of the set of patches and the region information of the area where the multi-frame textures are located in the set of sequence maps; the set of sequence maps is sampled based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the set of patches; the lens flare is generated by generating the set of patches and retrieving the corresponding flare map from the set of sequence maps based on the information of the set of patches. This eliminates the need to add all the flare maps to the virtual scene and then adjust them according to the position of the light source and the position of the virtual lens, which greatly simplifies the entire process of generating the lens flare. Furthermore, the flare map can be adjusted according to the initial texture coordinates of the set of patches, making the generated flare map more consistent with the real scene and improving the visual effect of the generated lens flare. This solves the technical problem of complex lens flare generation process and poor generation effect in related technologies. Attached Figure Description

[0010] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of this disclosure and are used to explain this disclosure, but do not constitute an undue limitation of this disclosure. In the drawings:

[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating lens flare according to an embodiment of the present disclosure.

[0012] Figure 2 This is a flowchart of a method for generating lens flare according to one embodiment of the present disclosure;

[0013] Figure 3 This is a schematic diagram of a halo image corresponding to a normal lens according to one embodiment of the present disclosure;

[0014] Figure 4 This is a schematic diagram of a first light source sequence according to one embodiment of the present disclosure;

[0015] Figure 5 This is a schematic diagram of a second light source sequence according to one embodiment of the present disclosure;

[0016] Figure 6 This is a schematic diagram of a user interface for generating lens flare according to one embodiment of the present disclosure;

[0017] Figure 7 This is a structural block diagram of a lens flare generation apparatus according to one embodiment of the present disclosure;

[0018] Figure 8 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present disclosure, and not all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present disclosure.

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

[0021] In one possible implementation, the method of generating lens flare by overlaying textures, commonly used in image processing, still suffers from technical problems after practical experience and careful research. The method is complex and produces poor results. Therefore, this disclosure proposes a lens flare generation method. The virtual scene used in this embodiment can be a game, animation, or similar virtual scene. The game type typically includes virtual scenes and lens flares. The method involves generating a set of facets corresponding to the lens flare based on its attribute information; obtaining a sequence of images corresponding to the facets; determining the sampled texture coordinates of the multi-frame textures based on the original texture coordinates of the facets and the region information of the areas where the multi-frame textures are located in the sequence of images; sampling the sequence of images based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the facets; and generating the lens flare based on the texture information of the facets. This simplifies the lens flare generation process for different lenses, thereby improving the efficiency of the entire lens flare generation process and the visual effect of the generated lens flare.

[0022] The methods and embodiments described above in this disclosure can be executed on mobile terminals, computer terminals, or similar computing devices. Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, PAD, game console, or other terminal device. Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating lens flare according to an embodiment of this disclosure. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. Processor 102 (processor 102 may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and memory 104 for storing data. In one embodiment of this disclosure, it may also include: transmission device 106, input / output device 108 and display device 110.

[0023] In some alternative embodiments primarily featuring virtual scenarios, the aforementioned device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.

[0024] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0025] According to one embodiment of this disclosure, an embodiment of a method for generating lens flare 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.

[0026] In one possible implementation, this disclosure provides a method for generating lens flare, which provides a graphical user interface through a terminal device. The terminal device can be either the aforementioned local terminal device or a client device in the aforementioned cloud interactive system. Figure 2 This is a flowchart of a method for generating lens flare according to one embodiment of the present disclosure, such as... Figure 2 As shown, the method includes the following steps:

[0027] Step S202: Based on the attribute information of the lens flare, generate a set of surfaces corresponding to the lens flare.

[0028] The set of facets includes: a ray facet, a first halo facet, multiple light spot facets, and a second halo facet.

[0029] Generally, when generating a lens flare in a virtual scene, it is often necessary to create multiple facets, such as ray facets, circular halo facets (i.e., the first halo facet mentioned above), and spot facets, and apply multiple halo maps to determine the texture information of different facets, such as ray maps, circular halo maps, and spot maps. A ray generally refers to the light emitted outward from a light source, such as the light emitted outward from a light source like the sun or a light bulb; a circular halo map... Figure 1 Generally, a halo refers to the ring around a light source when photographing it through a lens; a light spot generally refers to a circular bright spot outside the light source.

[0030] Generally, when using a lens to photograph a light source in a real-world scene, a certain number of horizontal halos are often generated depending on the relative positions of the lens and the light source. Therefore, in order to ensure the realism of the lens halos generated in the virtual scene and enable users to obtain good visual effects, horizontal halo patches (i.e., the second halo patch mentioned above) and horizontal halo maps can be added when generating lens halos to ensure that the lens halos have good visual effects.

[0031] Optionally, the attribute information of the lens flare includes, but is not limited to: the attribute information of the ray, the attribute information of the first flare, the attribute information of multiple light spots, and the attribute information of the second flare.

[0032] The aforementioned attribute information generally refers to the halo information in the real scene simulated based on the light source and virtual camera in the virtual scene, such as the brightness, size, and position of the circular and horizontal halos of the light source, and the brightness, size, and position of the rays and spots.

[0033] In one optional embodiment, multiple sets of halo, circular, and lateral halos and light spots can be constructed based on parameters such as the size of each halo patch, the position of the halo patch closest to the sun, the preset interval between halo patches, the additional distance of each halo patch, the size multiple of each halo patch, the intensity of the rotating halo, the color of the rotating halo, the size multiple, the brightness multiple, the scaling of the halo ring, the offset of the halo ring, the moving speed of the halo ring, the intensity of the halo ring, and the gap of the halo ring. This ensures that the lens flare generated by the sequence image set is more consistent with the actual scene.

[0034] For example, a light spot can be generated based on information such as the size of the light spot patch, the position of the patch closest to the virtual light source, the preset interval of the light spot patches, the additional distance of the light spot patches individually, and the size multiple of the light spot patches individually; a circular halo patch can be generated based on information such as the position of the virtual light source and the size of the circular halo patch; a main ray patch can be generated based on information such as the position of the virtual light source and the size multiple of the main ray patch; and a horizontal halo can be generated based on information such as the position of the virtual light source and the size multiple of the horizontal halo.

[0035] Figure 3 This is a schematic diagram of a halo image corresponding to a normal lens according to one embodiment of the present disclosure, such as... Figure 3 As shown, multiple circular and lateral halos radiate outwards from the location of the light source, while multiple circular light spots exist outside the light source. The effect of generating lens flares using multiple textures often requires achieving a certain level of detail. Figure 3 The degree of halo effect is shown to enhance the user's visual experience.

[0036] Step S204: Obtain the sequence graph set corresponding to the facet set.

[0037] The sequence map set includes a first light source sequence map and a second light source sequence map. The first light source sequence map consists of a ray map corresponding to a ray facet, a first halo map corresponding to a first halo facet, and multiple frames of halo maps corresponding to multiple spot facets. The second light source sequence map consists of multiple frames of second halo maps corresponding to a second halo facet.

[0038] The aforementioned sequence map set can refer to a map set composed of the aforementioned halo maps. Generally, since the shape of the horizontal halo map is different from that of other halo maps, two sequence map sets can be constructed.

[0039] The first light source sequence image mentioned above can refer to a sequence image composed of a ray map, a circular halo map, and multiple light spot maps; the second light source sequence image mentioned above can refer to a sequence image composed of multiple horizontal halo maps.

[0040] Figure 4 This is a schematic diagram of a first light source sequence according to one embodiment of the present disclosure, such as... Figure 4 As shown, numbers 1 to 7 can refer to multiple light spot textures, number 8 can refer to a circular halo texture, and number 9 can refer to a ray texture.

[0041] Figure 5 This is a schematic diagram of a second light source sequence according to one embodiment of the present disclosure, such as... Figure 5As shown, images 1, 2, and 3 represent horizontal halo maps, but with different textures. Using multiple horizontal halo maps with different texture information to generate a virtual light source can improve the realism of the generated virtual light source, thereby enhancing the user's visual experience. Images 4, 5, and 6 represent the masking channels corresponding to horizontal halo maps 1, 2, and 3, respectively. When obtaining the masking texture coordinates of the horizontal halo map, the masking channel image of the horizontal halo map can be obtained first, and then the corresponding masking texture coordinates can be determined based on the channel image.

[0042] Step S206: Based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, determine the sampled texture coordinates of the multi-frame textures.

[0043] The aforementioned original texture coordinates may refer to the coordinate position of each texture patch in the user interface; the aforementioned region information may refer to the position, size, and sequence number of each texture in the sequence image set, but is not limited to this; the aforementioned sampled texture coordinates may be the texture coordinates obtained after rotating, offsetting, and scaling the original texture coordinates, through which the texture information used to generate different patches can be accurately extracted from the sequence image.

[0044] To ensure that lens flares present a good visual effect in the user interface, the sampled texture coordinates of each texture can be determined based on the original texture coordinates of the facet and the region information of each texture.

[0045] For example, when photographing a light source using a lens, the image of the light source presented in the lens will look like... Figure 3 As shown, multiple lateral halos are generated in different directions, and each lateral halo has different parameters such as size and brightness. Therefore, when utilizing... Figure 4 Before generating the virtual light source using the horizontal halo map, the sampling texture coordinates corresponding to the horizontal halo map can be determined based on the information of the facets corresponding to the horizontal halo in the aforementioned facet set. This ensures the efficiency of the subsequent horizontal halo generation. Furthermore, when generating lens flares in the virtual scene, multiple horizontal halo maps with different directions and sizes can be set according to the position and brightness of the light source and its relative position to the virtual lens. This ensures that the halo of the virtual light source presented in the user interface is more consistent with the real scene.

[0046] Step S208: Sample the sequence map set based on the sampled texture coordinates of the multi-frame texture to obtain the texture information of the patch set.

[0047] The aforementioned texture information can refer to the texture information obtained by sampling the colors of different textures in the sequence image based on preset brightness information. This texture information can be used to generate the corresponding facets.

[0048] Once the aforementioned sampled texture coordinates are determined, the corresponding texture can be selected from the aforementioned sequence map set. The texture is then processed using the coordinate position information corresponding to the sampled texture coordinates to obtain the texture information used to generate the patch. In one optional embodiment, the operations for adjusting the texture may include, but are not limited to, brightness adjustment and color adjustment.

[0049] For example, after determining the horizontal halo patches corresponding to multiple horizontal halos, the horizontal halo can be sampled from the sequence map set according to the sampled texture coordinates of the horizontal halo corresponding to the patch. Then, the brightness and color of the horizontal halo are adjusted to obtain a texture information of the light source halo that conforms to the actual scene, thereby improving the realism of the light source halo finally presented in the user interface.

[0050] Step S210: Generate lens flare based on texture information of the patch set.

[0051] After determining the texture information corresponding to each texture patch, the final lens flare can be generated using the texture information corresponding to each texture patch.

[0052] Figure 6 This is a schematic diagram of a user interface for generating lens flare according to one embodiment of the present disclosure, such as... Figure 6 As shown, the light sources in the user interface can be clearly observed to include multiple horizontal halos, circular halos, light beam images, and multiple light spot images captured by the virtual lens. The lens flare generated through the above steps greatly improves the visual effect of the generated lens flare, allowing users to have a good viewing experience whether they are playing games or watching animated videos.

[0053] In at least some embodiments of this disclosure, a set of patches corresponding to the lens flare is generated using attribute information based on the lens flare; a set of sequence maps corresponding to the patch set is obtained; the sampled texture coordinates of the multi-frame textures are determined based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set; the sequence map set is sampled based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the patch set; the lens flare is generated by generating the patch set and then retrieving the corresponding flare map from the sequence map set according to the information of the patch set. This eliminates the need to add all the flare maps to the virtual scene and then adjust them according to the position of the light source and the position of the virtual lens, greatly simplifying the entire lens flare generation process. Furthermore, the flare maps can be adjusted according to the initial texture coordinates of the patch set, making the generated flare maps more consistent with the real scene and improving the visual effect of the generated lens flare. This solves the technical problems of complex lens flare generation process and poor generation effect in related technologies.

[0054] Optionally, based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, the sampled texture coordinates of the multi-frame textures are determined, including: determining the sampled texture coordinates of the ray texture based on the original texture coordinates of the ray patch and the region information of the area where the ray texture is located in the first light source sequence map; determining the sampled texture coordinates of the first halo texture based on the original texture coordinates of the first halo patch and the region information of the area where the first halo texture is located in the first light source sequence map; determining the sampled texture coordinates of the multi-frame spot texture based on the original texture coordinates of the multiple spot patches and the region information of the area where the multiple-frame spot textures are located in the first light source sequence map; and determining the sampled texture coordinates of the multi-frame second halo texture based on the original texture coordinates of the second halo patch and the region information of the area where the multiple-frame second halo textures are located in the second light source sequence map.

[0055] In one optional embodiment, the halo map corresponding to the original texture coordinate information of the patch can be determined first, and then the sampling texture coordinates of the halo map can be determined according to the region information of the halo map in the sequence map set.

[0056] For example, if the patch is a ray patch, then the region information of the ray map corresponding to the ray patch in the first light source sequence map can be determined first, for example... Figure 4 The size and sequence number of the ray map with the sequence number 9 are determined. Then, based on the original texture coordinates of the ray patch in the virtual scene, the information of these areas is adjusted to determine the sampled texture coordinates of the ray map in the virtual scene.

[0057] Similarly, if the patch is the first halo patch, the circular halo map can be determined first from the first light source sequence map, for example... Figure 4 The region information of the circular halo texture with serial number 8 is used, and then the above region information is adjusted according to the original texture coordinates of the first halo patch to determine the sampling texture coordinates of the circular halo texture in the virtual scene.

[0058] If the patch is a spot patch, the spot map can be determined first from the first light source sequence map, for example... Figure 4 The region information of the circular halo maps numbered 1-7 is then used to adjust the above region information based on the original texture coordinates of the light spot patches, thereby determining the sampling texture coordinates of the light spot maps in the virtual scene.

[0059] If the patch is the second halo patch, the lateral halo map can be determined first from the second light source sequence map, for example... Figure 5 The region information of the circular halo maps numbered 1, 2, and 3 is then used to adjust the above region information based on the original texture coordinates of the second halo patch, thereby determining the sampling texture coordinates of the horizontal halo map in the virtual scene.

[0060] By determining the sampling texture coordinates of each map, the halo map can be retrieved directly from the sequence map set when adjusting and generating the halo map in the future. There is no need to add the halo map to the virtual scene corresponding to the user interface. This avoids the problem that the halo map is repeatedly moved due to the movement of the virtual camera, which makes the process of generating lens flares too complicated and inefficient.

[0061] Optionally, the sampled texture coordinates of the ray map are determined based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram. This includes: determining the target texture coordinates of the ray map based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram; and determining the sampled texture coordinates of the ray map based on the target texture coordinates of the ray map, a preset rotation center, and a preset rotation angle.

[0062] To better illustrate the entire process of obtaining the sampled texture coordinates of the halo map, the following is a detailed explanation of obtaining the sampled texture coordinates of the ray map:

[0063] First, after generating multiple sets of facets based on the attribute information of the lens flare, the specific type of each facet can be determined according to its position information. If the facet is located between the virtual light source and the virtual lens, its specific type can be determined as a ray facet. Next, based on the position coordinates of the ray facet as displayed in the user interface, the original texture coordinates of the ray facet can be determined, and the required ray map can be retrieved from the first light source sequence map to obtain the position coordinates, normal size, and other area information of the ray map.

[0064] After obtaining the original texture coordinates and region information, the ray map can be further adjusted according to some preset parameters, such as the position, brightness, and relative position of the virtual light source with respect to the virtual camera. This allows control over the position, size, brightness, and spacing between the ray map in the user interface, thereby determining the target texture coordinates of the ray map in the user interface.

[0065] Finally, considering that in real-world scenarios, light rays can produce dynamic glare effects due to changes in camera angle, the ray map can be dynamically processed during the generation of lens flare. For example, when the virtual camera moves, the ray map can be controlled to rotate according to a preset rotation center and angle based on the displacement and direction of the movement. Figure 1 Generally, it matches the virtual light source, so the above dynamic processing can be performed on the basis of the target texture coordinates determined above to obtain the final sampled texture coordinates. This avoids the problem of poor realism caused by the light map not changing when the virtual lens moves, and makes the generated lens halo more in line with the real scene, thereby improving the user's viewing experience.

[0066] Optionally, based on the original texture coordinates of the second halo patch and the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, the sampled texture coordinates of the multiple frames of second halo maps are determined, including: based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, and the scaling size of the multiple frames of second halo maps, determining the first texture coordinates and the first mask texture coordinates of the multiple frames of second halo maps; based on the first texture coordinates and the offset of the multiple frames of second halo maps, determining the second texture coordinates of the multiple frames of second halo maps; based on the first mask texture coordinates and the offset of the multiple frames of second halo maps, determining the second mask texture coordinates of the multiple frames of second halo maps; and based on the second texture coordinates and the second mask texture coordinates, obtaining the sampled texture coordinates.

[0067] Because horizontal halo maps are easily affected by the virtual camera and change significantly with variations in the virtual camera, the sampling texture coordinates of the horizontal halo map can also be determined by... Figure 5 The horizontal halo textures in the image are scaled, shifted, and masked. Finally, the processed horizontal halo textures are superimposed on the main body of the virtual light source. At the same time, based on the main body of the virtual light source, occlusion cancellation, displacement cancellation, and dynamic horizontal halo post-processing operations are performed to make the light spot move with the change of lens angle and position, so as to obtain a horizontal halo change that is more in line with the real scene.

[0068] Specifically, this can be done first based on the original texture coordinates of the second halo patch, and... Figure 5 The region information and scaling size of the horizontal halo map are used to initially determine the first texture coordinates and the first mask texture coordinates of the horizontal halo map.

[0069] When the virtual camera moves, the position of the virtual light source in the user interface also changes, along with the position of the horizontal halo map. Therefore, based on the relative position of the virtual light source and the virtual camera after the position change, and the direction of the position change, the offset displacement of the halo map can be initially determined. Then, this offset displacement is used to offset the first texture coordinate and the first mask texture coordinate, respectively, to obtain the offset second texture coordinate and the second mask texture coordinate.

[0070] Finally, the second texture coordinates and the second mask texture coordinates can be fused together to obtain multiple sampled texture coordinates of the horizontal halo, thus ensuring that the generated horizontal halo is more consistent with the changes in the horizontal halo after the lens moves in the actual scene.

[0071] Optionally, based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map, the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map are determined, including: determining the target movement direction based on a preset position; determining the movement position of the multiple frames of the second halo map based on the preset position, the second halo interval, and the flare value of the multiple frames of the second halo map; and determining the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map based on the target movement direction, the movement position of the multiple frames of the second halo map, the movement speed of the multiple frames of the second halo map, the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map.

[0072] The aforementioned preset position can refer to the position of the virtual light source relative to the virtual lens after it moves. Specifically, when determining the offset displacement of the horizontal halo map, the relative position of the virtual light source and the virtual lens after the virtual light source moves can be used to determine the direction of relative movement of the virtual lens and the virtual light source, and then the target movement direction of the horizontal halo map can be determined. For example, when the virtual lens moves to the left and the virtual light source does not move, the aforementioned target movement direction can still be to the left.

[0073] After determining the target movement direction, the target movement position of the horizontal halo map can be further determined based on the preset interval between multiple horizontal halo maps and the change of the preset flare value of the horizontal halo map, thereby roughly determining the texture coordinate position of the horizontal halo map.

[0074] Finally, based on a series of preset parameters, such as the texture coordinates of the horizontal halo before the displacement change, the coordinate position of the virtual light source, the texture number of the horizontal halo texture to be generated in the second light source sequence diagram, the scaling size of the horizontal halo, the interval between multiple horizontal halos, the offset displacement of each horizontal halo, and the moving speed of each horizontal halo, the first texture coordinates and the first mask texture coordinates of the horizontal halo texture are determined.

[0075] Optionally, the sequence map set is sampled based on the sampled texture coordinates of multiple frames of texture maps to obtain the texture information of the patch set, including: sampling the first light source sequence map based on the sampled texture coordinates of the ray map to obtain the color of the ray map, and obtaining the texture information of the ray patch based on the color and brightness of the ray map; sampling the first light source sequence map based on the sampled texture coordinates of the first halo map to obtain the color of the first halo map, and obtaining the texture information of the first halo patch based on the color and brightness of the first halo map; sampling the first light source sequence map based on the sampled texture coordinates of multiple frames of spot maps to obtain the color of multiple frames of spot maps, and obtaining the texture information of multiple spot patches based on the color and brightness of multiple frames of spot maps; sampling the second light source sequence map based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of multiple frames of the second halo map, and obtaining the texture information of the second halo patch based on the color and brightness of multiple frames of the second halo map.

[0076] After determining the sampling texture coordinates of each halo image, multiple texture information for generating the above-mentioned patch set can be determined based on these texture coordinates.

[0077] Specifically, the aforementioned texture information may include, but is not limited to, parameters such as texture color, texture brightness, and texture details. For example, if it is necessary to generate a ray patch, relevant texture information, such as the color and brightness parameters of the ray texture, can be obtained from the first light source sequence image based on the sampled texture coordinates of the ray texture. Then, based on the brightness of the texture and the preset brightness multiple of the ray patch itself, the actual ray brightness used when generating the ray patch can be determined. Based on the aforementioned ray color and brightness parameters, the texture information of the ray patch can be generated.

[0078] Similarly, if it is necessary to generate the first halo patch, the relevant texture information can be obtained from the first light source sequence map based on the sampled texture coordinates of the circular halo map, and the circular halo brightness used to generate the first halo patch can be determined based on the brightness multiple of the first halo patch and the brightness of the circular halo map, so as to obtain the texture information for generating the first halo patch.

[0079] If it is necessary to generate light spot patches, the relevant texture information can be obtained from the first light source sequence map based on the sampled texture coordinates of the light spot map, and the light spot brightness used to generate the light spot patches can be determined based on the brightness multiple of the light spot map and the brightness of the circular halo map, so as to obtain the texture information of the generated light spot patches.

[0080] If it is necessary to generate the second halo patch, the relevant texture information can be obtained from the second light source sequence map based on the sampled texture coordinates of the circular halo map. It should be noted that since the brightness of the horizontal halo patch is affected by the virtual light source, when determining the brightness of the horizontal halo, the brightness of the horizontal halo can be determined based on the coordinate position of the virtual light source and the brightness of the horizontal halo map, thereby obtaining the texture information for generating the horizontal halo patch.

[0081] Optionally, based on the colors and brightness of multiple light spot maps, texture information of multiple light spot patches is obtained, including: obtaining texture information of the first light spot patch based on the color and brightness of the first light spot map in the multiple light spot maps; obtaining texture information of the second light spot patch based on the colors of the second and third light spot maps and the brightness of the second light spot map in the multiple light spot maps, wherein the second light spot map is any map other than the first light spot map in the multiple light spot maps, and the third light spot map is the map in the frame preceding the second light spot map in the multiple light spot maps.

[0082] In one optional embodiment, considering that when using a lens to photograph a light source in a real-world scenario, light spots may overlap, the brightness of the current light spot can be determined by combining the light spot parameters of the previous and next frames of the current light spot, namely the first light spot map, the second light spot map, and the third light spot map mentioned above.

[0083] Specifically, the color and brightness information of the first spot texture can be obtained first based on the texture coordinate information of the first spot texture. At the same time, the color and brightness of the second spot texture and the color information of the third spot texture can be obtained. The color and brightness of the first spot texture can be superimposed to ensure that the spot superimposed area can better match the spot information captured by the lens in the real scene.

[0084] Optionally, the first light source sequence image is sampled based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of the multiple frames of the second halo map, and the texture information of the second halo patch is obtained based on the color and brightness of the multiple frames of the second halo map, including: sampling the second light source sequence image based on the second texture coordinates of the multiple frames of the second halo map to obtain the texture color of the multiple frames of the second halo map; sampling a preset channel of the second light source sequence image based on the second mask texture coordinates of the multiple frames of the second halo map to obtain the mask color of the multiple frames of the second halo map; obtaining the brightness of the multiple frames of the second halo map based on the position of the second halo and the intensity of the multiple frames of the second halo map; and fusing the texture color, mask color, and brightness of the multiple frames of the second halo map to obtain the texture information of the second halo patch.

[0085] The aforementioned preset channel may refer to the horizontal lens flare sequence map channel, which is generally the masking channel of the horizontal lens flare map.

[0086] When obtaining the texture information of the horizontal halo map, the texture color in the second light source sequence map and the preset channel of the above texture can be sampled separately based on the second texture coordinate and the second mask texture coordinate to obtain the texture color and mask color of the horizontal halo map.

[0087] Since the horizontal halo is affected by the position and brightness of the virtual light source, the brightness of the horizontal halo can be determined based on the halo position of the horizontal halo patch and the texture brightness of the horizontal halo map, thus making the brightness of the horizontal halo more realistic.

[0088] After obtaining the texture color, mask color, and texture brightness mentioned above, these parameters can be fused to obtain the final texture information used to generate the horizontal halo patch.

[0089] After obtaining the texture information corresponding to each patch, the patches can be further fused and generated based on this texture information to obtain the final lens flare. The specific flare effect can be as follows: Figure 6 As shown.

[0090] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solutions of this disclosure, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this disclosure.

[0091] This embodiment also provides a lens flare generation apparatus, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the terms "unit" and "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.

[0092] Figure 7 This is a structural block diagram of a lens flare generation apparatus according to one embodiment of the present disclosure. A graphical user interface is provided through a terminal device, and the content displayed by the graphical user interface at least partially includes a virtual scene and lens flare, such as... Figure 7 As shown, the device includes: a patch generation module 702, used to generate a set of patches corresponding to the lens flare based on the attribute information of the lens flare, wherein the patch set includes: a ray patch, a first halo patch, multiple spot patches, and a second halo patch; and a sequence image acquisition module 704, used to acquire a set of sequence images corresponding to the patch set, wherein the sequence image set includes a first light source sequence image and a second light source sequence image, the first light source sequence image being composed of a ray texture corresponding to the ray patch, a first halo texture corresponding to the first halo patch, and multiple spot patches corresponding to the first halo patch. The second light source sequence map is composed of multiple frames of light spot maps, and the second light source sequence map is composed of multiple frames of second halo maps corresponding to the second halo patches; the texture coordinate generation module 706 is used to determine the sampled texture coordinates of the multi-frame maps based on the original texture coordinates of the patch set and the region information of the area where the multi-frame maps are located in the sequence map set; the sequence map acquisition module 708 is used to sample the sequence map set based on the sampled texture coordinates of the multi-frame maps to obtain the texture information of the patch set; the lens flare generation module 710 is used to generate lens flare based on the texture information of the patch set.

[0093] Optionally, the texture coordinate generation module 706 includes: a first coordinate determination unit, used to determine the sampled texture coordinates of the ray map based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram; a second coordinate determination unit, used to determine the sampled texture coordinates of the first halo map based on the original texture coordinates of the first halo patch and the region information of the area where the first halo map is located in the first light source sequence diagram; a third coordinate determination unit, used to determine the sampled texture coordinates of multiple frames of halo maps based on the original texture coordinates of multiple spot patches and the region information of the area where multiple frames of spot maps are located in the first light source sequence diagram; and a fourth coordinate determination unit, used to determine the sampled texture coordinates of multiple frames of second halo maps based on the original texture coordinates of the second halo patch and the region information of the area where multiple frames of second halo maps are located in the second light source sequence diagram.

[0094] Optionally, the first coordinate determination unit includes: a first coordinate determination subunit, used to determine the target texture coordinates of the ray map based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram; and a second coordinate determination subunit, used to determine the sampled texture coordinates of the ray map based on the target texture coordinates of the ray map, a preset rotation center, and a preset rotation angle.

[0095] Optionally, the fourth coordinate determination unit includes: a third coordinate determination subunit, used to determine the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo texture based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo texture are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo texture; a fourth coordinate determination subunit, used to determine the second texture coordinates of the multiple frames of the second halo texture based on the first texture coordinates and the offset of the multiple frames of the second halo texture; and to determine the second mask texture coordinates of the multiple frames of the second halo texture based on the first mask texture coordinates and the offset of the multiple frames of the second halo texture; and a fifth coordinate determination subunit, used to obtain the sampled texture coordinates based on the second texture coordinates and the second mask texture coordinates.

[0096] Optionally, the fourth coordinate determination subunit is further configured to: determine the target movement direction based on a preset position; determine the movement position of the multiple frames of the second halo map based on the preset position, the second halo interval, and the flare values ​​of the multiple frames of the second halo map; and determine the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map based on the target movement direction, the movement position of the multiple frames of the second halo map, the movement speed of the multiple frames of the second halo map, the original texture coordinates of the second halo patch, the area information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map.

[0097] Optionally, the sequence image acquisition module 708 includes: a first information acquisition unit, used to sample the first light source sequence image based on the sampled texture coordinates of the ray map to obtain the color of the ray map, and to obtain the texture information of the ray patch based on the color and brightness of the ray map; and a second information acquisition unit, used to sample the first light source sequence image based on the sampled texture coordinates of the first halo map to obtain the color of the first halo map, and to obtain the texture information of the first halo patch based on the color and brightness of the first halo map. The third information acquisition unit is used to sample the first light source sequence map based on the sampled texture coordinates of the multi-frame spot map to obtain the color of the multi-frame spot map, and obtain the texture information of multiple spot patches based on the color and brightness of the multi-frame spot map; the fourth information acquisition unit is used to sample the second light source sequence map based on the sampled texture coordinates of the multi-frame second halo map to obtain the color of the multi-frame second halo map, and obtain the texture information of the second halo patch based on the color and brightness of the multi-frame second halo map.

[0098] Optionally, the third information acquisition unit includes: a first information acquisition subunit, used to obtain the texture information of the first spot patch based on the color and brightness of the first spot patch in the multi-frame spot pattern; and a second information acquisition subunit, used to obtain the texture information of the second spot patch based on the color of the second spot patch, the color of the third spot patch, and the brightness of the second spot patch in the multi-frame spot pattern, wherein the second spot patch is any other patch in the multi-frame spot pattern except the first spot patch, and the third spot patch is the patch in the frame preceding the second spot patch in the multi-frame spot pattern.

[0099] Optionally, the fourth information acquisition unit includes: a first color acquisition subunit, which samples the second light source sequence map based on the second texture coordinates of the second halo map in multiple frames to obtain the texture color of the second halo map in multiple frames; a second color acquisition subunit, which samples a preset channel of the second light source sequence map based on the second mask texture coordinates of the second halo map in multiple frames to obtain the mask color of the second halo map in multiple frames; a first brightness acquisition subunit, which obtains the brightness of the second halo map in multiple frames based on the position of the second halo and the intensity of the second halo map in multiple frames; and a third information acquisition subunit, which fuses the texture color, the mask color, and the brightness of the second halo map in multiple frames to obtain the texture information of the second halo patch.

[0100] Optionally, the attribute information of the lens flare includes: the attribute information of the ray, the attribute information of the first flare, the attribute information of multiple light spots, and the attribute information of the second flare.

[0101] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but not limited to these: all the above-mentioned units and modules are located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.

[0102] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to perform the steps in any of the above method embodiments when executed.

[0103] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0104] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0105] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0106] S1: Based on the attribute information of the lens flare, generate a set of facets corresponding to the lens flare, wherein the set of facets includes: ray facets, first flare facets, multiple spot facets and second flare facets;

[0107] S2: Obtain the sequence map set corresponding to the patch set. The sequence map set includes the first light source sequence map and the second light source sequence map. The first light source sequence map consists of the light map corresponding to the light patch, the first halo map corresponding to the first halo patch, and the multi-frame halo map corresponding to multiple light spot patches. The second light source sequence map consists of the multi-frame second halo map corresponding to the second halo patch.

[0108] S3: Based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, determine the sampled texture coordinates of the multi-frame textures;

[0109] S4: Sample the sequence map set based on the sampled texture coordinates of the multi-frame texture to obtain the texture information of the patch set;

[0110] S5: Generate lens flare based on texture information from a set of facets.

[0111] Optionally, based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, the sampled texture coordinates of the multi-frame textures are determined, including: determining the sampled texture coordinates of the ray texture based on the original texture coordinates of the ray patch and the region information of the area where the ray texture is located in the first light source sequence map; determining the sampled texture coordinates of the first halo texture based on the original texture coordinates of the first halo patch and the region information of the area where the first halo texture is located in the first light source sequence map; determining the sampled texture coordinates of the multi-frame spot texture based on the original texture coordinates of the multiple spot patches and the region information of the area where the multiple-frame spot textures are located in the first light source sequence map; and determining the sampled texture coordinates of the multi-frame second halo texture based on the original texture coordinates of the second halo patch and the region information of the area where the multiple-frame second halo textures are located in the second light source sequence map.

[0112] Optionally, the sampled texture coordinates of the ray map are determined based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram. This includes: determining the target texture coordinates of the ray map based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram; and determining the sampled texture coordinates of the ray map based on the target texture coordinates of the ray map, a preset rotation center, and a preset rotation angle.

[0113] Optionally, based on the original texture coordinates of the second halo patch and the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, the sampled texture coordinates of the multiple frames of second halo maps are determined, including: based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, and the scaling size of the multiple frames of second halo maps, determining the first texture coordinates and the first mask texture coordinates of the multiple frames of second halo maps; based on the first texture coordinates and the offset of the multiple frames of second halo maps, determining the second texture coordinates of the multiple frames of second halo maps; based on the first mask texture coordinates and the offset of the multiple frames of second halo maps, determining the second mask texture coordinates of the multiple frames of second halo maps; and based on the second texture coordinates and the second mask texture coordinates, obtaining the sampled texture coordinates.

[0114] Optionally, based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map, the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map are determined, including: determining the target movement direction based on a preset position; determining the movement position of the multiple frames of the second halo map based on the preset position, the second halo interval, and the flare value of the multiple frames of the second halo map; and determining the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map based on the target movement direction, the movement position of the multiple frames of the second halo map, the movement speed of the multiple frames of the second halo map, the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map.

[0115] Optionally, the sequence map set is sampled based on the sampled texture coordinates of multiple frames of texture maps to obtain the texture information of the patch set, including: sampling the first light source sequence map based on the sampled texture coordinates of the ray map to obtain the color of the ray map, and obtaining the texture information of the ray patch based on the color and brightness of the ray map; sampling the first light source sequence map based on the sampled texture coordinates of the first halo map to obtain the color of the first halo map, and obtaining the texture information of the first halo patch based on the color and brightness of the first halo map; sampling the first light source sequence map based on the sampled texture coordinates of multiple frames of spot maps to obtain the color of multiple frames of spot maps, and obtaining the texture information of multiple spot patches based on the color and brightness of multiple frames of spot maps; sampling the second light source sequence map based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of multiple frames of the second halo map, and obtaining the texture information of the second halo patch based on the color and brightness of multiple frames of the second halo map.

[0116] Optionally, based on the colors and brightness of multiple light spot maps, texture information of multiple light spot patches is obtained, including: obtaining texture information of the first light spot patch based on the color and brightness of the first light spot map in the multiple light spot maps; obtaining texture information of the second light spot patch based on the colors of the second and third light spot maps and the brightness of the second light spot map in the multiple light spot maps, wherein the second light spot map is any map other than the first light spot map in the multiple light spot maps, and the third light spot map is the map in the frame preceding the second light spot map in the multiple light spot maps.

[0117] Optionally, the first light source sequence image is sampled based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of the multiple frames of the second halo map, and the texture information of the second halo patch is obtained based on the color and brightness of the multiple frames of the second halo map, including: sampling the second light source sequence image based on the second texture coordinates of the multiple frames of the second halo map to obtain the texture color of the multiple frames of the second halo map; sampling a preset channel of the second light source sequence image based on the second mask texture coordinates of the multiple frames of the second halo map to obtain the mask color of the multiple frames of the second halo map; obtaining the brightness of the multiple frames of the second halo map based on the position of the second halo and the intensity of the multiple frames of the second halo map; and fusing the texture color, mask color, and brightness of the multiple frames of the second halo map to obtain the texture information of the second halo patch.

[0118] Optionally, the attribute information of the lens flare includes: the attribute information of the ray, the attribute information of the first flare, the attribute information of multiple light spots, and the attribute information of the second flare.

[0119] In at least some embodiments of this disclosure, a set of patches corresponding to the lens flare is generated using attribute information based on the lens flare; a set of sequence maps corresponding to the patch set is obtained; the sampled texture coordinates of the multi-frame textures are determined based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set; the sequence map set is sampled based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the patch set; the lens flare is generated by generating the patch set and then retrieving the corresponding flare map from the sequence map set according to the information of the patch set. This eliminates the need to add all the flare maps to the virtual scene and then adjust them according to the position of the light source and the position of the virtual lens, greatly simplifying the entire lens flare generation process. Furthermore, the flare maps can be adjusted according to the initial texture coordinates of the patch set, making the generated flare maps more consistent with the real scene and improving the visual effect of the generated lens flare. This solves the technical problems of complex lens flare generation process and poor generation effect in related technologies.

[0120] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0121] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to the various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.

[0122] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited thereto. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0123] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0124] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0125] Embodiments of this disclosure also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0126] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0127] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0128] S1: Based on the attribute information of the lens flare, generate a set of facets corresponding to the lens flare, wherein the set of facets includes: ray facets, first flare facets, multiple spot facets and second flare facets;

[0129] S2: Obtain the sequence map set corresponding to the patch set. The sequence map set includes the first light source sequence map and the second light source sequence map. The first light source sequence map consists of the light map corresponding to the light patch, the first halo map corresponding to the first halo patch, and the multi-frame halo map corresponding to multiple light spot patches. The second light source sequence map consists of the multi-frame second halo map corresponding to the second halo patch.

[0130] S3: Based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, determine the sampled texture coordinates of the multi-frame textures;

[0131] S4: Sample the sequence map set based on the sampled texture coordinates of the multi-frame texture to obtain the texture information of the patch set;

[0132] S5: Generate lens flare based on texture information from a set of facets.

[0133] Optionally, based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, the sampled texture coordinates of the multi-frame textures are determined, including: determining the sampled texture coordinates of the ray texture based on the original texture coordinates of the ray patch and the region information of the area where the ray texture is located in the first light source sequence map; determining the sampled texture coordinates of the first halo texture based on the original texture coordinates of the first halo patch and the region information of the area where the first halo texture is located in the first light source sequence map; determining the sampled texture coordinates of the multi-frame spot texture based on the original texture coordinates of the multiple spot patches and the region information of the area where the multiple-frame spot textures are located in the first light source sequence map; and determining the sampled texture coordinates of the multi-frame second halo texture based on the original texture coordinates of the second halo patch and the region information of the area where the multiple-frame second halo textures are located in the second light source sequence map.

[0134] Optionally, the sampled texture coordinates of the ray map are determined based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram. This includes: determining the target texture coordinates of the ray map based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram; and determining the sampled texture coordinates of the ray map based on the target texture coordinates of the ray map, a preset rotation center, and a preset rotation angle.

[0135] Optionally, based on the original texture coordinates of the second halo patch and the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, the sampled texture coordinates of the multiple frames of second halo maps are determined, including: based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of second halo maps are located in the second light source sequence image, and the scaling size of the multiple frames of second halo maps, determining the first texture coordinates and the first mask texture coordinates of the multiple frames of second halo maps; based on the first texture coordinates and the offset of the multiple frames of second halo maps, determining the second texture coordinates of the multiple frames of second halo maps; based on the first mask texture coordinates and the offset of the multiple frames of second halo maps, determining the second mask texture coordinates of the multiple frames of second halo maps; and based on the second texture coordinates and the second mask texture coordinates, obtaining the sampled texture coordinates.

[0136] Optionally, based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map, the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map are determined, including: determining the target movement direction based on a preset position; determining the movement position of the multiple frames of the second halo map based on the preset position, the second halo interval, and the flare value of the multiple frames of the second halo map; and determining the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map based on the target movement direction, the movement position of the multiple frames of the second halo map, the movement speed of the multiple frames of the second halo map, the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map.

[0137] Optionally, the sequence map set is sampled based on the sampled texture coordinates of multiple frames of texture maps to obtain the texture information of the patch set, including: sampling the first light source sequence map based on the sampled texture coordinates of the ray map to obtain the color of the ray map, and obtaining the texture information of the ray patch based on the color and brightness of the ray map; sampling the first light source sequence map based on the sampled texture coordinates of the first halo map to obtain the color of the first halo map, and obtaining the texture information of the first halo patch based on the color and brightness of the first halo map; sampling the first light source sequence map based on the sampled texture coordinates of multiple frames of spot maps to obtain the color of multiple frames of spot maps, and obtaining the texture information of multiple spot patches based on the color and brightness of multiple frames of spot maps; sampling the second light source sequence map based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of multiple frames of the second halo map, and obtaining the texture information of the second halo patch based on the color and brightness of multiple frames of the second halo map.

[0138] Optionally, based on the colors and brightness of multiple light spot maps, texture information of multiple light spot patches is obtained, including: obtaining texture information of the first light spot patch based on the color and brightness of the first light spot map in the multiple light spot maps; obtaining texture information of the second light spot patch based on the colors of the second and third light spot maps and the brightness of the second light spot map in the multiple light spot maps, wherein the second light spot map is any map other than the first light spot map in the multiple light spot maps, and the third light spot map is the map in the frame preceding the second light spot map in the multiple light spot maps.

[0139] Optionally, the first light source sequence image is sampled based on the sampled texture coordinates of multiple frames of the second halo map to obtain the color of the multiple frames of the second halo map, and the texture information of the second halo patch is obtained based on the color and brightness of the multiple frames of the second halo map, including: sampling the second light source sequence image based on the second texture coordinates of the multiple frames of the second halo map to obtain the texture color of the multiple frames of the second halo map; sampling a preset channel of the second light source sequence image based on the second mask texture coordinates of the multiple frames of the second halo map to obtain the mask color of the multiple frames of the second halo map; obtaining the brightness of the multiple frames of the second halo map based on the position of the second halo and the intensity of the multiple frames of the second halo map; and fusing the texture color, mask color, and brightness of the multiple frames of the second halo map to obtain the texture information of the second halo patch.

[0140] Optionally, the attribute information of the lens flare includes: the attribute information of the ray, the attribute information of the first flare, the attribute information of multiple light spots, and the attribute information of the second flare.

[0141] In at least some embodiments of this disclosure, a set of patches corresponding to the lens flare is generated using attribute information based on the lens flare; a set of sequence maps corresponding to the patch set is obtained; the sampled texture coordinates of the multi-frame textures are determined based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set; the sequence map set is sampled based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the patch set; the lens flare is generated by generating the patch set and then retrieving the corresponding flare map from the sequence map set according to the information of the patch set. This eliminates the need to add all the flare maps to the virtual scene and then adjust them according to the position of the light source and the position of the virtual lens, greatly simplifying the entire lens flare generation process. Furthermore, the flare maps can be adjusted according to the initial texture coordinates of the patch set, making the generated flare maps more consistent with the real scene and improving the visual effect of the generated lens flare. This solves the technical problems of complex lens flare generation process and poor generation effect in related technologies.

[0142] Figure 8 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 8 As shown, the electronic device 800 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0143] like Figure 8 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processor 810, at least one memory 820, a bus 830 connecting different system components (including memory 820 and processor 810), and a display 840.

[0144] The memory 820 stores program code that can be executed by the processor 810, causing the processor 810 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this disclosure.

[0145] The memory 820 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include read-only memory (ROM) 8203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0146] In some instances, memory 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 820 may further include memory remotely located relative to processor 810, which can be connected to electronic device 800 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0147] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 810, or a local bus using any of the various bus structures.

[0148] The display 840 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 800.

[0149] Optionally, the electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 850. Furthermore, the electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 860. Figure 8 As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although... Figure 8 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0150] The aforementioned electronic device 800 may also include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.

[0151] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 800 may also include components that are more... Figure 8 The more or fewer components shown, or having the same Figure 1 Different configurations are shown. The memory 820 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the lens flare generation method in this embodiment. The processor 810 executes various functional applications and data processing by running the computer program stored in the memory 820, thereby realizing the above-described lens flare generation method.

[0152] In the above embodiments of this disclosure, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0153] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0156] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0157] The above are merely preferred embodiments of this disclosure. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this disclosure, and these improvements and modifications should also be considered within the scope of protection of this disclosure.

Claims

1. A method for generating lens flare, characterized in that, include: Based on the attribute information of the lens flare, a set of patches corresponding to the lens flare is generated, wherein the set of patches includes: a ray patch, a first flare patch, multiple ray spot patches and a second flare patch, and the second flare patch is used to characterize the lateral flare patch. Obtain the sequence map set corresponding to the set of patches, wherein the sequence map set includes a first light source sequence map and a second light source sequence map, the first light source sequence map is composed of a light map corresponding to the light patch, a first halo map corresponding to the first halo patch, and multiple frames of halo maps corresponding to the multiple spot patches, and the second light source sequence map is composed of multiple frames of second halo maps corresponding to the second halo patch. Based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, the sampled texture coordinates of the multi-frame textures are determined. The original texture coordinates are used to characterize the coordinate position of the patches in the patch set in the user interface. The region information includes at least one of the following: the position, size and sequence number of the texture in the sequence map. Based on the sampled texture coordinates of the multi-frame textures, the sequence map set is sampled to obtain the texture information of the patch set. The texture information of the second halo patch is obtained by fusing the texture color, mask color, and brightness of the multi-frame second halo textures. The brightness is based on the position of the second halo and the intensity of the multi-frame second halo textures. The mask color is obtained by sampling a preset channel of the second light source sequence map using the second mask texture coordinates of the multi-frame second halo textures. The preset channel is used to characterize the mask channel of the second halo texture. The texture color is obtained by sampling the second light source sequence map using the second texture coordinates of the multi-frame second halo textures. The lens flare is generated based on the texture information of the set of patches.

2. The method according to claim 1, characterized in that, Based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set, the sampled texture coordinates of the multi-frame textures are determined, including: Based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram, the sampled texture coordinates of the ray map are determined; Based on the original texture coordinates of the first halo patch and the region information of the area where the first halo map is located in the first light source sequence diagram, the sampled texture coordinates of the first halo map are determined. Based on the original texture coordinates of the multiple light spot patches and the regional information of the area where the multiple frames of light spot maps are located in the first light source sequence diagram, the sampled texture coordinates of the multiple frames of light spot maps are determined; Based on the original texture coordinates of the second halo patch and the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, the sampled texture coordinates of the multiple frames of the second halo map are determined.

3. The method according to claim 2, characterized in that, Based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram, the sampled texture coordinates of the ray map are determined, including: Based on the original texture coordinates of the ray patch and the region information of the area where the ray map is located in the first light source sequence diagram, the target texture coordinates of the ray map are determined; Based on the target texture coordinates, preset rotation center, and preset rotation angle of the ray map, the sampled texture coordinates of the ray map are determined.

4. The method according to claim 2, characterized in that, Based on the original texture coordinates of the second halo patch and the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, the sampled texture coordinates of the multiple frames of the second halo map are determined, including: Based on the original texture coordinates of the second halo patch, the region information of the area where the multi-frame second halo map is located in the second light source sequence diagram, and the scaling size of the multi-frame second halo map, the first texture coordinates and the first mask texture coordinates of the multi-frame second halo map are determined. The second texture coordinates of the multi-frame second halo map are determined based on the first texture coordinates of the multi-frame second halo map and the offset of the multi-frame second halo map; The second mask texture coordinates of the multi-frame second halo map are determined based on the first mask texture coordinates of the multi-frame second halo map and the offset of the multi-frame second halo map; The sampling texture coordinates are obtained based on the second texture map coordinates and the second mask texture coordinates.

5. The method according to claim 4, characterized in that, Based on the original texture coordinates of the second halo patch, the region information of the area where the multiple frames of the second halo map are located in the second light source sequence diagram, and the scaling size of the multiple frames of the second halo map, the first texture coordinates and the first mask texture coordinates of the multiple frames of the second halo map are determined, including: Determine the target's direction of movement based on the preset location; Based on the preset position, the second halo interval, and the flare value of the multi-frame second halo map, the moving position of the multi-frame second halo map is determined; Based on the target movement direction, the movement position of the multi-frame second halo map, the movement speed of the multi-frame second halo map, the original texture coordinates of the second halo patch, the region information of the area where the multi-frame second halo map is located in the second light source sequence diagram, and the scaling size of the multi-frame second halo map, the first texture coordinates and the first mask texture coordinates of the multi-frame second halo map are determined.

6. The method according to claim 1, characterized in that, Based on the sampled texture coordinates of the multi-frame textures, the sequence map set is sampled to obtain the texture information of the patch set, including: The first light source sequence map is sampled based on the sampled texture coordinates of the ray map to obtain the color of the ray map, and the texture information of the ray patch is obtained based on the color and brightness of the ray map. Based on the sampled texture coordinates of the first halo map, the first light source sequence map is sampled to obtain the color of the first halo map, and based on the color and brightness of the first halo map, the texture information of the first halo patch is obtained. Based on the sampled texture coordinates of the multi-frame spot map, the first light source sequence map is sampled to obtain the color of the multi-frame spot map, and based on the color and brightness of the multi-frame spot map, the texture information of the multiple spot patches is obtained. The second light source sequence map is sampled based on the sampled texture coordinates of the multi-frame second halo map to obtain the color of the multi-frame second halo map, and the texture information of the second halo patch is obtained based on the color and brightness of the multi-frame second halo map.

7. The method according to claim 6, characterized in that, Based on the color and brightness of the multi-frame spot maps, the texture information of the multiple spot patches is obtained, including: Based on the color and brightness of the first frame of the multi-frame spot map, the texture information of the first spot patch is obtained. Based on the color of the second spot map, the color of the third spot map, and the brightness of the second spot map in the multi-frame spot map, the texture information of the second spot patch is obtained. The second spot map is any other map in the multi-frame spot map except for the first spot map, and the third spot map is the map in the frame preceding the second spot map in the multi-frame spot map.

8. The method according to claim 1, characterized in that The attribute information of the lens halo includes: the attribute information of the light rays, the attribute information of the first halo, the attribute information of multiple light spots, and the attribute information of the second halo.

9. A lens flare generating device, characterized in that, include: The patch generation module is used to generate a set of patches corresponding to the lens flare based on the attribute information of the lens flare. The set of patches includes: a ray patch, a first flare patch, multiple ray spot patches, and a second flare patch. The second flare patch is used to characterize the lateral flare patch. The sequence image acquisition module is used to acquire the sequence image set corresponding to the patch set, wherein the sequence image set includes a first light source sequence image and a second light source sequence image. The first light source sequence image is composed of a light ray map corresponding to the light ray patch, a first halo map corresponding to the first halo patch, and multiple frames of halo maps corresponding to the multiple spot patches. The second light source sequence image is composed of multiple frames of second halo maps corresponding to the second halo patch. A texture coordinate generation module is used to determine the sampled texture coordinates of the multi-frame textures based on the original texture coordinates of the patch set and the region information of the area where the multi-frame textures are located in the sequence map set. The original texture coordinates are used to characterize the coordinate position of the patches in the patch set in the user interface. The region information includes at least one of the following: the position, size and sequence number of the texture in the sequence map. The sequence image acquisition module is used to sample the sequence image set based on the sampled texture coordinates of the multi-frame textures to obtain the texture information of the patch set. The texture information of the second halo patch is obtained by fusing the texture color, mask color, and brightness of the multi-frame second halo textures. The brightness is based on the position of the second halo and the intensity of the multi-frame second halo textures. The mask color is obtained by sampling a preset channel of the second light source sequence image using the second mask texture coordinates of the multi-frame second halo textures. The preset channel is used to characterize the mask channel of the second halo texture. The texture color is obtained by sampling the second light source sequence image using the second texture coordinates of the multi-frame second halo textures. A lens flare generation module is used to generate the lens flare based on the texture information of the patch set.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run by a processor, the method for generating lens flare as described in any one of claims 1 to 8.

11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the lens flare generation method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Lens flare drawing method and device

    CN106846454A