Method, apparatus, device, and storage medium for generating special effect diagrams

By transforming and offsetting the surface map of the 3D virtual fluid model, dynamic special effects maps are generated, which solves the problem of single fluid movement mode in the prior art and improves the authenticity of the fluid dynamic map.

CN114612596BActive Publication Date: 2025-06-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210238148.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-11
Publication Date
2025-06-03
Estimated Expiration
2042-03-11

AI Technical Summary

Technical Problem

In the prior art, when simulating fluid movement, the fluid movement mode is relatively single, resulting in the generated fluid dynamic diagram not being realistic enough.

Method used

By scaling and/or translating the initial surface map of the 3D virtual fluid model, the offset of each vertex along the longitudinal axis direction is determined, and the vertices are moved according to the offset to generate a static map, and then the continuous static maps are spliced ​​and encoded to obtain dynamic special effects maps.

Benefits of technology

The authenticity of the liquid flow chart is improved, and the dynamic and authenticity of the image is enhanced by simulating a diverse liquid flow effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612596B_ABST
    Figure CN114612596B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a method, apparatus, device, and storage medium for generating special effect images. Scale and / or translate the initial surface texture map of the 3D virtual fluid model to obtain at least one transformed surface texture map; determine the offset of each vertex in the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map; move each vertex in the longitudinal axis direction according to the offset to obtain a static image of the 3D virtual fluid model after offset; splice and encode consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual model. The method for generating special effect images provided by the embodiments of the present disclosure determines the offset of each vertex in the longitudinal axis direction according to the initial surface texture map and at least one transformed surface texture map, and moves each vertex in the longitudinal axis direction according to the offset, so that the generated dynamic special effect image has the effect of liquid flow and improves the authenticity of the liquid flow image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of image processing technologies, and in particular, to a method, apparatus, device, and storage medium for generating special effect images. Background Art

[0002] In the prior art, when simulating fluid motion (such as: the flow of tears), it is usually to control the virtual fluid to flow in a periodic manner. In this way, the simulated fluid motion mode is relatively single, making the generated fluid dynamic image not very realistic. Summary of the Invention

[0003] Embodiments of the present disclosure provide a method, apparatus, device, and storage medium for generating special effect images, which can generate a flow special effect image of a liquid and improve the authenticity of the liquid flow image.

[0004] In a first aspect, embodiments of the present disclosure provide a method for generating a special effect image, including:

[0005] Performing a scaling and / or translation transformation on an initial surface map of a 3D virtual fluid model to obtain at least one transformed surface map;

[0006] Determining an offset of each vertex in the longitudinal axis direction according to the initial surface map and the at least one transformed surface map; wherein, the longitudinal axis is perpendicular to the plane where the surface map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model;

[0007] Moving each vertex in the longitudinal axis direction according to the offset to obtain a static image of the offset 3D virtual fluid model;

[0008] Stitching and encoding consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual model.

[0009] In a second aspect, embodiments of the present disclosure further provide a device for generating a special effect image, including:

[0010] A transformed surface map acquisition module, configured to perform a scaling and / or translation transformation on an initial surface map of a 3D virtual fluid model to obtain at least one transformed surface map;

[0011] An offset determination module, configured to determine an offset of each vertex in the longitudinal axis direction according to the initial surface map and the at least one transformed surface map; wherein, the longitudinal axis is perpendicular to the plane where the surface map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model;

[0012] A static image acquisition module, configured to move each vertex in the longitudinal axis direction according to the offset to obtain a static image of the offset 3D virtual fluid model;

[0013] A dynamic special effect image acquisition module, configured to splice and encode the continuous static images to obtain a dynamic special effect image corresponding to the 3D virtual model.

[0014] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:

[0015] One or more processing devices;

[0016] A storage device, configured to store one or more programs;

[0017] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the special effect image generation method as described in the embodiments of the present disclosure.

[0018] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processing device, the special effect image generation method as described in the embodiments of the present disclosure is implemented.

[0019] Embodiments of the present disclosure disclose a method, apparatus, device, and storage medium for generating special effect images. Scale and / or translate the initial surface texture map of the 3D virtual fluid model to obtain at least one transformed surface texture map; determine the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map; wherein, the longitudinal axis is perpendicular to the plane where the surface texture map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model; move each vertex along the longitudinal axis direction according to the offset to obtain a static image of the 3D virtual fluid model after offset; splice and encode the continuous static images to obtain a dynamic special effect image corresponding to the 3D virtual model. The special effect image generation method provided by the embodiments of the present disclosure determines the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map, and moves each vertex along the longitudinal axis direction according to the offset, so that the generated dynamic special effect image has the effect of liquid flow and improves the authenticity of the liquid flow image. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flowchart of a method for generating a special effect image in an embodiment of the present disclosure;

[0021] Figure 2 is a schematic structural diagram of a device for generating a special effect image in an embodiment of the present disclosure;

[0022] Figure 3 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0024] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0025] As used herein, the term "including" and its variations are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0026] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions executed by these devices, modules or units or their interdependent relationships.

[0027] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more".

[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0029] Figure 1 As shown in the flowchart of a method for generating a special effect map provided for the embodiments of the present disclosure, this embodiment is applicable to simulating the situation of liquid flow. This method can be executed by a device for generating a special effect map, which can be composed of hardware and / or software and is generally integrated in a device with the function of generating a special effect map. This device can be an electronic device such as a server, a mobile terminal or a server cluster. As Figure 1 shown, the method specifically includes the following steps:

[0030] S110, perform scaling and / or translation transformation on the initial surface texture map of the 3D virtual fluid model to obtain at least one transformed surface texture map.

[0031] Among them, the 3D virtual fluid model can be understood as a 3D model constructed by simulating real fluids. The fluid can be a fluid object, such as a liquid. For example, the 3D virtual fluid model can be: a water column, a water surface. In this embodiment, the 3D virtual fluid model can be a water column simulating "tears". The initial surface map can be understood as a 2D map formed by unfolding the surface of the 3D virtual fluid model, that is, a UV map. For each pixel point in the initial surface map, the position information can be represented by a horizontal coordinate and a vertical coordinate, that is, (x, y).

[0032] Among them, performing scaling and / or translation transformation on the initial surface map of the 3D virtual fluid model can be understood as: scaling and / or translating the horizontal coordinates of each pixel point that makes up the initial surface map, and / or scaling and / or translating the vertical coordinates of each pixel point. In this embodiment, translating the coordinate can be understood as adding or subtracting a set value to the coordinate value; scaling the coordinate can be understood as scaling the coordinate value by a set multiple. Exemplarily, assuming that translating the horizontal coordinate can be expressed as: x±△x; assuming that scaling the horizontal coordinate can be expressed as: m*x, where m is the scaling multiple. The transformation of the initial surface map can be only translating the initial surface map, or only scaling the surface map, or translating first and then scaling, or scaling first and then translating. For the transformation of the horizontal coordinate and the vertical coordinate of each pixel point, it can be only transforming the horizontal coordinate, or only transforming the vertical coordinate, or both the horizontal coordinate and the vertical coordinate are transformed. In this embodiment, at least one transformation can be performed on the initial surface map to obtain at least one transformed surface map. In this embodiment, the way of transforming the initial surface map can be set by the user and is not limited here.

[0033] Optionally, the way of performing scaling and / or translation transformation on the initial surface map to obtain at least one transformed surface map can be: obtaining the time information corresponding to the current moment; based on the time information, performing at least one scaling and / or translation on the initial surface map to obtain at least one transformed surface map.

[0034] Among them, the time information can be understood as the time on the time axis corresponding to the dynamic special effect map. Performing at least one scaling and / or translation on the initial surface map based on the time information can be understood as: when determining the translation amount or scaling amount of the initial surface map, depending on the time information corresponding to the current moment. In this embodiment, each pixel point in the initial surface map is transformed according to the same translation amount or scaling amount, so that the initial surface map is scaled proportionally or translated as a whole during the transformation. Exemplarily, transforming the horizontal coordinate based on the time information can be expressed as: x + time; transforming the vertical coordinate based on the time information can be expressed as: (y + time) * m. In this embodiment, performing at least one scaling and / or translation on the initial surface map based on the time information can obtain an irregular flow pattern and improve the authenticity of the dynamic special effect map corresponding to the fluid.

[0035] Specifically, the process of performing at least one scaling and / or translation on the initial surface map based on the time information can be: performing at least one scaling and / or translation on the horizontal coordinates of the vertices in the initial surface map based on the time information; and / or, performing at least one scaling and / or translation on the vertical coordinates of the vertices in the initial surface map based on the time information.

[0036] Among them, the vertex can be understood as the pixel point that constitutes the surface of the 3D virtual fluid model. Performing at least one scaling and / or translation on the horizontal coordinates of the vertices in the initial surface map based on the time information can be understood as: for each pixel point that constitutes the surface of the 3D virtual fluid model, when determining the translation amount or scaling amount of the horizontal coordinate, depending on the time information corresponding to the current moment. Performing at least one scaling and / or translation on the vertical coordinates of the vertices in the initial surface map based on the time information can be understood as: when determining the translation amount or scaling amount of the vertical coordinate, depending on the time information corresponding to the current moment. Transforming the initial surface map based on the time information can be: only translating the initial surface map based on the time information, or only scaling the surface map based on the time information, or first translating and then scaling based on the time information, or first scaling and then translating based on the time information. Transforming the horizontal and vertical coordinates of each pixel point based on the time information can be: only transforming the horizontal coordinate based on the time information, or only transforming the vertical coordinate based on the time information, or transforming both the horizontal and vertical coordinates based on the time information. In this embodiment, the initial surface map can be transformed at least once based on the time information, so as to obtain at least one transformed surface map. In this embodiment, the way of transforming the initial surface map can be set by the user and is not limited here. In this embodiment, transforming the horizontal and / or vertical coordinates based on the time information can improve the accuracy of the transformation.

[0037] S120. Determine the offset of each vertex in the longitudinal axis direction according to the initial surface texture map and at least one transformed surface texture map.

[0038] Among them, the longitudinal axis is perpendicular to the plane where the surface texture map is located. The offsets of each vertex in the longitudinal axis direction can be the same or different. In this embodiment, a correspondence relationship between position information and offsets can be established. For the initial surface texture map, the first sub-offset of each vertex can be determined according to this correspondence relationship; for the transformed surface texture map, the second sub-offset of each offset vertex can be determined according to this correspondence relationship. Finally, the first sub-offset and the second sub-offset of the corresponding vertices in the initial surface texture map and the transformed surface texture map are weighted and summed to obtain the final offset of each vertex in the longitudinal axis direction.

[0039] Optionally, the method for determining the offset of each vertex in the longitudinal axis direction according to the initial surface texture map and at least one transformed surface texture map can be: sample the gray-scale information from the set noise map according to the coordinate information of each vertex in the initial surface texture map to obtain the first gray-scale map; sample the gray-scale information from the set noise map according to the coordinate information of each vertex in the transformed surface texture map to obtain at least one second gray-scale map; perform weighted summation on the gray-scale values of the corresponding pixel points in the first gray-scale map and at least one second gray-scale map to obtain the offset of each vertex in the longitudinal axis direction.

[0040] Among them, the set noise map can be any noise map. Sampling the gray-scale information from the set noise map according to the coordinate information of each vertex in the initial surface texture map can be understood as: for each vertex of the initial surface texture map, obtain the gray-scale value of the pixel point at the same coordinate information from the set noise map according to the coordinate information (x, y) of this vertex, so as to obtain the first gray-scale map corresponding to the initial surface texture map. Sampling the gray-scale information from the set noise map according to the coordinate information of each vertex in the transformed surface texture map can be understood as: for each vertex of the transformed surface texture map, obtain the gray-scale value of the pixel point at the same coordinate information from the set noise map according to the coordinate information of this vertex, so as to obtain the second gray-scale map corresponding to the transformed surface texture map. In this embodiment, the gray-scale value sampled from the set noise map is a normalized gray-scale value, that is, a number between 0 and 1. The process of performing weighted summation on the gray-scale values of the corresponding pixel points in the first gray-scale map and at least one second gray-scale map can be: determine the weights of the first gray-scale map and at least one second gray-scale map respectively, and perform weighted summation on the gray-scale values of the corresponding pixel points according to this weight to obtain the offset of each vertex in the longitudinal axis direction. For example: average the gray-scale values of the corresponding pixel points and use this average value as the offset of each vertex in the longitudinal axis direction. The solution of this embodiment samples the gray-scale information from the set noise map according to the vertex coordinate information to determine the offset in the longitudinal axis direction, which can improve the diversity of the simulated liquid flow mode.

[0041] S130. Move each vertex along the longitudinal axis according to the offset to obtain a static image of the 3D virtual fluid model after offset.

[0042] Specifically, after determining the offset of each vertex along the longitudinal axis, move each vertex along the longitudinal axis according to the offset, so that the 3D virtual fluid model presents an effect of "fluctuation".

[0043] Optionally, after moving each vertex along the longitudinal axis according to the offset, the following steps are further included: determining the principal tangent and the secondary tangent of each moved vertex; determining the normal based on the principal tangent and the secondary tangent; determining the lighting information corresponding to the moved vertex based on the normal; rendering each moved vertex based on the lighting information to obtain a static image of the 3D virtual fluid model after offset.

[0044] Among them, the principal tangent and the secondary tangent can be understood as the tangents of the surface of the 3D virtual fluid model at the vertex.

[0045] Specifically, determining the principal tangent and the secondary tangent of each moved vertex includes: for each moved vertex, obtaining the difference in offset between the vertex and its adjacent vertex in the vertical direction, and determining it as the first difference; and the difference in offset between the vertex and its adjacent vertex in the horizontal direction, and determining it as the second difference; obtaining the world coordinate information of the vertex and the viewing direction of the virtual camera; determining the intermediate direction according to the world coordinate information and the viewing direction; determining the positive tangent based on the intermediate direction, the viewing direction and the first difference; determining the secondary tangent based on the intermediate direction, the viewing direction and the second difference.

[0046] Among them, the vertical direction is the x direction, and the horizontal direction is the y direction. Assume that the interval between two adjacent vertices in the vertical direction is △x, and the interval between two adjacent vertices in the horizontal direction is △y. If the coordinates of the current vertex are (x, y), then the coordinates of its adjacent vertex in the vertical direction are (x + △x, y), and the coordinates of its adjacent vertex in the horizontal direction are (x, y + △y).

[0047] Specifically, the process of determining the intermediate direction according to the world coordinate information and the viewing direction can be: performing a partial derivative process on the world coordinate information, and taking the cross product of the vector corresponding to the world coordinate information after the partial derivative process and the viewing direction, so as to obtain the vector corresponding to the intermediate direction.

[0048] Specifically, the process of determining the tangent line based on the middle direction, the perspective direction, and the first difference can be as follows: Multiply the first difference by the vector corresponding to the perspective direction and then add the vector corresponding to the middle direction to obtain the vector corresponding to the tangent line. The process of determining the cotangent line based on the middle direction, the perspective direction, and the second difference can be as follows: Multiply the second difference by the vector corresponding to the perspective direction and then add the vector corresponding to the middle direction to obtain the vector corresponding to the cotangent line. The solution in this embodiment can improve the accuracy of determining the main tangent line and the cotangent line.

[0049] Specifically, the process of determining the normal line based on the main tangent line and the cotangent line can be as follows: Perform a cross product on the vector corresponding to the main tangent line and the vector corresponding to the cotangent line to obtain the vector corresponding to the normal line. In this embodiment, determining the lighting information based on the normal line can be based on any existing solution, which is not limited here. In this embodiment, rendering each vertex after movement based on the lighting information can make the 3D virtual fluid model more conform to the environment where the picture is located and improve the authenticity of the 3D virtual fluid model.

[0050] S140. Stitch and encode consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual model.

[0051] In this embodiment, by performing the above steps on the surface texture map of the 3D virtual fluid model at each moment, multiple consecutive static images can be obtained. Stitch and encode the consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual model. Thus, the effect of liquid flow can be simulated.

[0052] The technical solution of this embodiment performs scaling and / or translation transformation on the initial surface texture map of the 3D virtual fluid model to obtain at least one transformed surface texture map; determines the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map; wherein, the longitudinal axis is perpendicular to the plane where the surface texture map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model; moves each vertex along the longitudinal axis direction according to the offset to obtain a static image of the 3D virtual fluid model after offset; stitches and encodes the consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual model. The method for generating a special effect image provided by the embodiments of the present disclosure determines the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map, and moves each vertex along the longitudinal axis direction according to the offset, so that the generated dynamic special effect image has the effect of liquid flow and improves the authenticity of the liquid flow image.

[0053] Figure 2 is a schematic structural diagram of a device for generating a special effect image disclosed in the embodiments of the present disclosure. As Figure 2 shown, the device includes:

[0054] The transformation surface map acquisition module 210 is configured to perform scaling and / or translation transformation on the initial surface map of the 3D virtual fluid model to obtain at least one transformed surface map;

[0055] The offset determination module 220 is configured to determine the offset of each vertex along the longitudinal axis direction according to the initial surface map and at least one transformed surface map; wherein, the longitudinal axis is perpendicular to the plane where the surface map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model;

[0056] The static map acquisition module 230 is configured to move each vertex along the longitudinal axis direction according to the offset to obtain a static map of the 3D virtual fluid model after offset;

[0057] The dynamic special effect map acquisition module 240 is configured to splice and encode consecutive static maps to obtain a dynamic special effect map corresponding to the 3D virtual model.

[0058] Optionally, the transformation surface map acquisition module 210 is further configured to:

[0059] Obtain the time information corresponding to the current moment;

[0060] Perform at least one scaling and / or translation on the initial surface map based on the time information to obtain at least one transformed surface map.

[0061] Optionally, the transformation surface map acquisition module 210 is further configured to:

[0062] Perform at least one scaling and / or translation on the horizontal coordinates of each vertex in the initial surface map based on the time information; and / or,

[0063] Perform at least one scaling and / or translation on the vertical coordinates of each vertex in the initial surface map based on the time information.

[0064] Optionally, the offset determination module 220 is further configured to:

[0065] Sample the gray scale information from the set noise map according to the coordinate information of each vertex in the initial surface map to obtain a first gray scale map;

[0066] Sample the gray scale information from the set noise map according to the coordinate information of each vertex in the transformed surface map to obtain at least one second gray scale map;

[0067] Perform weighted summation on the gray scale values of the corresponding pixel points in the first gray scale map and at least one second gray scale map to obtain the offset of each vertex along the longitudinal axis direction.

[0068] Optionally, it further includes: a lighting information determination module, configured to:

[0069] Determine the main tangent and the secondary tangent of each vertex after movement;

[0070] Determine the normal based on the principal tangent and the secondary tangent;

[0071] Determine the lighting information corresponding to the moved vertex based on the normal;

[0072] Render each moved vertex based on the lighting information to obtain a static image after the offset of the 3D virtual fluid model.

[0073] Optionally, the lighting information determination module is further configured to:

[0074] For each moved vertex, obtain the difference between the offset of the vertex and the offset of its adjacent vertex in the vertical direction, and determine it as the first difference; and the difference between the offset of the vertex and the offset of its adjacent vertex in the horizontal direction, and determine it as the second difference;

[0075] Obtain the world coordinate information of the vertex and the viewing direction of the virtual camera;

[0076] Determine the intermediate direction based on the world coordinate information and the viewing direction;

[0077] Determine the principal tangent based on the intermediate direction, the viewing direction, and the first difference;

[0078] Determine the secondary tangent based on the intermediate direction, the viewing direction, and the second difference.

[0079] Optionally, the lighting information determination module is further configured to:

[0080] Multiply the first difference by the vector corresponding to the viewing direction and then add it to the vector corresponding to the intermediate direction to obtain the vector corresponding to the principal tangent;

[0081] Determine the secondary tangent based on the intermediate direction, the viewing direction, and the second difference, including:

[0082] Multiply the second difference by the vector corresponding to the viewing direction and then add it to the vector corresponding to the intermediate direction to obtain the vector corresponding to the secondary tangent.

[0083] The above device can execute the methods provided in all the foregoing embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects for executing the above methods. For technical details not described in detail in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the present disclosure.

[0084] Next, refer to Figure 3, which shows a schematic structural diagram of an electronic device 300 suitable for implementing the embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc., or various forms of servers, such as independent servers or server clusters. Figure 3 The electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.

[0085] As Figure 3 shown, the electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 301, which may perform various appropriate actions and processes according to the programs stored in the read-only storage device (ROM) 302 or the programs loaded from the storage device 308 into the random access storage device (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. The input / output (I / O) interface 305 is also connected to the bus 304.

[0086] Generally, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device 300 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 3 the electronic device 300 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be implemented or had alternatively.

[0087] Particularly, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the word recommendation method. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above functions defined in the methods of the embodiments of the present disclosure are executed.

[0088] It should be noted that the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0089] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0090] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist separately without being assembled into the electronic device.

[0091] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: scale and / or translate-transform an initial surface map of a 3D virtual fluid model to obtain at least one transformed surface map; determine an offset of each vertex in the longitudinal axis direction based on the initial surface map and the at least one transformed surface map; wherein, the longitudinal axis is perpendicular to the plane where the surface map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model; move each vertex in the longitudinal axis direction according to the offset to obtain a static map of the 3D virtual fluid model after offset; splice and encode consecutive static maps to obtain a dynamic special effect map corresponding to the 3D virtual model.

[0092] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof. The programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., by connecting through the Internet using an Internet service provider).

[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0094] The units involved in the embodiments of the present disclosure can be implemented in software or in hardware. Among them, the name of the unit does not constitute a limitation on the unit itself in some cases.

[0095] The functions described above herein can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGA), Application Specific Integrated Circuits (ASIC), Application Specific Standard Products (ASSP), System on a Chip (SOC), Complex Programmable Logic Devices (CPLD), and so on.

[0096] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, Random Access Memory (RAM), Read Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM or Flash Memory), optical fibers, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0097] According to one or more embodiments of the embodiments of the present disclosure, the embodiments of the present disclosure disclose a method for generating a special effect diagram, including:

[0098] Performing a scaling and / or translation transformation on an initial surface map of a 3D virtual fluid model to obtain at least one transformed surface map;

[0099] Determining the offset of each vertex in the longitudinal axis direction according to the initial surface map and the at least one transformed surface map; wherein, the longitudinal axis is perpendicular to the plane where the surface map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model;

[0100] Moving each vertex in the longitudinal axis direction according to the offset to obtain a static map of the 3D virtual fluid model after offset;

[0101] Stitching and encoding consecutive static maps to obtain a dynamic special effect diagram corresponding to the 3D virtual model.

[0102] Further, performing a scaling and / or translation transformation on the initial surface map to obtain at least one transformed surface map; including:

[0103] Obtain the time information corresponding to the current moment;

[0104] Perform at least one scaling and / or translation on the initial surface map based on the time information to obtain at least one transformed surface map.

[0105] Further, performing at least one scaling and / or translation on the initial surface map based on the time information includes:

[0106] Perform at least one scaling and / or translation on the horizontal coordinates of each vertex in the initial surface map based on the time information; and / or,

[0107] Perform at least one scaling and / or translation on the vertical coordinates of each vertex in the initial surface map based on the time information.

[0108] Further, determining the offset of each vertex in the longitudinal axis direction according to the initial surface map and the at least one transformed surface map includes:

[0109] Sample the grayscale information from the set noise map according to the coordinate information of each vertex in the initial surface map to obtain the first grayscale map;

[0110] Sample the grayscale information from the set noise map according to the coordinate information of each vertex in the transformed surface map to obtain at least one second grayscale map;

[0111] Perform weighted summation on the grayscale values of the corresponding pixel points in the first grayscale map and the at least one second grayscale map to obtain the offset of each vertex in the longitudinal axis direction.

[0112] Further, after moving each vertex along the longitudinal axis direction according to the offset, it further includes:

[0113] Determine the principal tangent and the secondary tangent of each moved vertex;

[0114] Determine the normal according to the principal tangent and the secondary tangent;

[0115] Determine the lighting information corresponding to the moved vertex based on the normal;

[0116] Render each moved vertex based on the lighting information to obtain the static map of the offset 3D virtual fluid model.

[0117] Further, determining the principal tangent and the secondary tangent of each moved vertex includes:

[0118] For each moved vertex, obtain the difference between the offset between the vertex and its vertically adjacent vertex, and determine it as the first difference; and the difference between the offset between the vertex and its horizontally adjacent vertex, and determine it as the second difference;

[0119] Obtain the world coordinate information of the vertex and the viewing direction of the virtual camera;

[0120] Determine an intermediate direction based on the world coordinate information and the viewing direction;

[0121] Determine a tangent based on the intermediate direction, the viewing direction, and the first difference;

[0122] Determine a cotangent based on the intermediate direction, the viewing direction, and the second difference.

[0123] Further, determining a tangent based on the intermediate direction, the viewing direction, and the first difference includes:

[0124] Multiply the first difference by the vector corresponding to the viewing direction and then add the vector corresponding to the intermediate direction to obtain the vector corresponding to the tangent;

[0125] Determining a cotangent based on the intermediate direction, the viewing direction, and the second difference includes:

[0126] Multiply the second difference by the vector corresponding to the viewing direction and then add the vector corresponding to the intermediate direction to obtain the vector corresponding to the cotangent.

[0127] Note that the above is only the preferred embodiment of the present disclosure and the technical principles applied. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments described here. Various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present disclosure. Therefore, although the present disclosure has been described in more detail through the above embodiments, the present disclosure is not limited to the above embodiments. Without departing from the concept of the present disclosure, more other equivalent embodiments can be included, and the scope of the present disclosure is determined by the scope of the appended claims.

Claims

1. A method for generating a special effect image, characterized in that, it includes: Performing scaling and / or translation transformation on the initial surface texture map of the 3D virtual fluid model to obtain at least one transformed surface texture map; The initial surface texture map is a 2D map formed by unfolding the surface of the 3D virtual fluid model; Determining the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map; wherein, the longitudinal axis is perpendicular to the plane where the surface texture map is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model; Moving each vertex along the longitudinal axis direction according to the offset to obtain a static image of the offset 3D virtual fluid model; Stitching and encoding consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual fluid model; Among them, performing scaling and / or translation transformation on the initial surface texture map to obtain at least one transformed surface texture map includes: Obtaining the time information corresponding to the current moment; Performing at least one scaling and / or translation on the initial surface texture map based on the time information to obtain at least one transformed surface texture map; Determining the offset of each vertex along the longitudinal axis direction according to the initial surface texture map and the at least one transformed surface texture map includes: Sampling gray-scale information from a set noise map according to the coordinate information of each vertex in the initial surface texture map to obtain a first gray-scale map; Sampling gray-scale information from the set noise map according to the coordinate information of each vertex in the transformed surface texture map to obtain at least one second gray-scale map; Performing weighted summation on the gray-scale values of corresponding pixel points in the first gray-scale map and the at least one second gray-scale map to obtain the offset of each vertex along the longitudinal axis direction.

2. The method according to claim 1, characterized in that, Performing at least one scaling and / or translation on the initial surface texture map based on the time information includes: Performing at least one scaling and / or translation on the horizontal coordinates of each vertex in the initial surface texture map based on the time information; and / or, Performing at least one scaling and / or translation on the vertical coordinates of each vertex in the initial surface texture map based on the time information.

3. The method according to claim 1, characterized in that, After moving each vertex along the longitudinal axis direction according to the offset, it further includes: Determining the main tangent and the secondary tangent of each moved vertex; Determining the normal according to the main tangent and the secondary tangent; Determining the lighting information corresponding to the moved vertex based on the normal; Rendering each moved vertex based on the lighting information to obtain a static image of the offset 3D virtual fluid model.

4. The method according to claim 3, characterized in that, Determining the main tangent and the secondary tangent of each moved vertex includes: For each moved vertex, obtaining the difference between the offset of the vertex and its adjacent vertex in the vertical direction as the first difference; and the difference between the offset of the vertex and its adjacent vertex in the horizontal direction as the second difference; Obtaining the world coordinate information of the vertex and the viewing direction of the virtual camera; Determining the intermediate direction according to the world coordinate information and the viewing direction; Determine the tangent line based on the intermediate direction, the viewing direction, and the first difference; Determine the cotangent line based on the intermediate direction, the viewing direction, and the second difference.

5. The method according to claim 4, wherein, Determining the tangent line based on the intermediate direction, the viewing direction, and the first difference includes: Multiplying the first difference by the vector corresponding to the viewing direction and then adding the vector corresponding to the intermediate direction to obtain the vector corresponding to the tangent line; Determining the cotangent line based on the intermediate direction, the viewing direction, and the second difference includes: Multiplying the second difference by the vector corresponding to the viewing direction and then adding the vector corresponding to the intermediate direction to obtain the vector corresponding to the cotangent line.

6. An apparatus for generating a special effect image, wherein, comprising: A transformed surface texture acquisition module for performing scaling and / or translation transformation on the initial surface texture of a 3D virtual fluid model to obtain at least one transformed surface texture; The initial surface texture is a 2D map formed by unfolding the surface of the 3D virtual fluid model; An offset determination module for determining the offset of each vertex along the longitudinal axis direction according to the initial surface texture and the at least one transformed surface texture; wherein, the longitudinal axis is perpendicular to the plane where the surface texture is located; the vertex is a pixel point constituting the surface of the 3D virtual fluid model; A static image acquisition module for moving each vertex along the longitudinal axis direction according to the offset to obtain a static image of the offset 3D virtual fluid model; A dynamic special effect image acquisition module for splicing and encoding consecutive static images to obtain a dynamic special effect image corresponding to the 3D virtual fluid model; wherein, the transformed surface texture acquisition module is further configured to: Obtain the time information corresponding to the current moment; Perform at least one scaling and / or translation on the initial surface texture based on the time information to obtain at least one transformed surface texture; The offset determination module is further configured to: Sample the gray scale information from a set noise map according to the coordinate information of each vertex in the initial surface texture to obtain a first gray scale map; Sample the gray scale information from the set noise map according to the coordinate information of each vertex in the transformed surface texture to obtain at least one second gray scale map; Perform weighted summation on the gray scale values of the corresponding pixel points in the first gray scale map and the at least one second gray scale map to obtain the offset of each vertex along the longitudinal axis direction.

7. An electronic device, wherein, The electronic device includes: One or more processing devices; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the special effect image generation method as described in any one of claims 1-5.

8. A computer-readable medium, on which a computer program is stored, wherein, When the program is executed by a processing device, it implements the special effect image generation method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Virtual model rendering method and device, storage medium and electronic equipment

    CN109685869A

  • A method and device for realizing the virtual fluid in a three-dimensional space, a medium and an electronic device

    CN109887063A