CN114359081A - Liquid material dissolving method, device, electronic equipment and storage medium - Google Patents

Liquid material dissolving method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114359081A
CN114359081A CN202111599759.2A CN202111599759A CN114359081A CN 114359081 A CN114359081 A CN 114359081A CN 202111599759 A CN202111599759 A CN 202111599759A CN 114359081 A CN114359081 A CN 114359081A
Authority
CN
China
Prior art keywords
gray value
offset
liquid material
value
noise map
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.)
Pending
Application number
CN202111599759.2A
Other languages
Chinese (zh)
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202111599759.2A priority Critical patent/CN114359081A/en
Publication of CN114359081A publication Critical patent/CN114359081A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The present disclosure provides a method and an apparatus for dissolving a liquid material, an electronic device, and a storage medium, including: acquiring a liquid material and a noise map, and correlating the transparency of the liquid material with the gray value of the noise map; carrying out smooth transition processing on the noise map by a smooth step function, and extracting a gray value as an initial gray value; performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information; inputting the offset gray scale information into a texture sampler to obtain an output dissolving effect normal map; fusing the normal mapping of the dissolution effect with the original normal mapping of the liquid material; and the dissolution of the liquid material is realized by controlling a smooth step function. This disclosure can realize the dissolution of liquid material belt thickness under the prerequisite that the influence to the performance is less.

Description

Liquid material dissolving method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer animation technology, and in particular, to a method and an apparatus for dissolving a liquid material, an electronic device, and a storage medium.
Background
This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
In the technical field of computer animation, particularly in the game development process, the thickness treatment of the dissolution edge is a difficult problem when the dissolution effect of liquid substances is made. The prior art scheme is to respectively render the natural color and the normal line into a sequence frame, and then play the sequence frame through the material to realize the dissolving effect of the liquid material with the thickness.
Disclosure of Invention
In view of the above technical problems, there is a need for an improved solution that can dissolve the thickness of a liquid material tape with less influence on performance.
In view of the above, an exemplary embodiment of the present disclosure provides a method for dissolving a liquid material, including:
acquiring a target liquid material and a noise map with the same size as the target liquid material, and associating the transparency of the target liquid material with the gray value of the noise map;
carrying out smooth transition processing on the noise map by a smooth step function, and extracting a gray value of the noise map after smooth transition as an initial gray value;
performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information;
inputting the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler;
fusing the normal mapping of the dissolution effect with the original normal mapping of the target liquid material;
and controlling the smooth step function to realize the dissolution of the target liquid material.
In some exemplary embodiments, the transparency of the target liquid material is the transparency of pixel points in the target liquid material; the gray value of the noise map is the gray value of a pixel point in the noise map;
associating the transparency of the target liquid material with the gray value of the noise map specifically comprises:
and for the pixel point in the target liquid material, the transparency value of the pixel point is the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map.
In some exemplary embodiments, the smooth step function includes a maximum parameter and a minimum parameter;
the performing smooth transition processing on the noise map by using a smooth step function specifically includes:
for a pixel point in the noise mapping, responding to the fact that the gray value of the pixel point is larger than the maximum value parameter, and enabling the gray value of the pixel point to be the maximum gray value; and responding to the fact that the gray value of the pixel point is smaller than the minimum value parameter, and enabling the gray value of the pixel point to be the minimum gray value.
In some exemplary embodiments, the offset gray scale information includes first offset gray scale information and second offset gray scale information;
the offset reorganizing is performed on the noise map after the smooth transition, the gray value of the noise map after the offset reorganization is extracted to serve as an offset gray value, and the initial gray value is subtracted from the offset gray value to obtain offset gray information, and the method specifically includes:
shifting the noise map after the smooth transition by a first preset distance along the horizontal axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a first shift noise map, extracting the gray value of the first shift noise map as a first shift gray value, and subtracting the initial gray value from the first shift gray value to obtain first shift gray information;
shifting the noise map after the smooth transition by a second preset distance along the vertical axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a second shift noise map, extracting the gray value of the second shift noise map as a second shift gray value, and subtracting the initial gray value from the second shift gray value to obtain second shift gray information.
In some exemplary embodiments, the first preset distance is equal to the second preset distance.
In some exemplary embodiments, the texture sampler includes an r channel, a g channel, and a b channel therein;
inputting the offset gray scale information into a texture sampler to obtain a normal map of a dissolving effect output by the texture sampler, specifically comprising:
inputting the first offset gray scale information into the r channel of the texture sampler;
inputting the second offset gray scale information into the g channel of the texture sampler;
and multiplying the first offset gray information and the second offset gray information by a thickness parameter respectively, inputting the multiplied values into the channel b of the texture sampler, and performing cross multiplication.
In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material may be controlled.
In some exemplary embodiments, the fusing the normal map of the dissolution effect with the normal map of the target liquid material specifically includes:
adding one to the value of the r channel, the value of the g channel and the value of the b channel of the original normal line mapping as a first three-dimensional vector;
multiplying the value of the r channel of the dissolving effect normal map by a minus one, and multiplying the value of the g channel by the values of the minus one and the b channel to serve as a second three-dimensional vector;
performing point multiplication on the first three-dimensional vector and the second three-dimensional vector to obtain a point multiplication value;
multiplying the point product value with the first three-dimensional vector to obtain a first rgb value;
adding one to the value of the b channel of the original normal line mapping and multiplying the value by the second three-dimensional vector to obtain a second rgb value;
and subtracting the second rgb value from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map.
In some exemplary embodiments, the controlling the smooth step function to achieve dissolution of the target liquid material specifically includes:
and realizing the dissolution of the target liquid material by controlling the minimum parameter of the smooth step function to be gradually increased.
Based on the same inventive concept, the exemplary embodiment of the present disclosure further provides a liquid material dissolving device, including:
the noise map correlation module is configured to acquire a target liquid material and a noise map with the same size as the target liquid material, and correlate the transparency of the target liquid material with the gray value of the noise map;
the initial gray value acquisition module is configured to perform smooth transition processing on the noise map through a smooth step function, and extract the gray value of the noise map after smooth transition as an initial gray value;
an offset gray information obtaining module configured to perform offset reorganization on the noise map after the smooth transition, extract a gray value of the noise map after the offset reorganization as an offset gray value, and subtract the initial gray value from the offset gray value to obtain offset gray information;
a dissolving effect normal map obtaining module configured to input the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler;
a normal map fusion module configured to fuse the dissolution effect normal map with an original normal map of the target liquid material;
a dissolution effect generation module configured to achieve dissolution of the target liquid material by controlling the smooth step function.
Based on the same inventive concept, the exemplary embodiments of the present disclosure also provide an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the method as described in any one of the above is implemented.
Based on the same inventive concept, the disclosed exemplary embodiments also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described in any one of the above.
As can be seen from the above, the method, the apparatus, the electronic device and the storage medium for dissolving a liquid material provided in the embodiments of the present disclosure include: acquiring a target liquid material and a noise map with the same size as the target liquid material, and associating the transparency of the target liquid material with the gray value of the noise map; carrying out smooth transition processing on the noise map by a smooth step function, and extracting the gray value of the noise map after smooth transition as an initial gray value; performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information; inputting the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler; fusing the normal mapping of the dissolution effect with the original normal mapping of the target liquid material; and the dissolution of the target liquid material is realized by controlling the smooth step function. The method realizes the liquid dissolving effect by controlling the noise map, does not need to consider the influence of the frame rate, and can realize the dissolution of the liquid material under the premise of less influence on the performance. Furthermore, the thickness of the liquid material belt can be dissolved by fusing the constructed dissolving effect normal line map and the original normal line map.
Drawings
In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of an application scenario provided in accordance with an embodiment of the present disclosure;
fig. 2 is a schematic flow chart illustrating a method for dissolving a liquid material according to an embodiment of the disclosure;
FIG. 3 is a schematic view of a liquid material provided according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a noise map provided in accordance with an embodiment of the present disclosure;
FIG. 5 is a schematic illustration of a liquid material being dissolved without thickness according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of offset gray scale information provided according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of an offset gray scale information input texture sampler provided in accordance with an embodiment of the present disclosure;
FIG. 8 is a schematic illustration of thickness dissolution of a liquid material ribbon provided in accordance with an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a liquid material dissolving device according to an embodiment of the disclosure;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more clearly apparent, the principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are presented only to enable those skilled in the art to better understand and to implement the present disclosure, and are not intended to limit the scope of the present application in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
According to an embodiment of the present disclosure, a method and an apparatus for dissolving a liquid material, an electronic device, and a storage medium are provided.
In this document, it is to be understood that any number of elements in the figures are provided by way of illustration and not limitation, and any nomenclature is used for differentiation only and not in any limiting sense.
It is to be noted that technical terms or scientific terms used in the embodiments of the present disclosure should have a general meaning as understood by those having ordinary skill in the art to which the present disclosure belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the disclosure is not intended to indicate any order, quantity, or importance, but rather to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
The principles and spirit of the present application are explained in detail below with reference to several representative embodiments of the present application.
In the related art, when the dissolution effect of the thickness of the liquid material tape is achieved, the influence on the performance is large.
The inventors of the present disclosure found that the reason why the above-described related art has a large influence on the performance is that: in the related art, the natural color and the normal are respectively rendered into sequence frames (the sequence frames: a moving video is represented by an image file of one frame by one frame), then the sequence frames are played through the material to realize the dissolving effect of the liquid material with the thickness, in order to make the dissolving effect look smooth and real, the realization scheme needs more intermediate frames, however, the more the intermediate frames are, the larger the picture is, and the larger the picture is, the larger the influence on the performance is. Reducing the number of intermediate frames affects the smoothness of the dissolution effect.
In order to solve the above problem, the present application provides a solution for dissolving a liquid material, which specifically includes:
acquiring a target liquid material and a noise map with the same size as the target liquid material, and associating the transparency of the target liquid material with the gray value of the noise map; carrying out smooth transition processing on the noise map by a smooth step function, and extracting a gray value of the noise map after smooth transition as an initial gray value; performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information; inputting the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler; fusing the normal mapping of the dissolution effect with the original normal mapping of the target liquid material; and controlling the smooth step function to realize the dissolution of the target liquid material. According to the method, an intermediate frame is not needed, so that the thickness of the liquid material belt can be dissolved on the premise of less influence on performance.
Having described the basic principles of the present application, various non-limiting embodiments of the present application are described in detail below.
Referring to fig. 1, it is a schematic view of an application scenario of the liquid material dissolving method according to the embodiment of the present disclosure. The application scenario includes a terminal device 101, a server 102, and a data storage system 103. The terminal device 101, the server 102, and the data storage system 103 may be connected through a wired or wireless communication network. The terminal device 101 includes, but is not limited to, a desktop computer, a mobile phone, a mobile computer, a tablet computer, a media player, a smart wearable device, a Personal Digital Assistant (PDA), or other electronic devices capable of implementing the above functions. The server 102 and the data storage system 103 may be independent physical servers, may also be a server cluster or distributed system formed by a plurality of physical servers, and may also be cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and big data and artificial intelligence platforms.
The server 102 is used for providing a liquid material dissolving service for a user of the terminal device 101, a client communicated with the server 102 is installed in the terminal device 101, the user can input material and thickness parameters of liquid to be dissolved through the client, after clicking a determination button, the client sends the material and thickness parameters of the liquid to be dissolved to the server 102, the server 102 takes the material of the liquid to be dissolved as a target liquid material, obtains a noise map with the size equal to that of the target liquid material, and associates the transparency of the target liquid material with the gray value of the noise map; carrying out smooth transition processing on the noise map by a smooth step function, and extracting the gray value of the noise map after smooth transition as an initial gray value; performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information; inputting the offset gray scale information into a texture sampler (the thickness parameter acts on the texture sampler) to obtain a dissolving effect normal map output by the texture sampler; fusing the normal mapping of the dissolution effect with the original normal mapping of the target liquid material; and the dissolution of the target liquid material is realized by controlling the smooth step function.
The data storage system 103 is used to store data.
The following describes a solution of a liquid material according to an exemplary embodiment of the present disclosure with reference to an application scenario of fig. 1. It should be noted that the above application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. Rather, embodiments of the present disclosure may be applied to any scenario where applicable.
Referring to fig. 2, a schematic flow chart of a method for dissolving a liquid material according to an embodiment of the disclosure is shown.
The liquid material dissolving method comprises the following steps:
step S210, obtaining a target liquid material and a noise map with the same size as the target liquid material, and associating the transparency of the target liquid material with the gray value of the noise map.
Wherein, the liquid material is a material, and the noise map is a map.
In the field of Computer Graphics (CG), materials include maps (Map) and maps include textures (Texture). Texture is the most basic unit of data input and mapping is used to map texture to the surface of a 3D object by UV coordinates. The map also contains other information besides texture, such as UV coordinates, map input output control, etc. Where U and V are used to represent the horizontal and vertical axes of a 2D space, since X, Y and Z have been used in a 3D space. The texture is a data set, and the main function is to provide data and illumination algorithms for the renderer. The maps are part of data, and may be classified into different types according to the application, such as Diffuse reflection maps (Diffuse maps), Specular maps (Specular maps), Normal maps (Normal maps), Gloss maps (Gloss maps), and the like.
Referring to fig. 3, a schematic diagram of a liquid material according to an embodiment of the disclosure is shown. Wherein, the light part is the liquid part, and dark part is the background, and liquid dissolves, and the light part disappears gradually, and its essence lets some pixels show, and some pixels disappear.
Reference is made to fig. 4, which is a schematic diagram of a noise map provided in accordance with an embodiment of the present disclosure. The noise map is a black-white map, wherein only two colors of black and white exist, and the black and white degree of each pixel point in the noise map can be represented by a value between 0 and 1, which can be called as a gray value.
In some exemplary embodiments, the noise map may be randomly generated. The gray value of each pixel point is a random number between 0 and 1, and each random number is discrete and has no relation with each other.
In some exemplary embodiments, the noise map may be set to be generated. The space is naturally continuous by filling gaps in the discrete data through a function interpolation method through continuous processing, namely interpolation. The interpolation function may be a trigonometric function, a normal distribution, a spline curve, and the like.
Reference is now made to FIG. 5, which is a schematic illustration of a liquid material without thickness dissolution provided in accordance with an embodiment of the present disclosure.
In some exemplary embodiments, associating the transparency of the target liquid material with the gray value of the noise map specifically includes:
and for the pixel point in the target liquid material, the transparency value of the pixel point is the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map.
The liquid material has transparency property, and is completely transparent and invisible (dissolved) when the transparency is 0, and is completely opaque (undissolved) when the transparency is 1. And associating the gray value of the noise map with the transparency of the liquid material, wherein the transparency value of each pixel point in the liquid material is the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map, and establishing the relation between the liquid material and the noise map, so that the transparency of the liquid material is controlled by controlling the gray value of the noise map, and the dissolving effect of the liquid material is realized. Specifically, the gray value is gradually reduced, the transparency is gradually 0, and each pixel point is gradually transparent and invisible until the transparency is 0, and each pixel point is completely transparent and invisible, so that the effect of completely dissolving the liquid is presented.
Different noise maps are adopted, different dissolving effects can be achieved, liquid can be dissolved randomly according to the randomly generated noise maps, and the liquid can be dissolved according to the set rules of the generated noise maps.
The liquid dissolving effect is realized by controlling the noise map, the influence of a frame rate is not required to be considered, and the dissolving of the liquid material can be realized on the premise of less influence on the performance. However, the effect is not three-dimensional in a plane, and the effect of the liquid having a thickness cannot be expressed in terms of the expression.
Step S220, carrying out smooth transition processing on the noise map through a smooth step function, and extracting the gray value of the noise map after smooth transition as an initial gray value.
In some exemplary embodiments, the smooth step function includes a maximum parameter and a minimum parameter;
performing smooth transition processing on the noise map through a smooth step function, specifically comprising:
for a pixel point in the noise mapping, responding to the fact that the gray value of the pixel point is larger than the maximum value parameter, and enabling the gray value of the pixel point to be the maximum gray value; and responding to the condition that the gray value of the pixel point is smaller than the minimum value parameter, and enabling the gray value of the pixel point to be the minimum gray value.
As an example, the maximum gray-scale value is 1 and the minimum gray-scale value is 0.
In specific implementation, the minimum value parameter of the smooth step function is controlled to gradually increase, so that the gray value is gradually reduced, the transparency is gradually 0, and each pixel point is gradually transparent and invisible until the transparency is 0, and each pixel point is completely transparent and invisible, so that the effect of completely dissolving liquid is presented.
In some exemplary embodiments, the gray values of the noise map are extracted by a texture sampler.
And the texture sampler can split the texture, acquire gray values of four channels of RGBA and acquire uv information of the texture. Where RGBA is a color space representing Red (Red) Green (Green) Blue (Blue) and Alpha (opacity).
And step S230, performing offset reorganization on the noise map after the smooth transition, extracting the gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information.
Referring to fig. 6, a schematic diagram of offset gray scale information provided according to an embodiment of the present disclosure is shown.
In some exemplary embodiments, the offset gray scale information includes first offset gray scale information and second offset gray scale information;
performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information, which specifically comprises the following steps:
shifting the noise map after smooth transition by a first preset distance along the horizontal axis direction, moving the part which exceeds the original boundary of the noise map after shifting to the other side of the noise map to obtain a first shifted noise map, extracting the gray value of the first shifted noise map as a first shifted gray value, and subtracting the initial gray value from the first shifted gray value to obtain first shifted gray information;
and shifting the noise map after the smooth transition by a second preset distance along the vertical axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a second shift noise map, extracting the gray value of the second shift noise map as a second shift gray value, and subtracting the initial gray value from the second shift gray value to obtain second shift gray information.
In some exemplary embodiments, the first preset distance is equal to the second preset distance.
The offset reorganization refers to shifting the image by a defined number of pixels, and shifting any pixel outside the boundary of the original image to the other side of the image to fill the gap generated by the shifting image, so that any part of the image is not lost.
And step S240, inputting the offset gray scale information into the texture sampler to obtain a dissolving effect normal map output by the texture sampler.
Reference is made to fig. 7, which is a schematic diagram of an offset gray scale information input texture sampler provided according to an embodiment of the present disclosure.
In some exemplary embodiments, the texture sampler includes an r channel, a g channel, and a b channel;
inputting the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler, and specifically comprising the following steps:
inputting the first offset gray scale information into an r channel of a texture sampler;
inputting the second offset gray scale information into a g channel of the texture sampler;
and multiplying the first offset gray information and the second offset gray information by the thickness parameter respectively, inputting the multiplied values into a channel b of the texture sampler, and performing cross multiplication.
In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material may be controlled.
In specific implementation, the thickness parameter is matched with the thickness of the liquid material.
And step S250, fusing the normal mapping of the dissolving effect with the original normal mapping of the target liquid material.
In some exemplary embodiments, fusing the normal map of the dissolution effect with the original normal map of the target liquid material specifically includes:
adding one to the value of the r channel, the value of the g channel and the value of the b channel of the original normal line mapping as a first three-dimensional vector;
multiplying the value of the r channel of the dissolving effect normal map by a minus one, and multiplying the value of the g channel by the values of the minus one and the b channel to be used as a second three-dimensional vector;
performing point multiplication on the first three-dimensional vector and the second three-dimensional vector to obtain a point multiplication value;
multiplying the point multiplication value by the first three-dimensional vector to obtain a first rgb value;
adding one to the value of the b channel of the original normal line mapping and multiplying the value by a second three-dimensional vector to obtain a second rgb value;
and subtracting the second rgb value from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map.
And step S260, dissolving the target liquid material by controlling the smooth step function.
In some exemplary embodiments, the dissolving of the target liquid material is achieved by controlling a smooth step function, which specifically includes:
and the dissolution of the target liquid material is realized by controlling the minimum value parameter of the smooth step function to be gradually increased.
Reference is now made to fig. 8, which is a schematic illustration of thickness dissolution of a liquid material strip provided in accordance with an embodiment of the present disclosure.
In specific implementation, the thickness of the dissolution edge of the target liquid material is controlled by controlling the thickness parameter; the minimum value parameter of the smooth step function is controlled to be gradually increased, so that the gray value is gradually reduced, the transparency is gradually 0, each pixel point is gradually transparent and invisible until the transparency is 0, and each pixel point is completely transparent and invisible, so that the effect of completely dissolving liquid is presented.
As can be seen from the above, the liquid material dissolving method, the apparatus, the electronic device and the storage medium provided in the embodiments of the present disclosure achieve the liquid dissolving effect by controlling the noise map, do not need to consider the influence of the frame rate, and can achieve the dissolution of the liquid material on the premise of having a small influence on the performance. Furthermore, the thickness of the liquid material belt can be dissolved by fusing the constructed dissolving effect normal line map and the original normal line map.
It should be noted that the method of the embodiments of the present disclosure may be executed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the devices may interact with each other to complete the method.
It should be noted that the above describes some embodiments of the disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Based on the same inventive concept, the disclosure also provides a liquid material dissolving device corresponding to the method of any embodiment.
Referring to fig. 9, the liquid material dissolving apparatus includes:
a noise map association module 910 configured to obtain a target liquid material and a noise map having a size equal to the target liquid material, and associate transparency of the target liquid material with a gray value of the noise map.
And an initial gray value obtaining module 920, configured to perform smooth transition processing on the noise map through a smooth step function, and extract a gray value of the noise map after smooth transition as an initial gray value.
The offset gray scale information obtaining module 930 is configured to perform offset reorganization on the noise map after the smooth transition, extract a gray scale value of the noise map after the offset reorganization as an offset gray scale value, and subtract the initial gray scale value from the offset gray scale value to obtain offset gray scale information.
And a dissolving effect normal map obtaining module 940, configured to input the offset gray scale information into the texture sampler to obtain a dissolving effect normal map output by the texture sampler.
A normal map fusion module 950 configured to fuse the dissolution effect normal map with an original normal map of the target liquid material.
A dissolution effect generation module 960 configured to effect dissolution of the target liquid material by controlling the smooth step function.
In some exemplary embodiments, the noise map association module 910 is specifically configured to:
and for the pixel point in the target liquid material, the transparency value of the pixel point is the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map.
In some exemplary embodiments, the smooth step function includes a maximum parameter and the minimum parameter; the initial gray value obtaining module 920 is specifically configured to:
for a pixel point in the noise mapping, responding to the fact that the gray value of the pixel point is larger than the maximum value parameter, and enabling the gray value of the pixel point to be the maximum gray value; and responding to the fact that the gray value of the pixel point is smaller than the minimum value parameter, and enabling the gray value of the pixel point to be the minimum gray value.
In some exemplary embodiments, the offset gray scale information includes first offset gray scale information and second offset gray scale information; the offset gray scale information obtaining module 930 is specifically configured to:
shifting the noise map after the smooth transition by a first preset distance along the horizontal axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a first shift noise map, extracting the gray value of the first shift noise map as a first shift gray value, and subtracting the initial gray value from the first shift gray value to obtain first shift gray information;
shifting the noise map after the smooth transition by a second preset distance along the vertical axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a second shift noise map, extracting the gray value of the second shift noise map as a second shift gray value, and subtracting the initial gray value from the second shift gray value to obtain second shift gray information.
In some exemplary embodiments, the first preset distance is equal to the second preset distance.
In some exemplary embodiments, the texture sampler includes an r channel, a g channel, and a b channel therein; the dissolving effect normal map obtaining module 940 is specifically configured to:
inputting the first offset gray scale information into the r channel of the texture sampler;
inputting the second offset gray scale information into the g channel of the texture sampler;
and multiplying the first offset gray information and the second offset gray information by a thickness parameter respectively, inputting the multiplied values into the channel b of the texture sampler, and performing cross multiplication.
In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material may be controlled.
In some exemplary embodiments, the normal map fusion module 950 is specifically configured to:
adding one to the value of the r channel, the value of the g channel and the value of the b channel of the original normal line mapping as a first three-dimensional vector;
multiplying the value of the r channel of the dissolving effect normal map by a minus one, and multiplying the value of the g channel by the values of the minus one and the b channel to serve as a second three-dimensional vector;
performing point multiplication on the first three-dimensional vector and the second three-dimensional vector to obtain a point multiplication value;
multiplying the point product value with the first three-dimensional vector to obtain a first rgb value;
adding one to the value of the b channel of the original normal line mapping and multiplying the value by the second three-dimensional vector to obtain a second rgb value;
and subtracting the second rgb value from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map.
In some exemplary embodiments, the dissolution effect generation module 960 is specifically configured to:
and the dissolution of the target liquid material is realized by controlling the minimum value parameter of the smooth step function to be gradually increased.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations of the present disclosure.
The device of the above embodiment is used to implement the corresponding liquid material dissolving method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to the method of any embodiment described above, the present disclosure further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the method for dissolving a liquid material according to any embodiment described above is implemented.
Fig. 10 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the above embodiment is used to implement the corresponding liquid material dissolving method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above embodiments, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the liquid material dissolving method according to any of the above embodiments.
The non-transitory computer readable storage medium may be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs)), etc.
The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the liquid material dissolving method according to any one of the above exemplary method embodiments, and have the beneficial effects of the corresponding method embodiments, which are not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, method or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.) or a combination of hardware and software, and is referred to herein generally as a "circuit," module "or" system. Furthermore, in some embodiments, the invention may also be embodied in the form of a computer program product in one or more computer-readable media having computer-readable program code embodied in the medium.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive example) of the computer readable storage medium may include, for example: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the 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 the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable medium produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
Use of the verbs "comprise", "comprise" and their conjugations in this application does not exclude the presence of elements or steps other than those stated in this application. The article "a" or "an" preceding an element does not exclude the presence of a plurality of such elements.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

Claims (12)

1. A method for dissolving a liquid material, comprising:
acquiring a target liquid material and a noise map with the same size as the target liquid material, and associating the transparency of the target liquid material with the gray value of the noise map;
carrying out smooth transition processing on the noise map by a smooth step function, and extracting a gray value of the noise map after smooth transition as an initial gray value;
performing offset reorganization on the noise map after the smooth transition, extracting a gray value of the noise map after the offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value to obtain offset gray information;
inputting the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler;
fusing the normal mapping of the dissolution effect with the original normal mapping of the target liquid material;
and controlling the smooth step function to realize the dissolution of the target liquid material.
2. The method of claim 1, wherein the transparency of the target liquid material is the transparency of pixel points in the target liquid material; the gray value of the noise map is the gray value of a pixel point in the noise map;
associating the transparency of the target liquid material with the gray value of the noise map specifically comprises:
and for the pixel point in the target liquid material, the transparency value of the pixel point is the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map.
3. The method of claim 1, wherein the smooth step function includes a maximum parameter and a minimum parameter;
the performing smooth transition processing on the noise map by using a smooth step function specifically includes:
for a pixel point in the noise mapping, responding to the fact that the gray value of the pixel point is larger than the maximum value parameter, and enabling the gray value of the pixel point to be the maximum gray value; and responding to the fact that the gray value of the pixel point is smaller than the minimum value parameter, and enabling the gray value of the pixel point to be the minimum gray value.
4. The method of claim 1, wherein the offset grayscale information includes first offset grayscale information and second offset grayscale information;
the offset reorganizing is performed on the noise map after the smooth transition, the gray value of the noise map after the offset reorganization is extracted to serve as an offset gray value, and the initial gray value is subtracted from the offset gray value to obtain offset gray information, and the method specifically includes:
shifting the noise map after the smooth transition by a first preset distance along the horizontal axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a first shift noise map, extracting the gray value of the first shift noise map as a first shift gray value, and subtracting the initial gray value from the first shift gray value to obtain first shift gray information;
shifting the noise map after the smooth transition by a second preset distance along the vertical axis direction, moving the part which exceeds the original boundary of the noise map after the shift to the other side of the noise map to obtain a second shift noise map, extracting the gray value of the second shift noise map as a second shift gray value, and subtracting the initial gray value from the second shift gray value to obtain second shift gray information.
5. The method of claim 4, wherein the first predetermined distance is equal to the second predetermined distance.
6. The method of claim 4, wherein the texture sampler comprises an r channel, a g channel, and a b channel;
inputting the offset gray scale information into a texture sampler to obtain a normal map of a dissolving effect output by the texture sampler, specifically comprising:
inputting the first offset gray scale information into the r channel of the texture sampler;
inputting the second offset gray scale information into the g channel of the texture sampler;
and multiplying the first offset gray information and the second offset gray information by a thickness parameter respectively, inputting the multiplied values into the channel b of the texture sampler, and performing cross multiplication.
7. A method according to claim 6, wherein the thickness of the dissolution edge of the target liquid material is controllable by controlling the thickness parameter.
8. The method according to claim 1, wherein the fusing the normal map of the dissolution effect with the normal map of the target liquid material specifically comprises:
adding one to the value of the r channel, the value of the g channel and the value of the b channel of the original normal line mapping as a first three-dimensional vector;
multiplying the value of the r channel of the dissolving effect normal map by a minus one, and multiplying the value of the g channel by the values of the minus one and the b channel to serve as a second three-dimensional vector;
performing point multiplication on the first three-dimensional vector and the second three-dimensional vector to obtain a point multiplication value;
multiplying the point product value with the first three-dimensional vector to obtain a first rgb value;
adding one to the value of the b channel of the original normal line mapping and multiplying the value by the second three-dimensional vector to obtain a second rgb value;
and subtracting the second rgb value from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map.
9. The method of claim 3, wherein the controlling the smooth step function to achieve dissolution of the target liquid material comprises:
and realizing the dissolution of the target liquid material by controlling the minimum parameter of the smooth step function to be gradually increased.
10. A liquid material dissolving device, comprising:
the noise map correlation module is configured to acquire a target liquid material and a noise map with the same size as the target liquid material, and correlate the transparency of the target liquid material with the gray value of the noise map;
the initial gray value acquisition module is configured to perform smooth transition processing on the noise map through a smooth step function, and extract the gray value of the noise map after smooth transition as an initial gray value;
an offset gray information obtaining module configured to perform offset reorganization on the noise map after the smooth transition, extract a gray value of the noise map after the offset reorganization as an offset gray value, and subtract the initial gray value from the offset gray value to obtain offset gray information;
a dissolving effect normal map obtaining module configured to input the offset gray scale information into a texture sampler to obtain a dissolving effect normal map output by the texture sampler;
a normal map fusion module configured to fuse the dissolution effect normal map with an original normal map of the target liquid material;
a dissolution effect generation module configured to achieve dissolution of the target liquid material by controlling the smooth step function.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 9 when executing the program.
12. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 9.
CN202111599759.2A 2021-12-24 2021-12-24 Liquid material dissolving method, device, electronic equipment and storage medium Pending CN114359081A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111599759.2A CN114359081A (en) 2021-12-24 2021-12-24 Liquid material dissolving method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111599759.2A CN114359081A (en) 2021-12-24 2021-12-24 Liquid material dissolving method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114359081A true CN114359081A (en) 2022-04-15

Family

ID=81101147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111599759.2A Pending CN114359081A (en) 2021-12-24 2021-12-24 Liquid material dissolving method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114359081A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115018968A (en) * 2022-06-09 2022-09-06 粒界(上海)信息科技有限公司 Image rendering method and device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115018968A (en) * 2022-06-09 2022-09-06 粒界(上海)信息科技有限公司 Image rendering method and device, storage medium and electronic equipment
CN115018968B (en) * 2022-06-09 2024-09-24 粒界(上海)信息科技有限公司 Image rendering method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
EP4198909A1 (en) Image rendering method and apparatus, and computer device and storage medium
US20230053462A1 (en) Image rendering method and apparatus, device, medium, and computer program product
US10164459B2 (en) Selective rasterization
CN112596843B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN105550973B (en) Graphics processing unit, graphics processing system and anti-aliasing processing method
CN110930497B (en) Global illumination intersection acceleration method and device and computer storage medium
WO2023066121A1 (en) Rendering of three-dimensional model
CN116091329B (en) Image processing method, device, equipment and storage medium
US20240257436A1 (en) Image rendering method and apparatus, electronic device, and storage medium
CN111127469A (en) Thumbnail display method, device, storage medium and terminal
CN112541960A (en) Three-dimensional scene rendering method and device and electronic equipment
CN114359081A (en) Liquid material dissolving method, device, electronic equipment and storage medium
CN112686984B (en) Rendering method, device, equipment and medium for sub-surface scattering effect
CN109065001B (en) Image down-sampling method and device, terminal equipment and medium
CN116912388A (en) Mapping processing method, mapping processing device, computer readable storage medium and electronic device
CN107818584B (en) Method and device for determining finger position information of user, projector and projection system
CN118541721A (en) Texture shader generation
US10417327B2 (en) Interactive and dynamically animated 3D fonts
US10388061B2 (en) Generation of lighting data for a three-dimensional entity
CN114693780A (en) Image processing method, device, equipment, storage medium and program product
CN115880127A (en) Rendering format selection method and related equipment thereof
CN118379420B (en) Display switching method, device, electronic equipment and storage medium
CN115937338B (en) Image processing method, device, equipment and medium
CN114119797B (en) Data processing method, data processing device, computer readable medium, processor and electronic equipment
CN112445318B (en) Object display method and device, electronic equipment and storage medium

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