CN111968213B - Warping effect generation method, device, equipment and storage medium - Google Patents

Warping effect generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN111968213B
CN111968213B CN202011143463.5A CN202011143463A CN111968213B CN 111968213 B CN111968213 B CN 111968213B CN 202011143463 A CN202011143463 A CN 202011143463A CN 111968213 B CN111968213 B CN 111968213B
Authority
CN
China
Prior art keywords
texture
distortion
image
coordinate
pixel point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011143463.5A
Other languages
Chinese (zh)
Other versions
CN111968213A (en
Inventor
姜明余
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Perfect World Network Technology Co Ltd
Original Assignee
Chengdu Perfect World Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Perfect World Network Technology Co Ltd filed Critical Chengdu Perfect World Network Technology Co Ltd
Priority to CN202011143463.5A priority Critical patent/CN111968213B/en
Priority to CN202110077490.5A priority patent/CN112652047A/en
Publication of CN111968213A publication Critical patent/CN111968213A/en
Application granted granted Critical
Publication of CN111968213B publication Critical patent/CN111968213B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Abstract

The embodiment of the invention provides a method, a device, equipment and a storage medium for generating a distortion effect, wherein the method comprises the following steps: acquiring image textures; performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, wherein the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion; acquiring a second distorted texture coordinate input by a user, and superposing the first distorted texture coordinate and the second distorted texture coordinate to obtain a final sampling coordinate; sampling the image texture through the final sampling coordinate, and outputting the sampling result to a temporary texture cache; and carrying out radial distortion processing on the sampling result in the temporary texture cache to obtain a mixed and distorted image texture, and displaying the mixed and distorted image texture in a screen. The invention can freely combine various distortion algorithms and can realize richer and more vivid distortion effects such as picture rotation, fluctuation and the like.

Description

Warping effect generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a warping effect.
Background
In the related art, in a scene where a distortion effect processing is required to be performed on a rendered image, the rendered image is often processed only by using one distortion effect processing mode, and the purpose of fusing multiple distortion effects cannot be achieved. If the rendered image is processed by only adopting a single distortion effect processing mode, the distortion effect of the obtained distorted image is poor, and the image quality of the distorted image is reduced.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for generating a distortion effect, which are used for improving the distortion effect of a distorted image and improving the image quality of the distorted image.
In a first aspect, an embodiment of the present invention provides a distortion effect generating method, where the method includes:
acquiring image textures;
performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, wherein the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion;
acquiring a second distorted texture coordinate input by a user, and superposing the first distorted texture coordinate and the second distorted texture coordinate input by the user to obtain a final sampling coordinate;
sampling the image texture through the final sampling coordinate, and outputting a sampling result to a temporary texture cache;
and carrying out radial distortion processing on the sampling result in the temporary texture cache to obtain mixed and distorted image textures, and displaying the mixed and distorted image textures in a screen.
Optionally, the warping the texture coordinate corresponding to the image texture to obtain a first warped texture coordinate, further includes:
and performing warping processing on the texture coordinates of the image texture according to the sorting sequence of the warping processing, and determining the image texture obtained by performing the warping processing currently as the image texture used in the next warping processing each time the warping processing is performed on the texture coordinates of the image texture.
Optionally, the warping includes a water wave warping effect, and the warping the texture coordinates corresponding to the image texture includes:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a first distortion vector subjected to water ripple distortion;
and determining texture coordinates subjected to water ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the first distortion vector.
Optionally, the obtaining a second warped texture coordinate input by a user, and superimposing the first warped texture coordinate and the second warped texture coordinate input by the user to obtain a final sampling coordinate includes:
acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the second distorted texture coordinate through the texture coordinate subjected to the ripple distortion to obtain a third distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding third distortion vector to obtain final sampling coordinates subjected to water ripple distortion.
Optionally, the performing a water ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture includes:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture through a formula;
the formula is:
the formula is:
WaveDistortion.x’=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.x= WaveDistortion.x’+sin(CurrentTexcoord.y-Time*5)*0.2
WaveDistortion.y’=cos(DistanceToCenter-Time*5)*0.2
WaveDistortion.y= WaveDistortion.y’+cos(CurrentTexcoord.x-Time*5)*0.2
the method comprises the steps of obtaining a current texture coordinate of an image texture, obtaining a final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the vertical direction, obtaining distance center, obtaining the distance between a current pixel point in the image texture and a central point, obtaining the initial texture coordinate of the current pixel point in the image texture, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the distance between the current pixel point in the image texture and the central point in the image texture, obtaining the initial texture coordinate of the current pixel point in the image texture in the current texture.
Optionally, the warping processing includes an annular ripple warping effect, and the warping processing on texture coordinates corresponding to the image texture includes:
performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a fourth distortion vector subjected to annular ripple distortion;
and determining texture coordinates subjected to annular ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the fourth distortion vector.
Optionally, the obtaining a second warped texture coordinate input by a user, and superimposing the first warped texture coordinate and the second warped texture coordinate input by the user to obtain a final sampling coordinate includes:
acquiring a fifth warped texture coordinate input by a user, wherein the fifth warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the fifth distorted texture coordinate through the texture coordinate subjected to annular ripple distortion to obtain a sixth distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding sixth distortion vector to obtain final sampling coordinates subjected to annular ripple distortion.
Optionally, the performing annular ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture includes:
performing annular ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
WaveDistortion.x=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.y=sin(DistanceToCenter-Time*5)*0.2
the wavelet resolution.x is a final offset component of an initial texture coordinate of any pixel point in the image texture in the horizontal direction, the wavelet resolution.y is a final offset component of the initial texture coordinate of any pixel point in the image texture in the vertical direction, and the Time is a Time difference between a program starting Time and a Time of rendering the image texture.
Optionally, the warping processing includes a spiral warping effect, and the warping processing on texture coordinates corresponding to the image texture includes:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture to obtain a seventh distortion vector subjected to spiral distortion;
and determining the texture coordinate subjected to spiral distortion based on the initial texture coordinate of each pixel point in the image texture and the seventh distortion vector.
Optionally, the performing spiral warping calculation on the initial texture coordinate of each pixel point in the image texture includes:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
DeltaUV=CurrentTexcoord-DistortCenter
RotatedDistortion.x=cos(RotateAngle)*DeltaUV.x-sin(RotateAngle)* DeltaUV.y
RotatedDistortion.y=sin(RotateAngle)*DeltaUV.x-cos(RotateAngle)* DeltaUV.y
the image texture processing method comprises the steps that a current Texacoord is an initial texture coordinate of a current pixel point in the image texture, a DistortCenter is a disturbance center, DeltaUV comprises DeltaUV.x and DeltaUV.y, RotatedDistortion.x is a distortion value in the horizontal direction after spiral distortion, RotatedDistortion.y is a distortion value in the vertical direction after spiral distortion, and RotateAngle is a numerical value calculated based on the distance between the Current Texacoord and the DistortCenter.
Optionally, the performing radial warping on the sampling result in the temporary texture buffer includes:
acquiring a radial sampling step length;
starting from a texture coordinate corresponding to a current pixel point in the image texture, sampling a sampling result in the temporary texture cache for a target number of times, and adding the radial sampling step length to the texture coordinate corresponding to the current pixel point every sampling time until the texture coordinate corresponding to the current pixel point added with the radial sampling step length reaches a target coordinate;
and accumulating the color values obtained by sampling each time, and dividing the accumulated values by the target times to obtain the image texture subjected to radial distortion.
Optionally, the obtaining a radial sampling step includes:
obtaining a radial sampling step length through a formula;
the formula is:
BlurVector=DistortCenter-CurrentTexcoord
DeltaSampling=BlurVector/BlurStepCount
the distorstcenter is a disturbance center, the currentTexcoord is an initial texture coordinate of a current pixel point in the image texture, the Blurvector is a direction vector between the distorstcenter and the currentTexcoord, BlurStepCount is the target frequency, and DeltaSampling is the radial sampling step length.
In a second aspect, an embodiment of the present invention provides a distortion effect generating apparatus, including:
the acquisition module is used for acquiring image textures;
the distortion module is used for performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, and the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion;
the superposition module is used for acquiring a second distorted texture coordinate input by a user, and superposing the first distorted texture coordinate and the second distorted texture coordinate input by the user to obtain a final sampling coordinate;
the sampling module is used for sampling the image texture through the final sampling coordinate and outputting a sampling result to a temporary texture cache;
and the mixing module is used for carrying out radial distortion processing on the sampling result in the temporary texture cache to obtain an image texture after mixed distortion, and displaying the image texture after mixed distortion in a screen.
Optionally, the sampling module is further configured to:
and performing warping processing on the texture coordinates of the image texture according to the sorting sequence of the warping processing, and determining the image texture obtained by performing the warping processing currently as the image texture used in the next warping processing each time the warping processing is performed on the texture coordinates of the image texture.
Optionally, the distortion process comprises a water ripple distortion effect, the distortion module to:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a first distortion vector subjected to water ripple distortion;
and determining texture coordinates subjected to water ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the first distortion vector.
Optionally, the superimposing module is configured to:
acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the second distorted texture coordinate through the texture coordinate subjected to the ripple distortion to obtain a third distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding third distortion vector to obtain final sampling coordinates subjected to water ripple distortion.
Optionally, the distortion module is configured to:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture through a formula;
the formula is:
WaveDistortion.x’=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.x= WaveDistortion.x’+sin(CurrentTexcoord.y-Time*5)*0.2
WaveDistortion.y’=cos(DistanceToCenter-Time*5)*0.2
WaveDistortion.y= WaveDistortion.y’+cos(CurrentTexcoord.x-Time*5)*0.2
the method comprises the steps of obtaining a current texture coordinate of an image texture, obtaining a final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the vertical direction, obtaining distance center, obtaining the distance between a current pixel point in the image texture and a central point, obtaining the initial texture coordinate of the current pixel point in the image texture, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the distance between the current pixel point in the image texture and the central point in the image texture, obtaining the initial texture coordinate of the current pixel point in the image texture in the current texture.
Optionally, the distortion effect processing comprises an annular ripple distortion effect, the distortion module to:
performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a fourth distortion vector subjected to annular ripple distortion;
and determining texture coordinates subjected to annular ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the fourth distortion vector.
Optionally, the superimposing module is configured to:
acquiring a fifth warped texture coordinate input by a user, wherein the fifth warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the fifth distorted texture coordinate through the texture coordinate subjected to annular ripple distortion to obtain a sixth distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding sixth distortion vector to obtain final sampling coordinates subjected to annular ripple distortion.
Optionally, the distortion module is configured to:
performing annular ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
WaveDistortion.x=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.y=sin(DistanceToCenter-Time*5)*0.2
the wavelet distorsion.x is a final offset component of an initial texture coordinate of any pixel point in the image texture in the horizontal direction, the wavelet distorsion.y is a final offset component of an initial texture coordinate of any pixel point in the image texture in the vertical direction, the distance to center is a distance between a current pixel point in the image texture and a central point, and the Time is a Time difference between a program starting Time and a Time for rendering the image texture.
Optionally, the warping effect processing comprises a helical warping effect, the warping module to:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture to obtain a seventh distortion vector subjected to spiral distortion;
and determining the texture coordinate subjected to spiral distortion based on the initial texture coordinate of each pixel point in the image texture and the seventh distortion vector.
Optionally, the distortion module is configured to:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
DeltaUV=CurrentTexcoord-DistortCenter
RotatedDistortion.x=cos(RotateAngle)*DeltaUV.x-sin(RotateAngle)* DeltaUV.y
RotatedDistortion.y=sin(RotateAngle)*DeltaUV.x-cos(RotateAngle)* DeltaUV.y
the image texture processing method comprises the steps that a current Texacoord is an initial texture coordinate of a current pixel point in the image texture, a DistortCenter is a disturbance center, DeltaUV comprises DeltaUV.x and DeltaUV.y, RotatedDistortion.x is a distortion value in the horizontal direction after spiral distortion, RotatedDistortion.y is a distortion value in the vertical direction after spiral distortion, and RotateAngle is a numerical value calculated based on the distance between the Current Texacoord and the DistortCenter.
Optionally, the mixing module is configured to:
acquiring a radial sampling step length;
starting from a texture coordinate corresponding to a current pixel point in the image texture, sampling a sampling result in the temporary texture cache for a target number of times, and adding the radial sampling step length to the texture coordinate corresponding to the current pixel point every sampling time until the texture coordinate corresponding to the current pixel point added with the radial sampling step length reaches a target coordinate;
and accumulating the color values obtained by sampling each time, and dividing the accumulated values by the target times to obtain the image texture subjected to radial distortion.
Optionally, the mixing module is configured to:
obtaining a radial sampling step length through a formula;
the formula is:
BlurVector=DistortCenter-CurrentTexcoord
DeltaSampling=BlurVector/BlurStepCount
the distorstcenter is a disturbance center, the currentTexcoord is an initial texture coordinate of a current pixel point in the image texture, the Blurvector is a direction vector between the distorstcenter and the currentTexcoord, BlurStepCount is the target frequency, and DeltaSampling is the radial sampling step length.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory, where the memory stores executable code thereon, and when the executable code is executed by the processor, the processor is enabled to implement at least the warping effect generating method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to implement at least the warping effect generating method of the first aspect.
The invention can freely combine various distortion algorithms, and can iteratively superpose distorted image textures output by different distortion algorithms so as to realize richer and more vivid distortion effects such as picture rotation, fluctuation and the like. By adopting the method and the device, the image quality of the distorted image texture can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic flow chart diagram of a warping effect generating method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating the effect of an option of an enable switch according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a distortion effect generating apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
Fig. 1 is a flowchart of a distortion effect generating method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
101. and acquiring image textures.
102. And performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, wherein the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion.
103. And acquiring a second distorted texture coordinate input by the user, and superposing the first distorted texture coordinate and the second distorted texture coordinate input by the user to obtain a final sampling coordinate.
104. And sampling the image texture through the final sampling coordinate, and outputting a sampling result to a temporary texture cache.
105. And carrying out radial distortion processing on the sampling result in the temporary texture cache to obtain a mixed and distorted image texture, and displaying the mixed and distorted image texture in a screen.
In the embodiment of the invention, various warping algorithms are provided, and the various warping algorithms can be freely combined by adopting the method, so that richer and more vivid warping effects such as picture rotation, fluctuation and the like are realized. The method can be applied to the special effect processing process of the science fiction film, and can also be applied to various different distortion effect processing scenes such as the underwater visual angle effect processing process in games and the like.
In practical applications, an image texture may be obtained first, and the initial image texture is an image that has not been processed by any warping effect. If the image texture needs to be subjected to warping effect processing, any two or any multiple warping effects can be selected from multiple warping effects according to actual application requirements for iterative superposition, different warping effects are fused together, and finally, the mixed and warped image texture is output. Wherein the twisting effect may include a water wave twisting effect, a ring wave twisting effect, a spiral twisting effect, a radial twisting effect, a twisting effect of a user input.
It should be noted that, as shown in fig. 2, a respective enabling switch option may be set for each distortion effect, so that when a user selects an opening option corresponding to a certain distortion effect, the distortion effect may be added, and accordingly, when the user turns off the enabling switch option corresponding to the certain distortion effect, the distortion effect may be skipped without any processing.
Optionally, the warping the texture coordinate corresponding to the image texture to obtain a first warped texture coordinate, further includes: and performing warping processing on the texture coordinates of the image texture according to the sorting sequence of the warping processing, and determining the image texture obtained by performing the warping processing currently as the image texture used in the next warping processing each time the warping processing is performed on the texture coordinates of the image texture.
In practical application, the texture coordinates of the image texture can be sequentially subjected to warping effect processing in combination with the sorting order of the warping processing. When the texture coordinates of the image texture are warped each time, the image texture output to the temporary texture buffer after the previous warping may be determined as the image texture subjected to the warping this time. For example, if the image texture needs to be subjected to the water ripple distortion effect and the annular ripple distortion effect, and the image texture subjected to the water ripple distortion is obtained after the water ripple distortion effect processing, the annular ripple distortion effect processing can be performed by using the image texture subjected to the water ripple distortion as a processing object in the process of performing the annular ripple distortion effect processing, so that the processing effect of continuous iterative superposition can be achieved. The process of performing the warping effect processing this time by using the image texture output to the temporary texture buffer after the previous warping will be described in detail later, and will not be described herein again.
Water wave distortion effect
Optionally, the warping effect processing includes a water ripple warping effect, and the process of warping the texture coordinates corresponding to the image texture may be implemented as: performing water ripple distortion calculation on initial texture coordinates of each pixel point in the image texture to obtain a first distortion vector subjected to water ripple distortion; and determining texture coordinates subjected to water ripple distortion based on the initial texture coordinates and the first distortion vector of each pixel point in the image texture.
In practical applications, the image texture may be a two-dimensional image, which is a result of performing rasterization processing after a triangular patch in a three-dimensional space is projected onto a two-dimensional plane. The image texture is composed of a plurality of pixel points, each pixel point corresponds to a respective initial texture coordinate, and a first distortion vector can be obtained by performing a series of water ripple distortion calculation on each initial texture coordinate. The first warping vector may also be referred to as an offset vector, that is, the corresponding initial texture coordinate may be shifted by the first warping vector to obtain a new texture coordinate, the new texture coordinate may be used to sample the color texture corresponding to the image texture, and the water-ripple-warped image texture may be output.
The above-mentioned process of performing the water ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture can be realized by formula 1 to formula 4:
wave discrimination.x' = sin (distance to center-Time 5) × 0.2 (formula 1)
Wave discrimination.x = wave discrimination.x' + sin (currenttexcoord.y-Time 5) × 0.2 (formula 2)
Wave discrimination.y' = cos (distance center-Time 5) × 0.2 (formula 3)
Wave discrimination.y = wave discrimination.y' + cos (currenttexcoord. x-Time 5) × 0.2 (formula 4)
The image texture processing method comprises the steps of obtaining an initial texture coordinate of any pixel point in an image texture, obtaining a final offset component of the initial texture coordinate of the any pixel point in the image texture in the horizontal direction, obtaining the final offset component of the initial texture coordinate of the any pixel point in the image texture in the vertical direction, obtaining distance center, the distance between a current pixel point in the image texture and a central point, obtaining the initial texture coordinate of the current pixel point in the image texture, obtaining the Time, the Time difference between the starting Time of a program and the rendering Time of the image texture, obtaining the distance.
Alternatively, if the user does not provide the texture of the warp vector during the water ripple warping process, the initial texture coordinates of each pixel in the texture of the image may be added to the corresponding first warp vector to obtain the coordinates of the texture subjected to the water ripple warping, that is, the coordinates of the texture subjected to the water ripple warping may be calculated by using wavedistorsion plus CurrentTexcoord. On the other hand, if the user provides the warp vector texture during the water ripple warping process, the warp vector texture may also be taken into account during the computation of the texture coordinates that have been water ripple warped.
Optionally, the obtaining of the second warped texture coordinate input by the user, and the superimposing the first warped texture coordinate and the second warped texture coordinate input by the user to obtain the final sampling coordinate may include: acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel; sampling the second distorted texture coordinate through the texture coordinate subjected to the ripple distortion to obtain a third distorted vector; and adding the initial texture coordinates of each pixel point in the image texture and the corresponding third distortion vector to obtain final sampling coordinates subjected to water ripple distortion.
It is understood that the warp vector texture may also be referred to as a second warp texture coordinate, and the warp vector texture is an image texture, which is different from a general image in that a unitized two-dimensional direction vector is stored in the warp vector texture, and includes two component values of x and y stored through two channels of r channel and g channel, respectively. The warp vector texture indicates the direction in which the texture coordinates need to be warped, and the wavedistorsion is added to the warp vector in the warp vector texture to obtain a third warp vector. After the third warp vector is obtained, the final sampling coordinates after the water ripple warping can be calculated by adding the corresponding third warp vector to the CurrentTexcoord.
Finally, the color texture corresponding to the image texture can be sampled by using the final sampling coordinate subjected to the water ripple distortion, and the image texture subjected to the water ripple distortion is output. The output moire warped image texture may be stored in a color buffer.
(II) annular ripple distortion effect
Optionally, the warping effect processing includes an annular ripple warping effect, and the process of warping the texture coordinates corresponding to the image texture may be implemented as: performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a fourth distortion vector subjected to annular ripple distortion; and determining texture coordinates subjected to annular ripple distortion based on the initial texture coordinates and the fourth distortion vector of each pixel point in the image texture.
In practical application, the image texture is composed of a plurality of pixel points, each pixel point corresponds to a respective initial texture coordinate, and a fourth distortion vector can be obtained by performing a series of annular ripple distortion calculations on each initial texture coordinate. The fourth warping vector may also be regarded as an offset vector, that is, a new texture coordinate may be obtained by shifting the corresponding initial texture coordinate by the fourth warping vector, and the new texture coordinate may be used to sample the water ripple warped image texture output by the previous warping process, so as to obtain the ring ripple warped image texture.
The above-mentioned process of performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture can be realized by formulas 5 to 6:
wavediscrimination.x = sin (distance to center-Time 5) × 0.2 (equation 5)
Wavedistorsion.y = sin (DistanceToCenter-Time 5) × 0.2 (equation 6)
The wavelet distorsion.x is a final offset component of an initial texture coordinate of any pixel point in the image texture in the horizontal direction, the wavelet distorsion.y is a final offset component of an initial texture coordinate of any pixel point in the image texture in the vertical direction, the distance to center is a distance between a current pixel point in the image texture and a central point, and the Time is a Time difference between a program starting Time and a Time for rendering the image texture.
Alternatively, if the user does not provide the distortion vector texture during the circular ripple warping process, the initial texture coordinates of each pixel point in the image texture may be added to the corresponding first distortion vector to obtain the circular ripple warped texture coordinates, that is, the circular ripple warped texture coordinates may be calculated by adding the initial texture coordinates to the corresponding first distortion vector. On the other hand, if the user provides the warp vector texture during the circular-ripple warping process, the warp vector texture may also be taken into account during the calculation of the texture coordinates that are warped by the circular ripple.
Optionally, the obtaining of the second warped texture coordinate input by the user, and the superimposing the first warped texture coordinate and the second warped texture coordinate input by the user to obtain the final sampling coordinate may include: acquiring a fifth warped texture coordinate input by a user, wherein the fifth warped texture coordinate comprises component values of an r channel and a g channel; sampling the fifth distorted texture coordinate through the distorted texture coordinate of the annular corrugation to obtain a sixth distorted vector; and adding the initial texture coordinates of each pixel point in the image texture and the corresponding sixth distortion vector to obtain the final sampling coordinates subjected to annular ripple distortion.
It should be noted that, because the processing procedure of the distortion effect input by the second user is similar to the processing procedure of the distortion effect input by the first user, the processing procedure of the distortion effect input by the second user may refer to the processing procedure of the distortion effect input by the first user, and the processing procedure of the distortion effect input by the second user is not described herein again.
(III) helical twisting Effect
Optionally, the warping effect processing includes a spiral warping effect, and the process of warping the texture coordinates corresponding to the image texture may be implemented as: performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture to obtain a seventh distortion vector subjected to spiral distortion; and determining the texture coordinate subjected to spiral distortion based on the initial texture coordinate and the seventh distortion vector of each pixel point in the image texture.
In practical application, the image texture is composed of a plurality of pixel points, each pixel point corresponds to a respective initial texture coordinate, and a seventh distortion vector can be obtained by performing a series of spiral distortion calculations on each initial texture coordinate. The seventh warping vector may also be regarded as an offset vector, that is, a new texture coordinate may be obtained by shifting the corresponding initial texture coordinate by the seventh warping vector, and the new texture coordinate may be used to sample the annular ripple warped image texture output by the previous warping process, so as to obtain the image texture subjected to the spiral warping.
Optionally, the process of performing the spiral warping calculation on the initial texture coordinate of each pixel point in the image texture may be implemented by formulas 7 to 9:
DeltaUV = Current Texcooord-DistortCenter (equation 7)
Rotateddistorsion.x = cos (rotaangle) × deltauv.x-sin (rotaangle) × deltauv.y (equation 8)
Rotateddistorsion.y = sin (rotaangle) × deltauv.x-cos (rotaangle) × deltauv.y (formula 9)
The image texture processing method comprises the steps that a current texture coordinate of a current pixel point in an image texture is obtained, the current texture coordinate is a two-dimensional vector, a distorstcenter is a disturbance center, the distorstcenter is a two-dimensional vector, DeltaUV comprises DeltaUV.x and DeltaUV.y, rotadDistortion.x is a distortion value in the horizontal direction after spiral distortion, rotadDistortion.y is a distortion value in the vertical direction after spiral distortion, and rotaAngle is a numerical value calculated based on the distance between the current texture coordinate and the distorstcenter.
After the rotatedDistoretation is obtained, the helically warped texture coordinates can be calculated using CurrentTexcoord plus the corresponding rotatedDistoretation. Finally, the color texture corresponding to the image texture may be sampled using the texture coordinates subjected to the spiral warping, and the image texture subjected to the spiral warping may be output. The output spiral warped image texture may be stored in a color buffer.
(IV) radial twisting Effect
Optionally, the process of performing radial warping on the sampling result in the temporary texture buffer may be implemented as: acquiring a radial sampling step length; starting from texture coordinates corresponding to a current pixel point in an image texture, sampling a sampling result in the temporary texture cache for a target number of times, and adding a radial sampling step length to the texture coordinates corresponding to the current pixel point every sampling time until the texture coordinates corresponding to the current pixel point added with the radial sampling step length reach the target coordinates; and accumulating the color values obtained by sampling each time, and dividing the accumulated values by the target times to obtain the image texture subjected to radial distortion.
The radial sampling step length may be calculated by:
blurvector = Distortcenter-CurrentTexcoord (equation 10)
DeltaSampling = Blurvector/BlurStepCoun (equation 11)
The distorstcenter is a disturbance center, the currentTexcoord is an initial texture coordinate of a current pixel point in the image texture, the currentTexcoord is a two-dimensional vector, the Blurvector is a direction vector between the distorstcenter and the currentTexcoord, the BlurStepCount is the target frequency, and a user can set the target frequency BlurStepCount, and DeltaSampling is the radial sampling step length.
The radial sampling step length can be calculated through formulas 10 to 11, and after the radial sampling step length is obtained, the sampling result in the temporary texture cache can be sampled for BlurStepCount times from the texture coordinate corresponding to the current pixel point in the image texture. In each sampling process, the texture coordinate corresponding to the current pixel point may be superimposed with the radial sampling step length until the distertcenter is reached. Sampling at every turn can all obtain a colour value, can add up the colour value that sampling at every turn obtained, and the colour value of every pixel point in the image texture through radial distortion is calculated with accumulated value division BlurStepCount finally.
Finally, after obtaining the hybrid warped image texture, the hybrid warped image texture may be displayed in a screen.
The invention can freely combine various distortion algorithms, and can iteratively superpose distorted image textures output by different distortion algorithms so as to realize richer and more vivid distortion effects such as picture rotation, fluctuation and the like. By adopting the method and the device, the image quality of the distorted image texture can be improved.
The twisting effect generating apparatus of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these distortion effect generating means can be constructed by configuring the steps taught in the present embodiment using commercially available hardware components.
Fig. 3 is a schematic structural diagram of a twisting effect generating apparatus according to an embodiment of the present invention, as shown in fig. 3, the apparatus includes:
an obtaining module 31, configured to obtain an image texture;
a warping module 32, configured to perform warping processing on texture coordinates corresponding to the image texture to obtain a first warped texture coordinate, where the warping processing sequentially includes water ripple warping, annular ripple warping, and spiral warping;
the superposition module 33 is configured to obtain a second warped texture coordinate input by the user, and superpose the first warped texture coordinate and the second warped texture coordinate input by the user to obtain a final sampling coordinate;
the sampling module 34 is configured to sample the image texture through the final sampling coordinate, and output a sampling result to a temporary texture cache;
and a mixing module 35, configured to perform radial warping on the sampling result in the temporary texture cache to obtain a mixed warped image texture, and display the mixed warped image texture in a screen.
Optionally, the sampling module 34 is further configured to:
and performing warping processing on the texture coordinates of the image texture according to the sorting sequence of the warping processing, and determining the image texture obtained by performing the warping processing currently as the image texture used in the next warping processing each time the warping processing is performed on the texture coordinates of the image texture.
Optionally, the distortion process comprises a water wave distortion effect, the distortion module 32 being configured to:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a first distortion vector subjected to water ripple distortion;
and determining texture coordinates subjected to water ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the first distortion vector.
Optionally, the superimposing module 33 is configured to:
acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the second distorted texture coordinate through the texture coordinate subjected to the ripple distortion to obtain a third distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding third distortion vector to obtain final sampling coordinates subjected to water ripple distortion.
Optionally, the distortion module 32 is configured to:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture through a formula;
the formula is:
WaveDistortion.x’=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.x= WaveDistortion.x’+sin(CurrentTexcoord.y-Time*5)*0.2
WaveDistortion.y’=cos(DistanceToCenter-Time*5)*0.2
WaveDistortion.y= WaveDistortion.y’+cos(CurrentTexcoord.x-Time*5)*0.2
the method comprises the steps of obtaining a current texture coordinate of an image texture, obtaining a final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the vertical direction, obtaining distance center, obtaining the distance between a current pixel point in the image texture and a central point, obtaining the initial texture coordinate of the current pixel point in the image texture, obtaining the final offset component of the initial texture coordinate of any pixel point in the image texture in the horizontal direction, obtaining the distance between the current pixel point in the image texture and the central point in the image texture, obtaining the initial texture coordinate of the current pixel point in the image texture in the current texture.
Optionally, the distortion effect processing comprises an annular ripple distortion effect, the distortion module 32 is configured to:
performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a fourth distortion vector subjected to annular ripple distortion;
and determining texture coordinates subjected to annular ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the fourth distortion vector.
Optionally, the superimposing module 33 is configured to:
acquiring a fifth warped texture coordinate input by a user, wherein the fifth warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the fifth distorted texture coordinate through the texture coordinate subjected to annular ripple distortion to obtain a sixth distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding sixth distortion vector to obtain final sampling coordinates subjected to annular ripple distortion.
Optionally, the distortion module 32 is configured to:
performing annular ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
WaveDistortion.x=sin(DistanceToCenter-Time*5)*0.2
WaveDistortion.y=sin(DistanceToCenter-Time*5)*0.2
the wavelet distorsion.x is a final offset component of an initial texture coordinate of any pixel point in the image texture in the horizontal direction, the wavelet distorsion.y is a final offset component of an initial texture coordinate of any pixel point in the image texture in the vertical direction, the distance to center is a distance between a current pixel point in the image texture and a central point, and the Time is a Time difference between a program starting Time and a Time for rendering the image texture.
Optionally, the warping effect processing comprises a helical warping effect, the warping module 32 is configured to:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture to obtain a seventh distortion vector subjected to spiral distortion;
and determining the texture coordinate subjected to spiral distortion based on the initial texture coordinate of each pixel point in the image texture and the seventh distortion vector.
Optionally, the distortion module 32 is configured to:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
DeltaUV=CurrentTexcoord-DistortCenter
RotatedDistortion.x=cos(RotateAngle)*DeltaUV.x-sin(RotateAngle)* DeltaUV.y
RotatedDistortion.y=sin(RotateAngle)*DeltaUV.x-cos(RotateAngle)* DeltaUV.y
the image texture processing method comprises the steps that a current Texacoord is an initial texture coordinate of a current pixel point in the image texture, a DistortCenter is a disturbance center, DeltaUV comprises DeltaUV.x and DeltaUV.y, RotatedDistortion.x is a distortion value in the horizontal direction after spiral distortion, RotatedDistortion.y is a distortion value in the vertical direction after spiral distortion, and RotateAngle is a numerical value calculated based on the distance between the Current Texacoord and the DistortCenter.
Optionally, the mixing module 35 is configured to:
acquiring a radial sampling step length;
starting from a texture coordinate corresponding to a current pixel point in the image texture, sampling the image subjected to spiral distortion for a target number of times, and adding the radial sampling step length to the texture coordinate corresponding to the current pixel point every sampling time until the texture coordinate corresponding to the current pixel point added with the radial sampling step length reaches a target coordinate;
and accumulating the color values obtained by sampling each time, and dividing the accumulated values by the target times to obtain the image texture subjected to radial distortion.
Optionally, the mixing module 35 is configured to:
obtaining a radial sampling step length through a formula;
the formula is:
BlurVector=DistortCenter-CurrentTexcoord
DeltaSampling=BlurVector/BlurStepCount
the distorstcenter is a disturbance center, the currentTexcoord is an initial texture coordinate of a current pixel point in the image texture, the Blurvector is a direction vector between the distorstcenter and the currentTexcoord, BlurStepCount is the target frequency, and DeltaSampling is the radial sampling step length.
The apparatus shown in fig. 3 may perform the warping effect generating method provided in the embodiments shown in fig. 1 to fig. 2, and the detailed performing process and technical effect refer to the description in the embodiments, which is not described herein again.
In one possible design, the structure of the twisting effect generating apparatus shown in fig. 3 may be implemented as an electronic device, as shown in fig. 4, which may include: a processor 91, and a memory 92. Wherein the memory 92 has stored thereon executable code, which when executed by the processor 91, causes the processor 91 to at least implement the warping effect generating method as provided in the foregoing embodiments shown in fig. 1 to 2.
Optionally, the electronic device may further include a communication interface 93 for communicating with other devices.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is enabled to implement at least the warping effect generating method provided in the foregoing embodiments shown in fig. 1 to 2.
The above-described apparatus embodiments are merely illustrative, wherein the units described as separate components may or may not be physically separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described aspects and portions of the present technology which contribute substantially or in part to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including without limitation disk storage, CD-ROM, optical storage, and the like.
The distortion effect generating method provided by the embodiment of the present invention may be executed by a certain program/software, the program/software may be provided by a network side, the electronic device mentioned in the foregoing embodiment may download the program/software into a local non-volatile storage medium, and when it needs to execute the distortion effect generating method, the program/software is read into a memory by a CPU, and then the program/software is executed by the CPU to implement the distortion effect generating method provided in the foregoing embodiment, and the execution process may refer to the schematic in fig. 1 to fig. 2.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (14)

1. A distortion effect generation method, comprising:
acquiring image textures;
performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, wherein the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion;
acquiring a second distorted texture coordinate input by a user, and superposing the first distorted texture coordinate and the second distorted texture coordinate to obtain a final sampling coordinate;
sampling the image texture through the final sampling coordinate, and outputting a sampling result to a temporary texture cache;
acquiring a radial sampling step length;
starting from a texture coordinate corresponding to a current pixel point in the image texture, sampling a sampling result in the temporary texture cache for a target number of times, and adding the radial sampling step length to the texture coordinate corresponding to the current pixel point every sampling time until the texture coordinate corresponding to the current pixel point added with the radial sampling step length reaches a target coordinate;
accumulating the color values obtained by sampling each time, and dividing the accumulated values by the target times to obtain radially distorted image textures;
displaying the radially warped image texture in a screen.
2. The method according to claim 1, wherein the warping texture coordinates corresponding to the image texture to obtain first warped texture coordinates further comprises:
and performing warping processing on the texture coordinates of the image texture according to the sorting sequence of the warping processing, and determining the image texture obtained by performing the warping processing currently as the image texture used in the next warping processing each time the warping processing is performed on the texture coordinates of the image texture.
3. The method of claim 2, wherein the warping comprises a water wave warping effect, and wherein warping texture coordinates corresponding to the image texture comprises:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a first distortion vector subjected to water ripple distortion;
and determining texture coordinates subjected to water ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the first distortion vector.
4. The method of claim 3, wherein the obtaining a second warped texture coordinate input by a user, and superimposing the first warped texture coordinate with the second warped texture coordinate to obtain a final sampled coordinate comprises:
acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the second distorted texture coordinate through the texture coordinate subjected to the ripple distortion to obtain a third distorted vector;
and adding the initial texture coordinates of each pixel point in the image texture and the corresponding third distortion vector to obtain final sampling coordinates subjected to water ripple distortion.
5. The method of claim 3, wherein the performing a water wave distortion calculation on the initial texture coordinates of each pixel point in the image texture comprises:
performing water ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture through a formula;
the formula is:
Figure 305488DEST_PATH_IMAGE001
Figure 554067DEST_PATH_IMAGE002
Figure 418118DEST_PATH_IMAGE003
Figure 701332DEST_PATH_IMAGE004
the image texture processing method comprises the steps of obtaining an initial texture coordinate of any pixel point in an image texture, obtaining a final offset component of the initial texture coordinate of the any pixel point in the image texture in the horizontal direction, obtaining the final offset component of the initial texture coordinate of the any pixel point in the image texture in the vertical direction, obtaining distance center, the distance between a current pixel point in the image texture and a central point, obtaining the initial texture coordinate of the current pixel point in the image texture, obtaining the Time, the Time difference between the starting Time of a program and the rendering Time of the image texture, obtaining the distance.
6. The method of claim 2, wherein the warping effect processing comprises a ring-shaped moire warping effect, and wherein the warping texture coordinates corresponding to the image texture comprises:
performing annular ripple distortion calculation on the initial texture coordinates of each pixel point in the image texture to obtain a fourth distortion vector subjected to annular ripple distortion;
and determining texture coordinates subjected to annular ripple distortion based on the initial texture coordinates of each pixel point in the image texture and the fourth distortion vector.
7. The method of claim 6, wherein the obtaining a second warped texture coordinate input by a user, and superimposing the first warped texture coordinate with the second warped texture coordinate to obtain a final sampled coordinate comprises:
acquiring a second warped texture coordinate input by a user, wherein the second warped texture coordinate comprises component values of a red r channel and a green g channel;
sampling the second distorted texture coordinate through the texture coordinate subjected to annular ripple distortion to obtain a sixth distortion vector;
adding the initial texture coordinates of each pixel point in the image texture and the corresponding sixth distortion vector to obtain a ring wave
Final sample coordinates of the grain distortion.
8. The method of claim 6, wherein the performing an annular moire warping calculation on the initial texture coordinates of each pixel point in the image texture comprises:
performing annular ripple distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
Figure 992636DEST_PATH_IMAGE005
Figure 728510DEST_PATH_IMAGE006
the wavelet distorsion.x is a final offset component of an initial texture coordinate of any pixel point in the image texture in the horizontal direction, the wavelet distorsion.y is a final offset component of an initial texture coordinate of any pixel point in the image texture in the vertical direction, the distance to center is a distance between a current pixel point in the image texture and a central point, and the Time is a Time difference between a program starting Time and a Time for rendering the image texture.
9. The method of claim 2, wherein the warping effect processing comprises a spiral warping effect, and wherein the warping texture coordinates corresponding to the image texture comprises:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture to obtain a seventh distortion vector subjected to spiral distortion;
and determining the texture coordinate subjected to spiral distortion based on the initial texture coordinate of each pixel point in the image texture and the seventh distortion vector.
10. The method of claim 9, wherein the performing a spiral warping calculation on the initial texture coordinates of each pixel point in the image texture comprises:
performing spiral distortion calculation on the initial texture coordinate of each pixel point in the image texture through a formula;
the formula is:
Figure 192990DEST_PATH_IMAGE007
Figure 330710DEST_PATH_IMAGE008
Figure 792915DEST_PATH_IMAGE009
the CurrentTexcooord is an initial texture coordinate of a current pixel point in the image texture, the Distortcenter is a disturbance center, and the DeltaUV comprises DeltaUV.x and DeltaUV.y; DeltaUV is a value determined based on CurrentTexcoord and distorster center, rotateddistorsion.x is a distortion value in a horizontal direction subjected to helical distortion, rotateddistorsion.y is a distortion value in a vertical direction subjected to helical distortion, and rotaangle is a value calculated based on a distance between CurrentTexcoord and distorster center.
11. The method of claim 1, wherein the obtaining radial sampling steps comprises:
obtaining a radial sampling step length through a formula;
the formula is:
Figure 16086DEST_PATH_IMAGE010
Figure 221940DEST_PATH_IMAGE011
the distorstcenter is a disturbance center, the currentTexcoord is an initial texture coordinate of a current pixel point in the image texture, the Blurvector is a direction vector between the distorstcenter and the currentTexcoord, BlurStepCount is the target frequency, and DeltaSampling is the radial sampling step length.
12. A distortion effect generation apparatus, comprising:
the acquisition module is used for acquiring image textures;
the distortion module is used for performing distortion processing on texture coordinates corresponding to the image textures to obtain first distorted texture coordinates, and the distortion processing sequentially comprises water ripple distortion, annular ripple distortion and spiral distortion;
the superposition module is used for acquiring a second distorted texture coordinate input by a user, and superposing the first distorted texture coordinate and the second distorted texture coordinate to obtain a final sampling coordinate;
a sampling module for sampling the image texture through the final sampling coordinate and outputting the sampling result to the temporary texture
In the management cache;
the mixing module is used for acquiring a radial sampling step length; starting from a texture coordinate corresponding to a current pixel point in the image texture, sampling a sampling result in the temporary texture cache for a target number of times, and adding the radial sampling step length to the texture coordinate corresponding to the current pixel point every sampling time until the texture coordinate corresponding to the current pixel point added with the radial sampling step length reaches a target coordinate; accumulating the color values obtained by sampling each time, dividing the accumulated values by the target times to obtain radially distorted image textures, and displaying the radially distorted image textures on a screen.
13. An electronic device, comprising: a memory, a processor; wherein the memory has stored thereon executable code which, when executed by the processor, causes the processor to perform the warping effect generating method as claimed in any one of claims 1-11.
14. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the warping effect generating method as claimed in any one of claims 1-11.
CN202011143463.5A 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium Active CN111968213B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011143463.5A CN111968213B (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium
CN202110077490.5A CN112652047A (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011143463.5A CN111968213B (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202110077490.5A Division CN112652047A (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111968213A CN111968213A (en) 2020-11-20
CN111968213B true CN111968213B (en) 2021-03-23

Family

ID=73387189

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011143463.5A Active CN111968213B (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium
CN202110077490.5A Pending CN112652047A (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110077490.5A Pending CN112652047A (en) 2020-10-23 2020-10-23 Warping effect generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (2) CN111968213B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898438A (en) * 1996-11-12 1999-04-27 Ford Global Technologies, Inc. Texture mapping of photographic images to CAD surfaces
EP1413989A1 (en) * 2002-10-21 2004-04-28 Canon Europa N.V. Apparatus and method for generating texture maps for use in 3D computer graphics
CN107079141A (en) * 2014-09-22 2017-08-18 三星电子株式会社 Image mosaic for 3 D video
CN108182852A (en) * 2018-02-15 2018-06-19 上海诚唐展览展示有限公司 A kind of black hole simulation sensory perceptual system for science popularization demonstration
CN111311719A (en) * 2020-02-10 2020-06-19 网易(杭州)网络有限公司 Display processing method and device in game

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1781111A (en) * 2002-11-06 2006-05-31 几何信息学股份有限公司 Analysis of geometric surfaces by comformal structure
BR102012016227A2 (en) * 2012-06-27 2015-12-01 Unicamp method of obtaining attractive faces and their uses
CN105631924B (en) * 2015-12-28 2018-09-11 北京像素软件科技股份有限公司 The implementation method of distortion effects in a kind of scene
CN110111262B (en) * 2019-03-29 2021-06-04 北京小鸟听听科技有限公司 Projector projection distortion correction method and device and projector
CN110917617B (en) * 2019-11-15 2023-10-24 瑞立视视觉创意科技(深圳)有限公司 Method, device, equipment and storage medium for generating water ripple image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898438A (en) * 1996-11-12 1999-04-27 Ford Global Technologies, Inc. Texture mapping of photographic images to CAD surfaces
EP1413989A1 (en) * 2002-10-21 2004-04-28 Canon Europa N.V. Apparatus and method for generating texture maps for use in 3D computer graphics
CN107079141A (en) * 2014-09-22 2017-08-18 三星电子株式会社 Image mosaic for 3 D video
CN108182852A (en) * 2018-02-15 2018-06-19 上海诚唐展览展示有限公司 A kind of black hole simulation sensory perceptual system for science popularization demonstration
CN111311719A (en) * 2020-02-10 2020-06-19 网易(杭州)网络有限公司 Display processing method and device in game

Also Published As

Publication number Publication date
CN112652047A (en) 2021-04-13
CN111968213A (en) 2020-11-20

Similar Documents

Publication Publication Date Title
CN110136066B (en) Video-oriented super-resolution method, device, equipment and storage medium
CN107945112B (en) Panoramic image splicing method and device
WO2018032783A1 (en) Image processing method and apparatus
CN110062176B (en) Method and device for generating video, electronic equipment and computer readable storage medium
KR100914211B1 (en) Distorted image correction apparatus and method
US20190073743A1 (en) Image generating apparatus, image generating method, and program
US11030715B2 (en) Image processing method and apparatus
Hore et al. An edge-sensing generic demosaicing algorithm with application to image resampling
JP2015035198A (en) Image processing device and image processing method
CN110335330B (en) Image simulation generation method and system, deep learning algorithm training method and electronic equipment
CN110070515B (en) Image synthesis method, apparatus and computer-readable storage medium
JP6071419B2 (en) Image processing apparatus and image processing method
JP4949463B2 (en) Upscaling
CN110569013B (en) Image display method and device based on display screen
EP2731325A1 (en) Imaging device and recording medium
CN107948547B (en) Processing method and device for panoramic video stitching and electronic equipment
CN111986296B (en) CG animation synthesis method for bullet time
CN111968213B (en) Warping effect generation method, device, equipment and storage medium
JP4936083B2 (en) Thumbnail image generation method and apparatus
WO2018087856A1 (en) Image synthesis device and image synthesis method
JP6756679B2 (en) Decision device, image processing device, decision method and decision program
CN112700526B (en) Concave-convex material image rendering method and device
US9754162B2 (en) Image processing method and device for adaptive image enhancement
CN115002345A (en) Image correction method and device, electronic equipment and storage medium
WO2018092715A1 (en) Image processing device, image processing method and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant