Volumetric light generation method, device, electronic device, storage medium and program product
By real-time identification and sampling of the original volumetric light region in a 2D scene, the volumetric light effect is generated, and the problems of high cost and poor generalization in the prior art are solved, and efficient volumetric light effect generation is achieved.
Patent Information
- Application Number
- CN202411962498.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-04
AI Technical Summary
In 2D scenarios, the prior art relies on special-effect surface sheets and particle systems to simulate volumetric light effects, and there are problems such as high cost, poor generalization and insufficient real-time computing capabilities.
By determining the brightness information of the original image captured by the virtual camera, identifying the original area of the volumetric light, and performing multiple samples to generate the volumetric light effect, the dependence on pre-designed special-effect panels and particles is avoided, and real-time computing and rendering technology are adopted.
It reduces costs, improves the generality of volumetric light effects and real-time computing capabilities, and is suitable for flexible adjustments in various 2D scenes.
Smart Images

Figure CN119762615A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of graphics rendering technology, and in particular to a volume light generation method, device, electronic device, storage medium and program product. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] In virtual scenes, volumetric light is a visual effect used to enhance the atmosphere and texture of game scenes. Volumetric light is a technology used in computer graphics to simulate Tyndall light, which is a light scattering phenomenon based on the physical phenomenon of the Tyndall effect. Volumetric light is usually manifested as a visible beam effect when light passes through fog or dust, making the scene more vivid and realistic.
[0004] In 3D scenes, the realization of volumetric light effects depends on the three-dimensional world coordinates, shadows and depth information of the scene, which are calculated in real time through complex ray tracing algorithms or volume rendering technology. However, in 2D scenes, this three-dimensional information cannot be obtained, so the volumetric light implementation method in 3D scenes is not applicable to 2D scenes.
[0005] In the related art, in a 2D scene, the realization of volumetric light effects mainly depends on special effect patches and particles, which are projected into the 2D scene through the particle system of the game engine to simulate the volumetric light effect.
[0006] However, special effect patches and particles need to be pre-customized according to the virtual scene of the application. Therefore, the implementation of volumetric light effects that rely on special effect patches and particles has the problems of high cost, poor versatility and insufficient real-time computing capability. Summary of the invention
[0007] In view of this, the purpose of the present disclosure is to propose a volume light generation method, device, electronic device, storage medium and program product, which at least to a certain extent solve one of the technical problems in the related art.
[0008] Based on the above purpose, the first aspect of the exemplary embodiment of the present disclosure provides a volume light generating method, including:
[0009] Determine an original image captured by a virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image;
[0010] Determine preset position information, and determine the original area of the volume light in the brightness information image based on the position information;
[0011] Determine a preset brightness threshold, take the area consisting of pixels whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area, and obtain a volume light generation area image;
[0012] Sampling the volume light generation area image multiple times, offsetting the sampling position during the multiple samplings, and obtaining a volume light sampling result;
[0013] The volume light sampling result is applied to the original image.
[0014] Based on the same inventive concept, a second aspect of the exemplary embodiment of the present disclosure provides a volume light generating device, including:
[0015] A brightness information extraction module is configured to determine an original image captured by a virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image;
[0016] A volume light original area determination module is configured to determine preset position information, and based on the position information, determine the volume light original area in the brightness information image;
[0017] The volume light generation area image generation module is configured to determine a preset brightness threshold, take the area composed of pixel points whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area, and obtain the volume light generation area image;
[0018] A volume light information sampling and generating module is configured to perform multiple sampling on the volume light generating area image, offset the sampling position during the multiple samplings, and obtain a volume light sampling result;
[0019] The volume light sampling result application module is configured to apply the volume light sampling result to the original image.
[0020] Based on the same inventive concept, a third aspect of the exemplary embodiment of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect is implemented.
[0021] Based on the same inventive concept, a fourth aspect of the exemplary embodiments of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method described in the first aspect.
[0022] Based on the same inventive concept, a fifth aspect of the exemplary embodiments of the present disclosure provides a computer program product, including computer program instructions. When the computer program instructions are executed on a computer, the computer executes the method described in the first aspect.
[0023] From the above, it can be seen that the volumetric light generation method, device, electronic device, storage medium and program product provided by the embodiments of the present disclosure include: determining the original image captured by the virtual camera, extracting the brightness information of the original image, replacing the color information of the pixel points in the original image with the brightness information, and obtaining a brightness information image; determining the preset position information, and based on the position information, determining the original area of the volumetric light in the brightness information image; determining the preset brightness threshold, and taking the area composed of the pixel points whose brightness information in the original area of the volumetric light is greater than or equal to the brightness threshold as the first volumetric light generation area, and obtaining a volumetric light generation area image; sampling the volumetric light generation area image multiple times, offsetting the sampling position in the multiple samplings, and obtaining a volumetric light sampling result; applying the volumetric light sampling result to the original image. Through the present disclosure, there is no need to rely on pre-designed special effect patches and particles, and through real-time calculation and rendering, a volumetric light effect is generated for the current scene screen, which reduces costs, improves versatility and improves real-time computing capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 A schematic diagram of an application scenario of a volume light generation method provided by an exemplary embodiment of the present disclosure;
[0026] Figure 2 A schematic flow chart of a volume light generation method provided for an exemplary embodiment of the present disclosure;
[0027] Figure 3 A schematic diagram of an original screen provided for an exemplary embodiment of the present disclosure;
[0028] Figure 4 A schematic diagram of a brightness information screen provided by an exemplary embodiment of the present disclosure;
[0029] Figure 5 A schematic diagram of a volume light original area provided for an exemplary embodiment of the present disclosure;
[0030] Figure 6 A schematic diagram of an image containing brightness information of an original area of volume light provided by an exemplary embodiment of the present disclosure;
[0031] Figure 7 A schematic diagram of a volume light generation area image provided for an exemplary embodiment of the present disclosure;
[0032] Figure 8 A schematic diagram of a mask area provided for an exemplary embodiment of the present disclosure;
[0033] Fig. 9 Another schematic diagram of a volume light generation area image provided for an exemplary embodiment of the present disclosure;
[0034] Fig.10 A schematic diagram of a volume light generation area image after downsampling provided by an exemplary embodiment of the present disclosure;
[0035] Fig.11 A schematic diagram of a volume light sampling result provided for an exemplary embodiment of the present disclosure;
[0036] Fig.12 A schematic diagram of a volume light application image provided for an exemplary embodiment of the present disclosure;
[0037] Fig.13 A schematic structural diagram of a volume light generating device provided by an exemplary embodiment of the present disclosure;
[0038] Fig.14 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] It is understandable that before using the technical solutions disclosed in the embodiments of this application, the type, scope of use, usage scenarios, etc. of the personal information involved in this application should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0040] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present application according to the prompt message.
[0041] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0042] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation method of the present application. Other methods that meet relevant laws and regulations may also be applied to the implementation method of the present application.
[0043] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0044] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, the principles and spirit of the present disclosure will be described with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0045] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0046] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connecting" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly. The article "one" or "a" before an element does not exclude the existence of multiple such elements.
[0047] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.
[0048] As described in the background technology, in the field of modern game development, volumetric light is a common visual effect, which is widely used to enhance the atmosphere and picture texture of game scenes. Volumetric light is a technology that simulates Tyndall light in computer graphics. Tyndall light is a light scattering phenomenon based on the physical phenomenon Tyndall effect. Volumetric light is usually manifested as a visible beam effect when light passes through fog or dust, making the scene more vivid and realistic. In 3D scenes, the realization of volumetric light effects depends on the three-dimensional world coordinates, shadows and depth information of the scene, which are calculated in real time through complex ray tracing algorithms or volume rendering technology. However, in 2D scenes, these three-dimensional information cannot be obtained, so the traditional volumetric light implementation method becomes unrealistic.
[0049] In the related technology, in the development of 2D scene games, the realization of volumetric light effects mainly relies on special effect patch particles, which are placed in the 2D scene through the particle system of the game engine to simulate the volumetric light effect. The specific implementation method includes the following steps:
[0050] 1) Create special effect patches: Artists design special effect patches of different shapes, transparencies and colors according to requirements.
[0051] 2) Configure particle system: Configure the particle system in the game engine and set parameters such as the number, position, and motion trajectory of generated particles.
[0052] 3) Scene placement: Place the configured particle effects in the 2D scene according to the design needs of different scenes.
[0053] This method can simulate the volumetric light effect to a certain extent. However, the inventors of the present disclosure have found that there are many limitations:
[0054] 1) High production cost: Each special effect particle needs to be customized, which consumes a lot of time and resources, especially when different effects are required.
[0055] 2) Poor versatility: The special effects particle method has poor adaptability to different scenes and needs to be adjusted separately for each scene. It is difficult to quickly generate volumetric light effects in different 2D scenes.
[0056] 3) Insufficient real-time computing power: The special effects particle method relies on pre-designed textures and parameters and cannot be dynamically adjusted according to real-time changes in the scene, resulting in effects that are not realistic and flexible enough.
[0057] In order to solve the above problems, the present disclosure provides a volumetric light generation solution, which specifically includes: determining an original image captured by a virtual camera, extracting brightness information of the original image, replacing color information of pixels in the original image with the brightness information, and obtaining a brightness information image; determining preset position information, and based on the position information, determining an original area of volumetric light in the brightness information image; determining a preset brightness threshold, and taking an area composed of pixels in the original area of volumetric light whose brightness information is greater than or equal to the brightness threshold as a first volumetric light generation area, and obtaining a volumetric light generation area image; sampling the volumetric light generation area image multiple times, offsetting the sampling position in the multiple samplings, and obtaining a volumetric light sampling result; and applying the volumetric light sampling result to the original image.
[0058] Through the present disclosure, there is no need to rely on pre-designed special effect patches and particles. Through real-time calculation and rendering, a volumetric light effect is generated for the current scene image, which reduces costs, improves versatility and improves real-time computing capabilities.
[0059] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0060] refer to Figure 1 , which is a schematic diagram of an application scenario of the volume light generation method provided by an exemplary embodiment of the present disclosure.
[0061] This application scenario includes a terminal device 101 and a server 102. The terminal device 101 and the server 102 may be connected via a wired or wireless communication network to achieve data interaction.
[0062] The terminal device 101 may be an electronic device with data transmission and multimedia input / output functions close to the user side, including but not limited to a desktop computer, a mobile phone, a mobile computer, a tablet computer, a media player, a smart wearable device, a personal digital assistant (PDA) or other electronic devices capable of realizing the above functions. The electronic device may include a processor and a display screen with a touch input function, the display screen is used to present a graphical user interface, the graphical user interface can display an application interface, and the processor is used to process application data, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0063] Server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0064] In some exemplary embodiments, the volume light generation method may be run on the terminal device 101 or the server 102 .
[0065] When the volumetric light generation method is run on the server 102, the server 102 is used to provide volumetric light generation services to the user of the terminal device 101, and the terminal device 101 is installed with a client that communicates with the server 102. The terminal device 101 stores a game program, runs the game program through the client and is used to present the game screen. The terminal device 101 captures the game screen currently displayed by the client through a virtual camera in the virtual scene, and sends the game screen as an original image to the server 102.
[0066] The server 102 determines the original image captured by the virtual camera, extracts the brightness information of the original image, replaces the color information of the pixel points in the original image with the brightness information, and obtains a brightness information image; determines the preset position information, and based on the position information, determines the original area of the volume light in the brightness information image; determines a preset brightness threshold, and uses the area composed of pixel points in the original area of the volume light whose brightness information is greater than or equal to the brightness threshold as the first volume light generation area to obtain a volume light generation area image; samples the volume light generation area image multiple times, offsets the sampling position in the multiple samplings, and obtains a volume light sampling result; applies the volume light sampling result to the original image.
[0067] The server 102 sends the image to which the volume light sampling result is applied to the client, and the client displays the image to which the volume light sampling result is applied to the user.
[0068] In the above embodiment, the volume light generation method is described by taking the example of running on the server 102 , however, the present disclosure is not limited thereto, and in some exemplary embodiments, the volume light generation method may also run on the terminal device 101 .
[0069] When the volumetric light generation method is run on the terminal device 101, the terminal device 110 may include a display screen and a processor. The terminal device 110 is installed with a client, through which the game program is run and used to present the game screen. The terminal device 101 captures the game screen currently displayed by the client through a virtual camera in the virtual scene, and sends the game screen as an original image to the processor.
[0070] The processor determines the original image captured by the virtual camera, extracts the brightness information of the original image, replaces the color information of the pixel points in the original image with the brightness information, and obtains the brightness information image; determines the preset position information, and based on the position information, determines the original area of the volume light in the brightness information image; determines the preset brightness threshold, and uses the area composed of the pixel points in the original area of the volume light whose brightness information is greater than or equal to the brightness threshold as the first volume light generation area to obtain the volume light generation area image; samples the volume light generation area image multiple times, offsets the sampling position in the multiple samplings, and obtains the volume light sampling result; applies the volume light sampling result to the original image.
[0071] The processor sends the image to which the volumetric light sampling result is applied to the client, and the client displays the image to which the volumetric light sampling result is applied to the user through a display screen.
[0072] Combine the following Figure 1 The volumetric light generation method according to the exemplary embodiment of the present disclosure is described by using the application scenario. It should be noted that the above application scenario is only shown to facilitate understanding of the spirit and principle of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0073] refer to Figure 2 , which is a flow chart of a volume light generating method provided by an exemplary embodiment of the present disclosure.
[0074] The volume light generation method includes the following steps:
[0075] Step S210: determine the original image captured by the virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image.
[0076] During specific implementation, a virtual camera is used to capture a picture of a virtual scene as an original image.
[0077] During specific implementation, a virtual camera is usually provided in a game engine such as Unity, and different shooting images in a virtual scene can be obtained by operating the virtual camera.
[0078] As an example, see Figure 3 , which is a schematic diagram of an original screen provided by an exemplary embodiment of the present disclosure.
[0079] In this exemplary embodiment, the step of extracting the brightness information of the original image and replacing the color information of the pixels in the original image with the brightness information to obtain the brightness information image includes:
[0080] Determine color information of pixels in the original image;
[0081] Performing weighted summation on the color values of different channels in the color information with different weight parameters respectively to obtain the brightness information;
[0082] The color information of the pixel point is replaced by the brightness information to obtain the brightness information image.
[0083] In a specific implementation, the color information includes RGB values;
[0084] The color values of different channels in the color information, including the R value, G value and B value in the RGB value;
[0085] The color values of different channels in the color information are weighted and summed with different weight parameters to obtain the brightness information, including:
[0086] Y=0.2126×R+0.7152×G+0.0722×B;
[0087] Among them, Y represents the calculated brightness information, and R, G, and B represent the values of the red, green, and blue channels, respectively.
[0088] Taking into account the different sensitivities of the human eye to different colors, green, which is the most sensitive to the human eye, is given the highest weight, followed by red, and blue is the lowest.
[0089] As an example, see Figure 4 , which is a schematic diagram of a brightness information image provided by an exemplary embodiment of the present disclosure.
[0090] Step S220: determine preset position information, and based on the position information, determine the original area of the volume light in the brightness information image.
[0091] In this exemplary embodiment, the position information includes center information and radius information, and the step of determining the preset position information and determining the original area of the volume light in the brightness information image based on the position information includes:
[0092] Determine the distance between the pixel point in the original image and the center information;
[0093] comparing the distance with the radius information;
[0094] The area composed of pixel points whose distance is less than or equal to the radius information is used as the original area of the volume light.
[0095] In specific implementation, the original area of volumetric light is obtained by the following formula:
[0096] Volumetric light original area = radius information - length (center information - pixel coordinates);
[0097] Among them, length represents the length function.
[0098] The pixel point coordinates include UV coordinates.
[0099] In practice, the length function calculates the Euclidean distance between two points, that is, the straight-line distance from one point to another. In two-dimensional space, if the region center is the circle center coordinates (Cx, Cy), and UV is the coordinates of the current point (Ux, Uy), then the region center-UV calculates the difference vector between the two points (Cx-Ux, Cy-Uy), and length (region center-UV) calculates the length of this vector, that is, the distance between the two points.
[0100] Then, determine whether a point is within the boundary of the circle. If the calculated area is greater than 0, then the point is outside the boundary of the circle; if it is equal to 0, then the point is exactly on the boundary of the circle; if it is less than 0, then the point is inside the circle.
[0101] As an example, see Figure 5 , which is a schematic diagram of the original area of volumetric light provided by an exemplary embodiment of the present disclosure.
[0102] During specific implementation, the original area of the volume light is applied to the brightness information image to obtain the brightness information image including the original area of the volume light.
[0103] As an example, see Figure 6 , which is a schematic diagram of an image containing brightness information of an original area of volumetric light provided by an exemplary embodiment of the present disclosure.
[0104] In the above exemplary embodiments, the original area of the volume light is described as a circular area. However, the present disclosure is not limited thereto. In some possible implementations, the shape of the original area of the volume light depends on the shape of the light source and the medium through which the light passes:
[0105] In specific implementation, if the light source is circular, then the light path of the volume light may appear circular; if the light source is square, then the light path of the volume light may appear square. Specifically, the shape of the original area of the volume light can be any shape, as long as the arrangement of the light source and the medium allows the path of the light to be scattered and visible. Therefore, the original area of the volume light can be circular or any other shape.
[0106] Step S230, determine a preset brightness threshold, and take the area composed of pixel points whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area to obtain a volume light generation area image.
[0107] In this exemplary embodiment, the step of determining a preset brightness threshold, taking an area composed of pixels whose brightness information in the volume light original area is greater than or equal to the brightness threshold as a first volume light generation area, and obtaining a volume light generation area image includes:
[0108] Comparing the brightness information of the pixel points in the original area of the volume light with the brightness threshold;
[0109] The area consisting of the pixel points whose brightness information is greater than or equal to the brightness threshold is used as the first volume light generation area;
[0110] Based on the first volume light generation area, the volume light generation area image is obtained.
[0111] In specific implementation, the volume light generation area image is obtained by the following formula:
[0112] Volumetric light generation area image = volumetric light original area × (brightness information – brightness threshold).
[0113] The brightness information is Y in S210.
[0114] As an example, see Figure 7 , which is a schematic diagram of a volume light generation area image provided by an exemplary embodiment of the present disclosure.
[0115] In the above exemplary embodiment, the size of the volumetric light generation area is adjusted by the brightness threshold. Specifically, if the brightness is greater than the brightness threshold, then (brightness-brightness threshold) will be a positive number and the area size will increase; if the brightness is less than the brightness threshold, then (brightness-brightness threshold) will be a negative number and the area size will decrease; if the brightness is equal to the brightness threshold, then (brightness-brightness threshold) will be zero and the area size will remain unchanged.
[0116] Through the above exemplary embodiments, a volumetric light generation area is generated in the image. However, the present disclosure is not limited thereto. The present disclosure also provides a method for generating a volumetric light generation area based on a custom mask, specifically:
[0117] In this exemplary embodiment, after taking the area consisting of pixels whose brightness information is greater than or equal to the brightness threshold as the first volume light generation area, the method further includes:
[0118] Determine a preset mask, and determine a mask area of the mask in the brightness information image;
[0119] Inverting the brightness information of the mask area to obtain an inverted mask area;
[0120] Processing the inverted mask area based on the brightness threshold to obtain a second volume light generation area;
[0121] Then, obtaining the volume light generation area image based on the first volume light generation area includes:
[0122] Based on the second volume light generation area and the first volume light generation area, the volume light generation area image is obtained.
[0123] In a specific implementation, the brightness information of the mask area is inverted to obtain the inverted mask area, including:
[0124] The brightness information of the mask area after inversion = 1-brightness information;
[0125] The brightness information is Y in S210.
[0126] Through the above exemplary embodiments, the brightness information of the inverted mask area is used to fit the effect of volume light leaking from a high-brightness object.
[0127] In a specific implementation, the inverted mask area is processed based on the brightness threshold by the following formula to obtain the second volume light generation area:
[0128] The second volumetric light generation area=mask area×(brightness information of the mask area−brightness threshold).
[0129] As an example, see Figure 8 , which is a schematic diagram of a mask area provided by an exemplary embodiment of the present disclosure.
[0130] In this exemplary embodiment, obtaining the volume light generation area image based on the second volume light generation area and the first volume light generation area includes:
[0131] Based on the mask, the second volume light generation area and the first volume light generation area are interpolated to obtain the volume light generation area image.
[0132] As an example, see Fig. 9 , which is another schematic diagram of the volume light generation area image provided by an exemplary embodiment of the present disclosure.
[0133] In this exemplary embodiment, before the volume light generation area image is sampled multiple times, the method further includes:
[0134] Downsampling the volume light generation area image to obtain a downsampled volume light generation area image;
[0135] Then, the multiple sampling of the volume light generation area image includes:
[0136] The downsampled volume light generation area image is sampled multiple times.
[0137] In specific implementation, the texture sampling reduces the sampling rate and uses a downsampling coefficient. For example, when the downsampling coefficient is 2, an image is formed every 2 pixels in each row and column of the image to be downsampled.
[0138] As an example, see Fig.10 , which is a schematic diagram of a downsampled volume light generation area image provided by an exemplary embodiment of the present disclosure.
[0139] Through the above exemplary embodiments, the volumetric light achieves a soft effect.
[0140] In this exemplary embodiment, in another rendering pass, the volume light generation area image is downsampled.
[0141] In specific implementation, in graphics rendering, a rendering channel (or rendering pass) refers to a stage in the rendering pipeline where a specific rendering task is performed. For example, one pass may be dedicated to rendering opaque objects in the scene, another pass may be used for transparent objects, and another may be used for post-processing effects.
[0142] Step S240: sampling the volume light generation area image multiple times, offsetting the sampling positions during the multiple samplings, and obtaining volume light sampling results.
[0143] In this exemplary embodiment, the multiple sampling of the volume light generation area image and the offsetting of the sampling position during the multiple samplings include:
[0144] The sampling position of the next sampling between two adjacent samplings is offset by a preset distance along the preset volume light direction compared to the sampling position of the previous sampling.
[0145] During specific implementation, the sampling position adopts UV coordinates.
[0146] In this exemplary embodiment, the volume light generation area image is sampled multiple times, and the sampling position is offset during the multiple samplings to obtain the volume light sampling result, including:
[0147] The sampling results of the multiple samplings are superimposed and divided by the sampling times of the multiple samplings to obtain the volume light sampling result.
[0148] In specific implementation, it is achieved through the following formula:
[0149] UV sampling superposition offset value = custom UV offset distance for each sampling × (custom volume light direction - UV coordinate);
[0150] Volumetric light sampling result = UV sampling superposition offset value / custom volumetric light sampling times.
[0151] As an example, see Fig.11 , which is a schematic diagram of the volume light sampling result provided by an exemplary embodiment of the present disclosure.
[0152] Step S250: Apply the volume light sampling result to the original image.
[0153] In this exemplary embodiment, applying the volume light sampling result to the original image includes:
[0154] The volume light sampling result is multiplied by the preset volume light color and then mixed with the original image.
[0155] In specific implementation, the volume light sampling result is multiplied by the preset volume light color and then mixed with the original image through the following formula:
[0156] The final effect = volume light sampling result × volume light color + original image.
[0157] During specific implementation, the color of the volume light is determined based on the color of the light source and the characteristics of the scattering medium.
[0158] As an example, see Fig.12 , which is a schematic diagram of a volumetric light application image provided by an exemplary embodiment of the present disclosure.
[0159] Among them, compared with Figure 3 The original image shown without volumetric lighting applied. Fig.12Image shown with Volume Light applied having the Volume Light effect.
[0160] From the above, it can be seen that the volumetric light generation method provided by the embodiment of the present disclosure includes: determining the original image captured by the virtual camera, extracting the brightness information of the original image, replacing the color information of the pixel points in the original image with the brightness information, and obtaining a brightness information image; determining preset position information, and based on the position information, determining the original area of the volumetric light in the brightness information image; determining a preset brightness threshold, and taking the area composed of pixel points in the original area of the volumetric light whose brightness information is greater than or equal to the brightness threshold as the first volumetric light generation area, to obtain a volumetric light generation area image; sampling the volumetric light generation area image multiple times, offsetting the sampling position in the multiple samplings, and obtaining a volumetric light sampling result; applying the volumetric light sampling result to the original image.
[0161] Through the present disclosure, there is no need to rely on pre-designed special effect patches and particles. Through real-time calculation and rendering, a volumetric light effect is generated for the current scene image, which reduces costs, improves versatility and improves real-time computing capabilities.
[0162] Furthermore, through custom parameters and masks, the volumetric light effect can be adjusted at any time according to the scene requirements. It is suitable for a variety of different 2D scenes, with high flexibility and dynamic adjustment.
[0163] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0164] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0165] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a volume light generating device.
[0166] refer to Fig.13 , volume light generation device, including the following modules:
[0167] The brightness information extraction module 1310 is configured to determine the original image captured by the virtual camera, extract the brightness information of the original image, replace the color information of the pixel points in the original image with the brightness information, and obtain a brightness information image;
[0168] The volume light original area determination module 1320 is configured to determine preset position information, and determine the volume light original area in the brightness information image based on the position information;
[0169] The volume light generation area image generation module 1330 is configured to determine a preset brightness threshold, take an area consisting of pixels whose brightness information is greater than or equal to the brightness threshold in the volume light original area as a first volume light generation area, and obtain a volume light generation area image;
[0170] The volume light information sampling and generating module 1340 is configured to perform multiple sampling on the volume light generating area image, offset the sampling position during the multiple samplings, and obtain the volume light sampling result;
[0171] The volume light sampling result application module 1350 is configured to apply the volume light sampling result to the original image.
[0172] In some exemplary embodiments, the brightness information extraction module 1310 is specifically configured to:
[0173] Determine color information of pixels in the original image;
[0174] Performing weighted summation on the color values of different channels in the color information with different weight parameters respectively to obtain the brightness information;
[0175] The color information of the pixel point is replaced by the brightness information to obtain the brightness information image.
[0176] In some exemplary embodiments, the volume light original area determination module 1320 is specifically configured to:
[0177] Determine the distance between the pixel point in the original image and the center information;
[0178] comparing the distance with the radius information;
[0179] The area composed of pixel points whose distance is less than or equal to the radius information is used as the original area of the volume light.
[0180] In some exemplary embodiments, the volume light information sampling generation module 1340 is specifically configured to:
[0181] The sampling position of the next sampling between two adjacent samplings is offset by a preset distance along the preset volume light direction compared to the sampling position of the previous sampling.
[0182] In some exemplary embodiments, the volume light information sampling generation module 1340 is specifically configured to:
[0183] The sampling results of the multiple samplings are superimposed and divided by the sampling times of the multiple samplings to obtain the volume light sampling result.
[0184] In some exemplary embodiments, the volume light sampling result application module 1350 is specifically configured to:
[0185] The volume light sampling result is multiplied by the preset volume light color and then mixed with the original image.
[0186] In some exemplary embodiments, the volume light generating device further includes a downsampling module (not shown in the figure), which is configured to:
[0187] Downsampling the volume light generation area image to obtain a downsampled volume light generation area image;
[0188] Then, the multiple sampling of the volume light generation area image includes:
[0189] The downsampled volume light generation area image is sampled multiple times.
[0190] In some exemplary embodiments, the volume light generation area image generation module 1330 is further configured to:
[0191] Determine a preset mask, and determine a mask area of the mask in the brightness information image;
[0192] Inverting the brightness information of the mask area to obtain an inverted mask area;
[0193] Processing the inverted mask area based on the brightness threshold to obtain a second volume light generation area;
[0194] Based on the second volume light generation area and the first volume light generation area, the volume light generation area image is obtained.
[0195] In some exemplary embodiments, the volume light generation area image generation module 1330 is further configured to:
[0196] Based on the mask, the second volume light generation area and the first volume light generation area are interpolated to obtain the volume light generation area image.
[0197] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0198] The device of the above embodiment is used to implement the corresponding volume light generation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0199] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the volume light generation method described in any of the above embodiments is implemented.
[0200] Fig.14 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1410, a memory 1420, an input / output interface 1430, a communication interface 1440, and a bus 1450. The processor 1410, the memory 1420, the input / output interface 1430, and the communication interface 1440 are connected to each other through the bus 1450 in the device.
[0201] The processor 1410 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0202] The memory 1420 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1420 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1420 and are called and executed by the processor 1410.
[0203] The input / output interface 1430 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0204] The communication interface 1440 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0205] The bus 1450 includes a path that transmits information between the various components of the device (eg, the processor 1410 , the memory 1420 , the input / output interface 1430 , and the communication interface 1440 ).
[0206] It should be noted that, although the above device only shows the processor 1410, the memory 1420, the input / output interface 1430, the communication interface 1440 and the bus 1450, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0207] The electronic device of the above embodiment is used to implement the corresponding volume light generation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0208] The memory 1420 stores machine-readable instructions executable by the processor 1410. When the electronic device is running, the processor 1410 communicates with the memory 1420 via the bus 1430, so that the processor 1410 executes the following instructions when running:
[0209] Determine an original image captured by a virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image;
[0210] Determine preset position information, and determine the original area of the volume light in the brightness information image based on the position information;
[0211] Determine a preset brightness threshold, take the area consisting of pixels whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area, and obtain a volume light generation area image;
[0212] Sampling the volume light generation area image multiple times, offsetting the sampling position during the multiple samplings, and obtaining a volume light sampling result;
[0213] The volume light sampling result is applied to the original image.
[0214] In a possible implementation, in the instructions executed by the processor 1410, extracting the brightness information of the original image, replacing the color information of the pixel points in the original image with the brightness information, and obtaining the brightness information image includes:
[0215] Determine color information of pixels in the original image;
[0216] Performing weighted summation on the color values of different channels in the color information with different weight parameters respectively to obtain the brightness information;
[0217] The color information of the pixel point is replaced by the brightness information to obtain the brightness information image.
[0218] In a possible implementation, in the instruction executed by the processor 1410, the position information includes center information and radius information, and the determining the preset position information and determining the original area of the volume light in the brightness information image based on the position information includes:
[0219] Determine the distance between the pixel point in the original image and the center information;
[0220] comparing the distance with the radius information;
[0221] The area composed of pixel points whose distance is less than or equal to the radius information is used as the original area of the volume light.
[0222] In a possible implementation manner, in the instructions executed by the processor 1410, the performing of multiple samplings on the volume light generation area image, and offsetting the sampling positions in the multiple samplings, include:
[0223] The sampling position of the next sampling between two adjacent samplings is offset by a preset distance along the preset volume light direction compared to the sampling position of the previous sampling.
[0224] In a possible implementation manner, in the instructions executed by the processor 1410, the sampling of the volume light generation area image multiple times, offsetting the sampling position in the multiple samplings, and obtaining the volume light sampling result includes:
[0225] The sampling results of the multiple samplings are superimposed and divided by the sampling times of the multiple samplings to obtain the volume light sampling result.
[0226] In a possible implementation manner, in the instruction executed by the processor 1410, applying the volume light sampling result to the original image includes:
[0227] The volume light sampling result is multiplied by the preset volume light color and then mixed with the original image.
[0228] In a possible implementation manner, in the instruction executed by the processor 1410, before the multiple sampling of the volume light generation area image, the method further includes:
[0229] Downsampling the volume light generation area image to obtain a downsampled volume light generation area image;
[0230] Then, the multiple sampling of the volume light generation area image includes:
[0231] The downsampled volume light generation area image is sampled multiple times.
[0232] In a possible implementation manner, in the instruction executed by the processor 1410, after taking the area consisting of pixels whose brightness information is greater than or equal to the brightness threshold as the first volume light generation area, the method further includes:
[0233] Determine a preset mask, and determine a mask area of the mask in the brightness information image;
[0234] Inverting the brightness information of the mask area to obtain an inverted mask area;
[0235] Processing the inverted mask area based on the brightness threshold to obtain a second volume light generation area;
[0236] Then, obtaining the volume light generation area image based on the first volume light generation area includes:
[0237] Based on the second volume light generation area and the first volume light generation area, the volume light generation area image is obtained.
[0238] In a possible implementation manner, in the instruction executed by the processor 1410, obtaining the volume light generation area image based on the second volume light generation area and the first volume light generation area includes:
[0239] Based on the mask, the second volume light generation area and the first volume light generation area are interpolated to obtain the volume light generation area image.
[0240] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the volume light generation method described in any of the above embodiments.
[0241] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0242] The above-mentioned non-transitory computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)), etc.
[0243] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the volume light generation method described in any embodiment in the above exemplary method part, and have the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0244] Based on the same inventive concept, corresponding to the volume light generation method described in any of the above embodiments, the present disclosure also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor executes the volume light generation method. Corresponding to the execution subject corresponding to each step in each embodiment of the volume light generation method, the processor that executes the corresponding step may belong to the corresponding execution subject.
[0245] The computer program product of the above embodiment is used to enable the computer and / or the processor to execute the volume light generation method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0246] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, method, or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." In addition, in some embodiments, the present disclosure may also be implemented in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.
[0247] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive examples) of computer-readable storage media may include, for example: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device.
[0248] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0249] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0250] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0251] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified in the boxes in the flowchart and / or block diagram.
[0252] These computer program instructions may also be stored in a computer-readable medium that enables a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable medium produce a product that includes an instruction device that implements the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0253] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable device to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0254] In addition, although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0255] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0256] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0257] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0258] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0259] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0260] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
[0261] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims. The scope of the attached claims conforms to the broadest interpretation, thereby including all such modifications and equivalent structures and functions.
Claims
1. A volume light generation method, characterized in that: include: Determine an original image captured by a virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image; Determine preset position information, and determine the original area of the volume light in the brightness information image based on the position information; Determine a preset brightness threshold, take the area consisting of pixels whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area, and obtain a volume light generation area image; Sampling the volume light generation area image multiple times, offsetting the sampling position during the multiple samplings, and obtaining a volume light sampling result; The volume light sampling result is applied to the original image.
2. The method according to claim 1, characterized in that The step of extracting the brightness information of the original image and replacing the color information of the pixels in the original image with the brightness information to obtain a brightness information image includes: Determine color information of pixels in the original image; Performing weighted summation on the color values of different channels in the color information with different weight parameters respectively to obtain the brightness information; The color information of the pixel point is replaced by the brightness information to obtain the brightness information image.
3. The method according to claim 1, characterized in that The position information includes center information and radius information, and the step of determining the preset position information and determining the original area of the volume light in the brightness information image based on the position information includes: Determine the distance between the pixel point in the original image and the center information; comparing the distance with the radius information; The area composed of pixel points whose distance is less than or equal to the radius information is used as the original area of the volume light.
4. The method according to claim 1, characterized in that The step of sampling the volume light generation area image multiple times and offsetting the sampling positions during the multiple samplings includes: The sampling position of the next sampling between two adjacent samplings is offset by a preset distance along the preset volume light direction compared to the sampling position of the previous sampling.
5. The method according to claim 1, characterized in that The step of sampling the volume light generation area image multiple times, offsetting the sampling positions during the multiple samplings, and obtaining the volume light sampling results includes: The sampling results of the multiple samplings are superimposed and divided by the sampling times of the multiple samplings to obtain the volume light sampling result.
6. The method according to claim 1, characterized in that The applying the volume light sampling result to the original image comprises: The volume light sampling result is multiplied by the preset volume light color and then mixed with the original image.
7. The method according to claim 1, characterized in that Before the volume light generation area image is sampled multiple times, the method further includes: Downsampling the volume light generation area image to obtain a downsampled volume light generation area image; Then, the multiple sampling of the volume light generation area image includes: The downsampled volume light generation area image is sampled multiple times.
8. The method according to claim 4, characterized in that After taking the area composed of pixels whose brightness information is greater than or equal to the brightness threshold as the first volume light generation area, the method further includes: Determine a preset mask, and determine a mask area of the mask in the brightness information image; Inverting the brightness information of the mask area to obtain an inverted mask area; Processing the inverted mask area based on the brightness threshold to obtain a second volume light generation area; Then, obtaining the volume light generation area image based on the first volume light generation area includes: Based on the second volume light generation area and the first volume light generation area, the volume light generation area image is obtained.
9. The method according to claim 8, characterized in that The obtaining the volume light generation area image based on the second volume light generation area and the first volume light generation area includes: Based on the mask, the second volume light generation area and the first volume light generation area are interpolated to obtain the volume light generation area image.
10. A volume light generating device, characterized in that: include: A brightness information extraction module is configured to determine an original image captured by a virtual camera, extract brightness information of the original image, replace color information of pixels in the original image with the brightness information, and obtain a brightness information image; A volume light original area determination module is configured to determine preset position information, and based on the position information, determine the volume light original area in the brightness information image; The volume light generation area image generation module is configured to determine a preset brightness threshold, take the area composed of pixel points whose brightness information is greater than or equal to the brightness threshold in the volume light original area as the first volume light generation area, and obtain the volume light generation area image; A volume light information sampling and generating module is configured to perform multiple sampling on the volume light generating area image, offset the sampling position during the multiple samplings, and obtain a volume light sampling result; The volume light sampling result application module is configured to apply the volume light sampling result to the original image.
11. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
12. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The method comprises computer program instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 9.