Virtual special effect generation method and device, program product and electronic equipment
By obtaining the pixel values of the target star point map and noise map, and using phase mapping and periodic flicker control functions, the problems of poor performance of star point flicker effect and large resource consumption are solved, and high-quality dynamic flicker effect and low resource consumption are achieved.
Patent Information
- Application Number
- CN202510664112.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, the performance effect of the star point flicker effect is poor and the computing resource consumption is large. Especially in game scenes, film and television animations and user interface design, when the interleaving effect is achieved by interleaving two texture maps with different characteristics, there is a complex texture transformation process.
By obtaining the pixel values of the target star dot map and the noise map, using phase mapping processing and periodic flicker control functions, the phase data of each pixel in the noise map is determined, and the light and darkness degree of the target star dot map is controlled based on this to achieve a dynamic flicker effect.
It achieves high-quality visual performance, while reducing the consumption of computing resources, simplifying the texture change process, and improving the control fineness.
Smart Images

Figure CN120543705A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a virtual special effect generation method, a virtual special effect generation device, a computer program product, and an electronic device. Background Art
[0002] In gaming, film and television animation, and user interface design, various virtual special effects are required to meet diverse user needs. Among them, twinkling stars are a common virtual special effect used to create visual atmospheres such as vast starry skies and magical light effects.
[0003] In related technologies, two texture maps with different characteristics are interwoven with each other in a dynamic manner with reverse flow, thereby presenting a staggered and flickering visual effect on the screen. Not only is the performance effect poor, but it also requires complex texture transformation processing and consumes a lot of computing resources.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0005] The present disclosure provides a virtual special effect generation method, a virtual special effect generation device, a computer program product, and an electronic device, which can at least to some extent solve the problems of poor flickering performance and high resource consumption in related technologies.
[0006] According to a first aspect of the present disclosure, a method for generating virtual special effects is provided, the method comprising: obtaining a target star point map to be rendered and a target noise map for controlling the brightness and darkness of each pixel in the target star point map, and extracting pixel values corresponding to each pixel in the target noise map; performing phase mapping processing based on the pixel values corresponding to each pixel in the target noise map and a current rendering moment to determine phase data corresponding to each pixel in the target noise map on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function; based on the preset flicker control function, mapping the phase data corresponding to each pixel in the target noise map on the preset flicker control function to brightness and darkness control information; and rendering the target star point map based on the brightness and darkness control information corresponding to each pixel in the target noise map at the current rendering moment to obtain a target star point flickering effect.
[0007] According to a second aspect of the present disclosure, a virtual special effect generation device is provided, the device comprising: a pixel value extraction module for acquiring a target star point image to be rendered and a target noise image for controlling the brightness and darkness of each pixel in the target star point image, and extracting the pixel value corresponding to each pixel in the target noise image; a phase data determination module for performing phase mapping processing based on the pixel value corresponding to each pixel in the target noise image and a current rendering moment, so as to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function; a control information determination module for mapping the phase data corresponding to each pixel in the target noise image on the preset flicker control function to brightness and darkness control information based on the preset flicker control function; and a star point image rendering module for rendering the target star point image based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering moment, so as to obtain a target star point flickering effect.
[0008] According to a third aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method for generating virtual special effects according to the first aspect and possible implementation thereof are implemented.
[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the virtual special effects generation method and its possible implementation method of the above-mentioned first aspect by executing the executable instructions.
[0010] The technical solution disclosed in this disclosure has the following beneficial effects:
[0011] During the above-mentioned virtual special effects generation process, a target star point image to be rendered and a target noise image used to control the brightness and darkness of each pixel in the target star point image are obtained, and the pixel value corresponding to each pixel in the target noise image is extracted; based on the pixel value corresponding to each pixel in the target noise image and the current rendering time, phase mapping processing is performed to determine the phase data corresponding to each pixel in the target noise image on the preset flicker control function; wherein the preset flicker control function is a periodic waveform function; based on the preset flicker control function, the phase data corresponding to each pixel in the target noise image on the preset flicker control function is mapped to brightness and darkness control information; based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering time, the target star point image is rendered to obtain a target star point flickering effect. The present disclosure performs phase mapping processing through the pixel values corresponding to each pixel point in the noise image and the current rendering moment, determines the phase data corresponding to each pixel point in the noise image on the preset flicker control function, and controls the star point image to dynamically flicker based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function. Not only is the control precision high and high-quality visual performance effects can be achieved, but also no complex texture changes are required, the implementation method is simple, and the consumption of computing resources is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A flowchart of a method for generating virtual special effects in this exemplary embodiment is shown;
[0013] Figure 2 A schematic diagram showing a display of a star point diagram in this exemplary embodiment is shown;
[0014] Figure 3A A schematic diagram showing a noise map before distribution state adjustment in this exemplary embodiment is shown;
[0015] Figure 3B A schematic diagram showing a noise graph after distribution state adjustment in this exemplary embodiment is shown;
[0016] Figure 4A A schematic diagram showing a preset flicker control function in this exemplary embodiment;
[0017] Figure 4B A schematic diagram showing a flicker control function after shifting in this exemplary embodiment;
[0018] Figure 5 A schematic diagram of a process for generating a dynamic flickering hemp effect in this exemplary embodiment is shown;
[0019] Figure 6A A schematic diagram showing a dynamic flickering hemp effect in this exemplary embodiment;
[0020] Figure 6B A schematic diagram showing another dynamic flickering hemp effect in this exemplary embodiment;
[0021] Figure 7 A structural block diagram of a virtual special effect generating device according to this exemplary embodiment is shown;
[0022] Figure 8 An electronic device for implementing the above-mentioned virtual special effect generating method in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0023] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
[0024] The accompanying drawings are schematic illustrations of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the description below, many specific details are provided to provide a full description of the embodiments of the present disclosure. However, those skilled in the art will appreciate that one or more specific details may be omitted when implementing the technical solution of the present disclosure, or that other methods, components, devices, steps, etc. may be used to replace one or more specific details.
[0025] In the related art, two texture maps with different characteristics are interwoven with each other in a dynamic manner with reverse flow, thereby presenting a staggered and flickering visual effect in the picture. The performance is poor, and complex texture transformation is required, which consumes a lot of computing resources.
[0026] In view of one or more of the above problems, exemplary embodiments of the present disclosure provide a virtual special effect generation method, a virtual special effect generation device, a computer program product, and an electronic device.
[0027] In an optional embodiment, referring to Figure 1 As shown, a flowchart of a method for generating virtual special effects is provided, which specifically includes the following steps S110 to S140:
[0028] Step S110, obtaining a target star point image to be rendered and a target noise image for controlling the brightness of each pixel in the target star point image, and extracting a pixel value corresponding to each pixel in the target noise image;
[0029] Step S120: performing phase mapping processing based on the pixel values corresponding to each pixel in the target noise image and the current rendering time to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function;
[0030] Step S130 , mapping the phase data corresponding to each pixel in the target noise image on the preset flicker control function into brightness control information based on the preset flicker control function;
[0031] Step S140 , rendering the target star point image based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment, to obtain a target star point flickering effect.
[0032] Figure 1 In the method shown, phase mapping processing is performed through the pixel values corresponding to each pixel point in the noise image and the current rendering moment to determine the phase data corresponding to each pixel point in the noise image on the preset flicker control function, and based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, the star point image is controlled to dynamically flicker. Not only is the control fineness high and high-quality visual performance effects can be achieved, but also no complex texture changes are required, the implementation method is simple, and the consumption of computing resources is low.
[0033] In step S110 , a target star point image to be rendered and a target noise image for controlling the brightness of each pixel in the target star point image are obtained, and a pixel value corresponding to each pixel in the target noise image is extracted.
[0034] Among them, the target star point map is a map with certain texture characteristics formed by a series of discrete point elements, which is used to simulate scintillation particles, such as Figure 2 shown.
[0035] In an optional embodiment, the target star point map to be rendered can be obtained by the following steps: obtaining an initial star point map, and controlling the texture offset of the initial star point map based on the time change of the current rendering moment relative to the initial rendering moment to obtain the target star point map.
[0036] The initial star point map may be a star point map without texture offset at the initial rendering time, which may be obtained locally, and the target star point map may be a star point map after texture offset processing is performed on the initial star point map at the current rendering time.
[0037] By shifting the texture coordinates of each point in the star point map over time, we can simulate the effect of the star point texture flowing over time and achieve a dynamic flowing and flickering effect.
[0038] Among them, the noise map is usually composed of a series of pixels, and the pixel value of each pixel is generated according to a certain random algorithm, presenting a visual effect of alternating light and dark.
[0039] The noise map may be a noise map built into the Unreal Engine, or a noise map that is regenerated or stored locally, and this disclosure does not specifically limit this.
[0040] Optionally, since the noise map generation logic mostly obeys the normal distribution, large areas of alternating light and dark may appear, resulting in uneven flickering. Therefore, a noise map with a relatively uniform light and dark distribution can be selected as the target noise map.
[0041] For example, if the acquired noise image has uneven light and dark distribution, the distribution state can be adjusted to obtain a target noise image with relatively uniform light and dark distribution. For example, a curve adjustment method can be used to adjust the light and dark distribution state of the noise image, which is not specifically limited in this disclosure. Figure 3A and Figure 3B As shown, Figure 3A A schematic diagram of the noise map before the distribution state adjustment is provided. Figure 3B A schematic diagram of displaying a noise graph after distribution state adjustment is provided. Compared with the noise graph before the adjustment, the light and dark distribution of the noise graph after the distribution state adjustment is more uniform.
[0042] It's important to note that normal noise images are automatically recognized as sRGB images by the current Unreal Engine, which automatically performs gamma correction, altering the originally uniform state. Therefore, you can disable sRGB image recognition in the current Unreal Engine to prevent the distribution adjustment from failing. sRGB images refer to images that use the sRGB (standard red, green, and blue) color space. Gamma correction is a technique that adjusts brightness by adjusting the power function of the image's pixel values.
[0043] In an optional embodiment, obtaining a target noise map for controlling the brightness and darkness of each pixel in the target star point map can be achieved by the following steps: obtaining an initial noise map, and controlling the texture of the initial noise map to offset based on the time change of the current rendering moment relative to the initial rendering moment, to obtain a target noise map for controlling the brightness and darkness of each pixel in the target star point map.
[0044] The initial noise map may be a noise map built into the Unreal Engine, a noise map that is regenerated or stored locally, or a noise map whose distribution state has been adjusted. This disclosure does not specifically limit this.
[0045] The target noise map may be a noise map obtained by performing texture offset processing on the initial noise map at the current rendering moment.
[0046] By shifting the texture coordinates of each point in the initial noise map over time, we can simulate the effect of the noise texture flowing over time, thereby improving the richness of the flickering performance.
[0047] In step S120, phase mapping processing is performed based on the pixel values corresponding to each pixel point in the target noise image and the current rendering time to determine the phase data corresponding to each pixel point in the target noise image on the preset flicker control function; wherein the preset flicker control function is a periodic waveform function.
[0048] The preset flicker control function may be a periodic waveform function whose function value is within a specific interval, and whose function value has a maximum value and a minimum value. Figure 4A It should be noted that in actual application, other types of flicker control functions, such as cosine function, etc., can also be selected, and this disclosure does not specifically limit this.
[0049] The specific area range may be, for example, [0, 1] or [-1, 1], etc. This range is related to the selected preset flicker control function, and the present disclosure does not specifically limit this.
[0050] In an optional embodiment, the above-mentioned phase mapping processing is performed based on the pixel value corresponding to each pixel point in the target noise map and the current rendering moment to determine the phase data corresponding to each pixel point in the target noise map on the preset flicker control function. It can be achieved by the following steps: determining the phase offset control parameter of the preset flicker control function over time based on the time change of the current rendering moment relative to the initial rendering moment and the preset offset speed control parameter; determining the phase data corresponding to each pixel point in the target noise map on the preset flicker control function based on the pixel value corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time.
[0051] Among them, the preset offset speed control parameter can be used to control the speed at which the overall phase of the preset flicker control function shifts over time. The larger the configuration value, the faster the offset speed. It can be specifically configured by the developer based on experience, such as 0.25. This disclosure does not make specific limitations on this.
[0052] The time-dependent phase offset control parameter of the preset flicker control function may be used to control the time-dependent phase offset of the entire preset flicker control function.
[0053] By associating the noise image with a preset flicker control function and controlling the phase shift of the preset flicker control function over time, the same pixel point in the noise image can control the target star point image to produce different brightness and darkness control effects at different times, thereby achieving a flicker effect.
[0054] In an optional embodiment, the above-mentioned determination of the phase data corresponding to each pixel point in the target noise map on the preset flicker control function based on the pixel value corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time can be achieved by the following steps: summing the pixel value corresponding to each pixel point in the target noise map with the phase offset control parameter of the preset flicker control function over time to obtain the summation result corresponding to each pixel point in the target noise map; determining the phase data of each pixel point in the target noise map on the preset flicker control function based on the summation result corresponding to each pixel point in the target noise map and the period information of the preset flicker control function.
[0055] Exemplarily, the summation results corresponding to each pixel in the target noise image may be multiplied by the period (eg, 2π) of the preset flicker control function to obtain the phase data of each pixel in the target noise image on the preset flicker control function.
[0056] Taking the preset flicker control function as the sin function as an example, since the native sin function node of the Unreal Engine will automatically multiply the input value by 2π, in actual application, the sin function node of the Unreal Engine can be directly called, and the summation results corresponding to each pixel point in each target noise map can be directly input into the sin function node to obtain the phase data of each pixel point in the target noise map for the preset flicker control function.
[0057] Optionally, since the preset flicker control function is periodic, for ease of calculation, the decimal part of the summation result (i.e., the integer part is subtracted) can be taken and multiplied by the period of the preset flicker control function to map the summation result to the first period interval to obtain the phase data of each pixel point in the target noise image on the preset flicker control function.
[0058] In an optional embodiment, the above-mentioned determination of the phase data corresponding to each pixel point in the target noise map on the preset flicker control function based on the pixel value corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time can also be achieved by the following steps: determining the phase offset of the preset flicker control function over time based on the phase offset control parameter of the preset flicker control function over time and the period of the preset flicker control function, and on the basis of the phase offset, matching and mapping the pixel values corresponding to each pixel point in the target noise map based on the mapping relationship between the pixel value interval and the first period interval of the preset flicker control function to obtain the phase data of each pixel point in the target noise map on the preset flicker control function.
[0059] For example, when the period of the preset flicker control function is 2π, the product of the temporal phase offset control parameter of the preset flicker control function and 2π may be used as the temporal phase offset of the preset flicker control function.
[0060] Exemplarily, a mapping relationship can be established between the pixel value interval corresponding to the target noise image and the first period interval of the preset flicker control function. Taking the pixel value interval as [0,1] and the first period interval of the preset flicker control function as [0,2π] as an example, a mapping relationship can be established between the [0,1] interval and the [0,2π] interval. For example, the endpoint 0 of the [0,1] interval (i.e., pure black state) is mapped to the position of the endpoint 0 of the [0,2π] interval, and the endpoint 1 of the [0,1] interval (i.e., pure white state) is mapped to the position of the endpoint 2π of the [0,2π] interval. In actual application, when the period of the preset flicker control function is 2π, in order to facilitate processing, the pixel value can be directly multiplied by 2π to achieve matching mapping.
[0061] For example, Figure 4B As shown, a schematic diagram of the flicker control function after the shift is provided. Figure 4A , the sin(x) function shifts to the right by 0.5π units as a whole over time. When the pixel value corresponding to a certain pixel point in the target noise image is 1, the value of 1×2π-0.5π can be used as the phase data of the corresponding pixel point on the preset flicker control function.
[0062] By utilizing the periodicity of the preset flicker control function to control the brightness and darkness of the target star point image, not only can the flicker effect be achieved, but also no complicated noise texture adjustment is required, and the operation is simple and easy to implement.
[0063] In step S130 , based on a preset flicker control function, the phase data corresponding to each pixel in the target noise image on the preset flicker control function is mapped into brightness control information.
[0064] Among them, the phase data and function values on the preset flicker control function have a corresponding relationship. Based on the preset flicker control function, each phase data can be matched and mapped with the function value to obtain the brightness and darkness control information matching each phase data.
[0065] In an optional embodiment, the above-mentioned mapping of the phase data corresponding to each pixel point in the target noise image on the preset flicker control function to brightness and darkness control information based on the preset flicker control function can be achieved by the following steps: based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, performing calculation processing on the preset flicker control function to obtain the function calculation results corresponding to each pixel point in the target noise image; based on the function calculation results corresponding to each pixel point in the target noise image, determining the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment.
[0066] Taking the preset flicker control function as the sin(x) function as an example, when the time variation is 0, that is, the sin(x) function does not shift over time, when the phase data is 0, the output function calculation result is 0; when the phase data is 0.5π, the output function calculation result is 1.
[0067] Optionally, if the function value of the preset flicker control function for each pixel point in the target noise map exceeds the preset interval range, the function value of the preset flicker control function for each pixel point in the target noise map can be mapped to the preset interval range to obtain the brightness and darkness control parameters corresponding to each pixel point in the target noise map at the current rendering moment, where the preset interval range can be, for example, [0,1] or [-1,1].
[0068] Optionally, if the function calculation results of each pixel point in the target noise map are negative, the absolute value of the function calculation results of each pixel point in the target noise map can be taken to obtain the brightness and darkness control parameters corresponding to each pixel point in the target noise map at the current rendering moment, so that the star point will be bright for a longer time.
[0069] Optionally, if the function calculation results of each pixel in the target noise map are negative, the negative function values can be regarded as 0 to obtain the brightness and darkness control parameters corresponding to each pixel in the target noise map at the current rendering moment, so that the star points will be lit for a shorter time.
[0070] By performing different processing on the function calculation results, different flickering effects can be achieved, with strong controllability and flexibility.
[0071] The brightness control information is used to control the brightness of the target star point image pixels. For example, if the function calculation result corresponding to a pixel in the target noise image is 0 or negative, the brightness control parameter corresponding to the corresponding pixel can be set to 0%, that is, it is controlled not to be displayed; if the function calculation result corresponding to a pixel in the target noise image is 1, the brightness control parameter corresponding to the corresponding pixel can be set to 100%, that is, it is controlled to be fully displayed.
[0072] In step S140 , the target star point image is rendered based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering moment to obtain a target star point flickering effect.
[0073] Based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering moment, targeted brightness and darkness control of each pixel in the target star point image can be achieved with a high degree of refinement.
[0074] In an optional embodiment, the above-mentioned rendering of the target star point map based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment to obtain the target star point flickering effect can be achieved through the following steps: forming a virtual mask based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment; superimposing the virtual mask on the target star point map, and then rendering the target star point map to obtain the target star point flickering effect.
[0075] Specifically, a virtual mask can be constructed based on the shading information corresponding to each pixel in the target noise image at the current rendering moment. This information can be used to control the transparency of each pixel in the mask layer. By overlaying a mask layer on the target star image and then controlling the transparency of each pixel in the mask layer, the target star image can be dynamically flickering.
[0076] For example, Figure 5 As shown, a schematic diagram of a process for generating a dynamic flickering hemp effect is provided, which may specifically include the following steps:
[0077] Step S501: obtaining an initial noise map, controlling the texture of the initial noise map to shift based on the time variation of the current rendering time relative to the initial rendering time, obtaining a target noise map for controlling the brightness of each pixel in the target star point map, and extracting the pixel value corresponding to each pixel in the target noise map;
[0078] Step S502, determining a phase offset control parameter of a preset flicker control function over time according to a time variation of a previous rendering moment relative to an initial rendering moment and a preset offset speed control parameter;
[0079] Step S503, determining the phase data corresponding to each pixel point in the target noise image on the preset flicker control function according to the pixel value corresponding to each pixel point in the target noise image and the phase offset control parameter of the preset flicker control function over time;
[0080] Step S504, performing calculation processing on the preset flicker control function based on the phase data of each pixel point in the target noise image on the preset flicker control function, to obtain the function calculation result corresponding to each pixel point in the target noise image;
[0081] Step S505 , determining the brightness and shading control information corresponding to each pixel in the target noise image at the current rendering moment based on the function calculation result corresponding to each pixel in the target noise image;
[0082] Step S506, obtaining an initial star point map, and controlling the texture of the initial star point map to shift based on the time change between the current rendering time and the initial rendering time, to obtain a target star point map to be rendered;
[0083] Step S507 , rendering the target star point image based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment, to obtain a target star point flickering effect.
[0084] Figure 5 In the steps shown, the textures of the noise map and the star point map are controlled to shift over time, and based on the pixel values corresponding to each pixel point in the noise map and the current rendering moment, the phase data corresponding to each pixel point in the noise map on the preset flicker control function is determined, so that the phase data corresponding to each pixel point in the noise map on the preset flicker control function changes periodically over time, thereby controlling the flicker period of the star point map to achieve a low-cost and high-quality streaming flicker effect.
[0085] For example, Figure 6A and Figure 6B As shown, a schematic diagram of the dynamic flickering flow effect at different moments is provided, and pure black (ie, brightness value 0, no display) or pure white (ie, brightness value 1, full display) can be the beginning or end of a flickering cycle.
[0086] The exemplary embodiment of the present disclosure further provides a virtual special effect generating device, referring to Figure 7 As shown, the virtual special effect generating device 700 may include the following program modules:
[0087] A pixel value extraction module 710 is used to obtain a target star point image to be rendered and a target noise image for controlling the brightness of each pixel in the target star point image, and to extract a pixel value corresponding to each pixel in the target noise image;
[0088] Phase data determination module 720 is configured to perform phase mapping processing based on the pixel values corresponding to each pixel in the target noise image and the current rendering time to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function;
[0089] A control information determination module 730 is configured to map the phase data corresponding to each pixel in the target noise image on the preset flicker control function into brightness control information based on the preset flicker control function;
[0090] The star point image rendering module 740 is used to render the target star point image based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment to obtain a target star point twinkling effect.
[0091] In an optional embodiment, based on the aforementioned solution, the pixel value extraction module 710 further includes a noise map acquisition module configured to acquire a target noise map for controlling the brightness of each pixel in the target star point image. The noise map acquisition module may be configured to acquire an initial noise map and, based on a temporal change between the current rendering time and the initial rendering time, control a texture offset of the initial noise map to obtain a target noise map for controlling the brightness of each pixel in the target star point image.
[0092] In an optional embodiment, based on the aforementioned scheme, the phase data determination module 720 includes: an offset parameter control module, which is used to determine the phase offset control parameter of the preset flicker control function over time based on the time change of the current rendering moment relative to the initial rendering moment and the preset offset speed control parameter; a phase mapping processing module, which is used to determine the phase data corresponding to each pixel point in the target noise image on the preset flicker control function based on the pixel value corresponding to each pixel point in the target noise image and the phase offset control parameter of the preset flicker control function over time.
[0093] In an optional embodiment, based on the aforementioned scheme, the phase mapping processing module can be configured as follows: summing the pixel values corresponding to each pixel point in the target noise image with the phase offset control parameters of the preset flicker control function over time to obtain the summation results corresponding to each pixel point in the target noise image; based on the summation results corresponding to each pixel point in the target noise image and the periodic information of the preset flicker control function, determining the phase data of each pixel point in the target noise image on the preset flicker control function.
[0094] In an optional embodiment, based on the aforementioned solution, the pixel value extraction module 710 further includes a star image acquisition module for acquiring a target star image to be rendered. The star image acquisition module can be configured to acquire an initial star image and, based on the temporal change between the current rendering time and the initial rendering time, control the temporal shift of the texture of the initial star image to obtain the target star image to be rendered.
[0095] In an optional embodiment, based on the aforementioned scheme, the control information determination module 730 can be configured as follows: based on the phase data corresponding to each pixel point in the target noise map on the preset flicker control function, perform preset flicker control function calculation processing to obtain the function calculation results corresponding to each pixel point in the target noise map; based on the function calculation results corresponding to each pixel point in the target noise map, determine the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment.
[0096] In an optional embodiment, based on the aforementioned scheme, the star point map rendering module 740 can be configured as follows: forming a virtual mask based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment; after superimposing the virtual mask on the target star point map, rendering the target star point map to obtain a target star point flickering effect.
[0097] The specific details of each part of the above-mentioned device have been described in detail in the implementation method part. The undisclosed details can be found in the implementation method part, so they will not be repeated here.
[0098] The exemplary embodiments of the present disclosure further provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, implements the above-mentioned virtual special effect generation method.
[0099] In one embodiment, a computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The computer-readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk drive (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing the computer program, such as a read-only memory, NAND flash memory, and the like.
[0100] In one embodiment, the computer program product may be an intangible product containing a computer program. For example, the computer program product may be implemented as a virtual digital product, such as a digital file such as an executable file or installation package storing the computer program.
[0101] The code of the computer program can be written in one or more programming languages. Programming languages include C, Java, C++, etc. The program code can be executed entirely on the user computing device, partially on the user computing device, or as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device via any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., via an Internet connection provided by a carrier).
[0102] Computer programs can be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. Electronic devices can convert signals carrying computer programs into digital signals, thereby running the computer programs. When a computer program is run on an electronic device, its code is used to cause the electronic device to execute (more specifically, to cause the processor of the electronic device to execute) the method steps of various exemplary embodiments of the present disclosure. For example, the following steps may be included:
[0103] Obtain a target star point image to be rendered and a target noise image used to control the brightness of each pixel in the target star point image, and extract the pixel value corresponding to each pixel in the target noise image;
[0104] Performing phase mapping based on the pixel values corresponding to each pixel in the target noise image and the current rendering time to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function;
[0105] Based on a preset flicker control function, the phase data corresponding to each pixel point in the target noise image on the preset flicker control function is mapped into brightness control information;
[0106] Based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering moment, the target star point image is rendered to obtain the target star point flickering effect.
[0107] In an optional embodiment, based on the aforementioned scheme, the above-mentioned acquisition of the target noise map for controlling the brightness and darkness of each pixel in the target star point map can be achieved by the following steps: obtaining an initial noise map, and controlling the texture of the initial noise map to offset based on the time change of the current rendering moment relative to the initial rendering moment, to obtain a target noise map for controlling the brightness and darkness of each pixel in the target star point map.
[0108] In an optional embodiment, based on the aforementioned scheme, the above-mentioned phase mapping processing is performed based on the pixel values corresponding to each pixel point in the target noise map and the current rendering moment to determine the phase data corresponding to each pixel point in the target noise map on the preset flicker control function. This can be achieved by the following steps: determining the phase offset control parameter of the preset flicker control function over time based on the time change of the current rendering moment relative to the initial rendering moment and the preset offset speed control parameter; determining the phase data corresponding to each pixel point in the target noise map on the preset flicker control function based on the pixel values corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time.
[0109] In an optional embodiment, based on the aforementioned scheme, the above-mentioned determination of the phase data corresponding to each pixel point in the target noise map on the preset flicker control function according to the pixel value corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time can be achieved by the following steps: summing the pixel value corresponding to each pixel point in the target noise map with the phase offset control parameter of the preset flicker control function over time to obtain the summation result corresponding to each pixel point in the target noise map; determining the phase data of each pixel point in the target noise map on the preset flicker control function based on the summation result corresponding to each pixel point in the target noise map and the period information of the preset flicker control function.
[0110] In an optional embodiment, based on the aforementioned scheme, the above-mentioned acquisition of the target star point map to be rendered can be achieved by the following steps: obtaining an initial star point map, and controlling the texture offset of the initial star point map based on the time change of the current rendering moment relative to the initial rendering moment to obtain the target star point map to be rendered.
[0111] In an optional embodiment, based on the aforementioned scheme, the above-mentioned preset flicker control function is based on which the phase data corresponding to each pixel point in the target noise image on the preset flicker control function is mapped to brightness and darkness control information, which can be achieved by the following steps: based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, the preset flicker control function is calculated and processed to obtain the function calculation results corresponding to each pixel point in the target noise image; based on the function calculation results corresponding to each pixel point in the target noise image, the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment is determined.
[0112] In an optional embodiment, based on the aforementioned scheme, the target star point map is rendered based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment to obtain the target star point flickering effect, which can be achieved through the following steps: based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment, a virtual mask is formed; after superimposing the virtual mask on the target star point map, the target star point map is rendered to obtain the target star point flickering effect.
[0113] In the above steps, phase mapping processing is performed through the pixel values corresponding to each pixel point in the noise image and the current rendering moment to determine the phase data corresponding to each pixel point in the noise image on the preset flicker control function, and based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, the star point image is controlled to dynamically flicker. Not only is the control fineness high and high-quality visual performance effects can be achieved, but also there is no need for complex texture changes, the implementation method is simple, and the computing resource consumption is low.
[0114] The exemplary embodiments of the present disclosure also provide an electronic device capable of implementing the aforementioned virtual special effects generation method. The electronic device may include a processor and a memory. The memory stores executable instructions for the processor, such as program code. The processor executes the executable instructions to perform the method of this exemplary embodiment. The electronic device may also include a display for displaying a graphical user interface.
[0115] Reference below Figure 8 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Figure 8 The electronic device 800 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0116] like Figure 8 As shown, the electronic device 800 may include a processor 810 , a memory 820 , a bus 830 , an I / O (input / output) interface 840 , a network adapter 850 , and a display 860 .
[0117] The memory 820 may include volatile memory, such as RAM 821 and cache unit 822, and may also include non-volatile memory, such as ROM 823. The memory 820 may also include one or more program modules 824. Such program modules 824 include, but are 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. For example, the program modules 824 may include the modules in the aforementioned devices.
[0118] The processor 810 may include one or more processing units, for example: the processor 810 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.
[0119] The processor 810 may be configured to execute executable instructions stored in the memory 820 , such as executing any one or more method steps in this exemplary embodiment.
[0120] Exemplarily, the processor 810 may perform the following steps:
[0121] Obtain a target star point image to be rendered and a target noise image used to control the brightness of each pixel in the target star point image, and extract the pixel value corresponding to each pixel in the target noise image;
[0122] Performing phase mapping based on the pixel values corresponding to each pixel in the target noise image and the current rendering time to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function;
[0123] Based on a preset flicker control function, the phase data corresponding to each pixel point in the target noise image on the preset flicker control function is mapped into brightness control information;
[0124] Based on the brightness and darkness control information corresponding to each pixel in the target noise image at the current rendering moment, the target star point image is rendered to obtain the target star point flickering effect.
[0125] In an optional embodiment, based on the aforementioned scheme, the above-mentioned acquisition of the target noise map for controlling the brightness and darkness of each pixel in the target star point map can be achieved by the following steps: obtaining an initial noise map, and controlling the texture of the initial noise map to offset based on the time change of the current rendering moment relative to the initial rendering moment, to obtain a target noise map for controlling the brightness and darkness of each pixel in the target star point map.
[0126] In an optional embodiment, based on the aforementioned scheme, the above-mentioned phase mapping processing is performed based on the pixel values corresponding to each pixel point in the target noise map and the current rendering moment to determine the phase data corresponding to each pixel point in the target noise map on the preset flicker control function. This can be achieved by the following steps: determining the phase offset control parameter of the preset flicker control function over time based on the time change of the current rendering moment relative to the initial rendering moment and the preset offset speed control parameter; determining the phase data corresponding to each pixel point in the target noise map on the preset flicker control function based on the pixel values corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time.
[0127] In an optional embodiment, based on the aforementioned scheme, the above-mentioned determination of the phase data corresponding to each pixel point in the target noise map on the preset flicker control function according to the pixel value corresponding to each pixel point in the target noise map and the phase offset control parameter of the preset flicker control function over time can be achieved by the following steps: summing the pixel value corresponding to each pixel point in the target noise map with the phase offset control parameter of the preset flicker control function over time to obtain the summation result corresponding to each pixel point in the target noise map; determining the phase data of each pixel point in the target noise map on the preset flicker control function based on the summation result corresponding to each pixel point in the target noise map and the period information of the preset flicker control function.
[0128] In an optional embodiment, based on the aforementioned scheme, the above-mentioned acquisition of the target star point map to be rendered can be achieved by the following steps: obtaining an initial star point map, and controlling the texture offset of the initial star point map based on the time change of the current rendering moment relative to the initial rendering moment to obtain the target star point map to be rendered.
[0129] In an optional embodiment, based on the aforementioned scheme, the above-mentioned preset flicker control function is based on which the phase data corresponding to each pixel point in the target noise image on the preset flicker control function is mapped to brightness and darkness control information, which can be achieved by the following steps: based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, the preset flicker control function is calculated and processed to obtain the function calculation results corresponding to each pixel point in the target noise image; based on the function calculation results corresponding to each pixel point in the target noise image, the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment is determined.
[0130] In an optional embodiment, based on the aforementioned scheme, the target star point map is rendered based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment to obtain the target star point flickering effect, which can be achieved through the following steps: based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment, a virtual mask is formed; after superimposing the virtual mask on the target star point map, the target star point map is rendered to obtain the target star point flickering effect.
[0131] In the above steps, phase mapping processing is performed through the pixel values corresponding to each pixel point in the noise image and the current rendering moment to determine the phase data corresponding to each pixel point in the noise image on the preset flicker control function, and based on the phase data corresponding to each pixel point in the target noise image on the preset flicker control function, the star point image is controlled to dynamically flicker. Not only is the control fineness high and high-quality visual performance effects can be achieved, but also there is no need for complex texture changes, the implementation method is simple, and the computing resource consumption is low.
[0132] The bus 830 is used to realize the connection between different components of the electronic device 800 and may include a data bus, an address bus, and a control bus.
[0133] The electronic device 800 can communicate with one or more external devices 900 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 840 .
[0134] The electronic device 800 can communicate with one or more networks via the network adapter 850. For example, the network adapter 850 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication. The network adapter 850 can communicate with other modules of the electronic device 800 via the bus 830.
[0135] The electronic device 800 may display a graphical user interface, etc., through the display 860 .
[0136] although Figure 8 Not shown, other hardware and / or software modules may also be provided in the electronic device 800, including but not limited to: a display, a microcode, a device driver, a redundant processor, an external disk drive array, a RAID (Redundant Arrays of Independent Disks) system, a tape drive, and a data backup storage system.
[0137] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0138] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method or program product. Therefore, various aspects of the present disclosure may be specifically implemented as the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system". Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0139] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating virtual special effects, characterized in that: The method comprises: Obtaining a target star point image to be rendered and a target noise image for controlling the brightness of each pixel in the target star point image, and extracting a pixel value corresponding to each pixel in the target noise image; performing phase mapping processing based on the pixel values corresponding to each pixel in the target noise image and the current rendering time to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function; Based on the preset flicker control function, mapping the phase data corresponding to each pixel point in the target noise image on the preset flicker control function into brightness control information; The target star point image is rendered based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment to obtain a target star point flickering effect.
2. The method according to claim 1, characterized in that Obtaining a target noise map for controlling the brightness of each pixel in the target star point map, including: An initial noise map is obtained, and based on a time change of the current rendering moment relative to the initial rendering moment, a texture of the initial noise map is controlled to be offset to obtain a target noise map for controlling the brightness of each pixel in the target star point map.
3. The method according to claim 1, characterized in that The performing phase mapping processing based on the pixel value corresponding to each pixel point in the target noise image and the current rendering time to determine the phase data corresponding to each pixel point in the target noise image on the preset flicker control function includes: Determining a phase offset control parameter of a preset flicker control function over time according to a time change of the current rendering moment relative to the initial rendering moment and a preset offset speed control parameter; Phase data corresponding to each pixel point in the target noise image on the preset flicker control function is determined according to the pixel value corresponding to each pixel point in the target noise image and the phase offset control parameter of the preset flicker control function over time.
4. The method according to claim 3, characterized in that The determining, based on the pixel value corresponding to each pixel in the target noise image and the phase offset control parameter of the preset flicker control function over time, phase data corresponding to each pixel in the target noise image on the preset flicker control function includes: Summing the pixel value corresponding to each pixel point in the target noise image with the phase offset control parameter of the preset flicker control function over time, thereby obtaining a summation result corresponding to each pixel point in the target noise image; Based on the summation result corresponding to each pixel point in the target noise image and the period information of the preset flicker control function, the phase data of each pixel point in the target noise image on the preset flicker control function is determined.
5. The method according to claim 1, wherein The step of obtaining a target star point image to be rendered includes: An initial star point map is obtained, and based on a time change between the current rendering moment and the initial rendering moment, a texture of the initial star point map is controlled to be offset to obtain a target star point map to be rendered.
6. The method according to claim 1, characterized in that The step of mapping the phase data corresponding to each pixel point in the target noise image on the preset flicker control function into brightness control information based on the preset flicker control function includes: performing calculation processing of the preset flicker control function based on phase data corresponding to each pixel point in the target noise map on the preset flicker control function to obtain a function calculation result corresponding to each pixel point in the target noise map; Based on the function calculation results corresponding to each pixel point in the target noise image, the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment is determined.
7. The method according to claim 1, characterized in that The rendering of the target star point image based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment to obtain the target star point flickering effect includes: forming a virtual mask based on the brightness and darkness control information corresponding to each pixel point in the target noise image at the current rendering moment; After the virtual mask is superimposed on the target star point map, the target star point map is rendered to obtain a target star point flickering effect.
8. A virtual special effect generating device, characterized in that: The device comprises: a pixel value extraction module, configured to obtain a target star point image to be rendered and a target noise image for controlling the brightness of each pixel in the target star point image, and extract a pixel value corresponding to each pixel in the target noise image; a phase data determination module, configured to perform phase mapping processing based on the pixel values corresponding to each pixel in the target noise image and the current rendering time, so as to determine the phase data corresponding to each pixel in the target noise image on a preset flicker control function; wherein the preset flicker control function is a periodic waveform function; A control information determination module is configured to map the phase data corresponding to each pixel point in the target noise image on the preset flicker control function into brightness control information based on the preset flicker control function; The star point map rendering module is used to render the target star point map based on the brightness and darkness control information corresponding to each pixel point in the target noise map at the current rendering moment to obtain a target star point flickering effect.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the method according to any one of claims 1 to 7 by executing the executable instructions.