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

Liquid material dissolving method, device, electronic device 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
offset
value
liquid material
noise map
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 device and storage medium

技术领域technical field

本公开涉及计算机动画技术领域,尤其涉及一种液体材质溶解方法、装置、电子设备及存储介质。The present disclosure relates to the technical field of computer animation, and in particular, to a liquid material dissolving method, device, electronic device and storage medium.

背景技术Background technique

本部分旨在为权利要求书中陈述的本申请的实施方式提供背景或上下文。此处的描述不因为包括在本部分中就承认是现有技术。This section is intended to provide a background or context for the embodiments of the application that are recited in the claims. The descriptions herein are not admitted to be prior art by inclusion in this section.

在计算机动画技术领域,尤其是游戏开发过程中,在制作液体状物质的溶解效果的时候,溶解边缘处的厚度处理是一个难点问题。现有技术的方案是把固有色和法线分别渲染成序列帧,然后通过材质播放序列帧来实现液体材质带厚度的溶解效果,然而,这种实现方案需要较多的中间帧,对于性能的影响较大,如果中间帧较少,则溶解效果不流畅。In the field of computer animation technology, especially in the process of game development, when making the dissolution effect of liquid substances, the thickness processing at the edge of the dissolution is a difficult problem. The solution in the prior art is to render the intrinsic color and the normal into sequence frames respectively, and then play the sequence frames through the material to achieve the effect of dissolving the thickness of the liquid material. The impact is large, and if there are fewer in-between frames, the dissolve effect is not smooth.

发明内容SUMMARY OF THE INVENTION

针对上述技术问题,需要一种改进的方案,能够在对于性能的影响较小的前提下,实现液体材质带厚度的溶解。In view of the above-mentioned technical problems, an improved solution is required, which can realize the dissolution of the thickness of the liquid material strip under the premise of less influence on the performance.

基于上述目的,本公开示例性实施例提供了一种液体材质溶解方法,包括:Based on the above purpose, 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 grayscale value of the noise map;

通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;Perform smooth transition processing on the noise map through a smooth step function, and extract the grayscale value of the noise map after the smooth transition as an initial grayscale value;

对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息;performing offset reorganization on the noise map after the smooth transition, extracting the gray value of the noise map after offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value , get the offset grayscale information;

将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图;Inputting the offset grayscale information into a texture sampler to obtain a normal map of the dissolution effect output by the texture sampler;

将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合;fusing the normal map of the dissolving effect with the original normal map of the target liquid material;

通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。By controlling the smooth step function, the dissolution of the target liquid material is achieved.

在一些示例性实施例中,所述目标液体材质的透明度为所述目标液体材质中的像素点的透明度;所述噪声贴图的灰度值为所述噪声贴图中的像素点的灰度值;In some exemplary embodiments, the transparency of the target liquid material is the transparency of the pixels in the target liquid material; the grayscale value of the noise map is the grayscale value of the pixels in the noise map;

所述将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联,具体包括:The associating the transparency of the target liquid material with the grayscale value of the noise map specifically includes:

对于所述目标液体材质中的像素点,使该像素点的透明度的值为该像素点的位置坐标在所述噪声贴图中对应的像素点的灰度值的值。For the pixel point in the target liquid material, the value of the transparency of the pixel point is set to the value of 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 value parameter and a minimum value parameter;

所述通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,具体包括:The performing smooth transition processing on the noise map through a smooth step function specifically includes:

对于所述噪声贴图中的像素点,响应于确定该像素点的灰度值大于所述最大值参数,使该像素点的灰度值为最大灰度值;响应于确定该像素点的灰度值小于所述最小值参数,使该像素点的灰度值为最小灰度值。For a pixel in the noise map, in response to determining that the gray value of the pixel is greater than the maximum value parameter, make the gray value of the pixel the maximum gray value; in response to determining the gray value of the pixel If the value is smaller than the minimum value parameter, the gray value of the pixel is made the minimum gray value.

在一些示例性实施例中,所述偏移灰度信息包括第一偏移灰度信息和第二偏移灰度信息;In some exemplary embodiments, the offset grayscale information includes first offset grayscale information and second offset grayscale information;

所述对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息,具体包括:performing offset reorganization on the noise map after the smooth transition, extracting the grayscale value of the noise map after the offset recombination as an offset grayscale value, and subtracting the initial grayscale value from the offset grayscale value degree value to get the offset grayscale information, including:

将所述平滑过渡后的噪声贴图沿水平轴方向偏移第一预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第一偏移噪声贴图,提取所述第一偏移噪声贴图的灰度值,作为第一偏移灰度值,并用所述第一偏移灰度值减去所述初始灰度值,得到所述第一偏移灰度信息;Offset the noise map after the smooth transition by a first preset distance along the horizontal axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a first offset noise map, extract the gray value of the first offset noise map as the first offset gray value, and subtract the initial gray value from the first offset gray value to obtain the first offset gray value shift grayscale information;

将所述平滑过渡后的噪声贴图沿垂直轴方向偏移第二预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第二偏移噪声贴图,提取所述第二偏移噪声贴图的灰度值,作为第二偏移灰度值,并用所述第二偏移灰度值减去所述初始灰度值,得到所述第二偏移灰度信息。Offset the noise map after the smooth transition by a second preset distance along the vertical axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a second offset noise map, extract the grayscale value of the second offset noise map as the second offset grayscale value, and subtract the initial grayscale value from the second offset grayscale value to obtain the second offset grayscale value Shift grayscale information.

在一些示例性实施例中,所述第一预设距离与所述第二预设距离相等。In some exemplary embodiments, the first preset distance is equal to the second preset distance.

在一些示例性实施例中,所述纹理采样器中包含r通道、g通道和b通道;In some exemplary embodiments, the texture sampler includes an r channel, a g channel and a b channel;

所述将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图,具体包括:The inputting the offset grayscale information into the texture sampler to obtain the normal map of the dissolving effect output by the texture sampler specifically includes:

将所述第一偏移灰度信息输入所述纹理采样器的所述r通道中;inputting the first offset grayscale information into the r channel of the texture sampler;

将所述第二偏移灰度信息输入所述纹理采样器的所述g通道中;inputting the second offset grayscale information into the g channel of the texture sampler;

将所述第一偏移灰度信息和所述第二偏移灰度信息分别与厚度参数相乘后输入所述纹理采样器的所述b通道中,并进行叉乘。The first offset grayscale information and the second offset grayscale information are respectively multiplied by a thickness parameter and then input into the b channel of the texture sampler, and cross-multiplied is performed.

在一些示例性实施例中,通过控制所述厚度参数,可以控制所述目标液体材质的溶解边缘的厚度。In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material can be controlled.

在一些示例性实施例中,所述将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合,具体包括:In some exemplary embodiments, the fusion of the normal map of the dissolving effect with the original normal map of the target liquid material specifically includes:

将所述原法线贴图的r通道的值、g通道的值和b通道的值加一作为第一三维向量;Add 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 map as the first three-dimensional vector;

将所述溶解效果法线贴图的r通道的值乘以负一、g通道的值乘以负一和b通道的值作为第二三维向量;Multiply the value of the r channel of the normal map of the dissolution effect by the value of the negative one, the value of the g channel multiplied by the value of the negative one and the b channel as the second three-dimensional vector;

将所述第一三维向量和所述第二三维向量进行点乘,得到点乘值;Doing a dot product with the first three-dimensional vector and the second three-dimensional vector to obtain a dot product value;

将所述点乘值与所述第一三维向量相乘,得到第一rgb值;multiplying the dot product value with the first three-dimensional vector to obtain a first rgb value;

将所述原法线贴图的b通道的值加一后与所述第二三维向量相乘,得到第二rgb值;Adding one to the value of the b channel of the original normal map and multiplying it by the second three-dimensional vector to obtain a second rgb value;

将所述第一rgb值减去所述第二rgb值,实现所述溶解效果法线贴图与所述原法线贴图的融合。The second rgb value is subtracted 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 dissolving of the target liquid material is realized by controlling the smooth step function, which specifically includes:

通过控制所述平滑阶梯函数的所述最小值参数逐渐增大,实现所述目标液体材质的溶解。By controlling the minimum value parameter of the smooth step function to gradually increase, the dissolution of the target liquid material is achieved.

基于同一发明构思,本公开示例性实施例还提供了一种液体材质溶解装置,包括:Based on the same inventive concept, an exemplary embodiment of the present disclosure also provides a liquid material dissolving device, including:

噪声贴图关联模块,被配置为获取目标液体材质和与所述目标液体材质尺寸相等的噪声贴图,并将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联;a noise map association module, configured to obtain a target liquid material and a noise map equal in size to the target liquid material, and associate the transparency of the target liquid material with the grayscale value of the noise map;

初始灰度值获取模块,被配置为通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;The initial grayscale value acquisition module is configured to perform smooth transition processing on the noise map through a smooth step function, and extract the grayscale value of the noise map after the smooth transition as the initial grayscale value;

偏移灰度信息获取模块,被配置为对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息;The offset grayscale information acquisition module is configured to perform offset recombination on the noise map after the smooth transition, extract the grayscale value of the noise map after the offset recombination, as the offset grayscale value, and use the offset The grayscale value is subtracted from the initial grayscale value to obtain offset grayscale information;

溶解效果法线贴图获取模块,被配置为将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图;a dissolving effect normal map acquisition module, configured to input the offset grayscale 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 dissolve effect normal map with the original normal map of the target liquid material;

溶解效果生成模块,被配置为通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。The dissolving effect generating module is configured to realize the dissolving of the target liquid material by controlling the smooth step function.

基于同一发明构思,本公开示例性实施例还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上任意一项所述的方法。Based on the same inventive concept, an exemplary embodiment of the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the program when the processor executes the program. A method as described in any of the above.

基于同一发明构思,本公开示例性实施例还提供了一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使计算机执行如上任一所述方法。Based on the same inventive concept, exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the above-mentioned a described method.

从上面所述可以看出,本公开实施例提供的液体材质溶解方法、装置、电子设备及存储介质,包括:获取目标液体材质和与目标液体材质尺寸相等的噪声贴图,并将目标液体材质的透明度与噪声贴图的灰度值相关联;通过平滑阶梯函数对噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;对平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用偏移灰度值减去初始灰度值,得到偏移灰度信息;将偏移灰度信息输入纹理采样器,得到纹理采样器输出的溶解效果法线贴图;将溶解效果法线贴图与目标液体材质的原法线贴图融合;通过控制平滑阶梯函数,实现目标液体材质的溶解。本公开通过控制噪声贴图实现液体溶解效果,不需要考虑帧率的影响,能够在对于性能的影响较小的前提下,实现液体材质的溶解。进一步的,通过构建的溶解效果法线贴图与原法线贴图的融合,能够实现液体材质带厚度的溶解。It can be seen from the above that the liquid material dissolving method, device, electronic device, and storage medium provided by 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 dissolving the target liquid material Transparency is associated with the gray value of the noise map; smooth transition is performed on the noise map through a smooth step function, and the gray value of the noise map after smooth transition is extracted as the initial gray value; the noise map after smooth transition is processed. Offset reorganization, extracting the gray value of the noise map after offset reorganization as the offset gray value, and subtracting the initial gray value from the offset gray value to obtain the offset gray value; Input the texture sampler to get the normal map of the dissolution effect output by the texture sampler; fuse the normal map of the dissolution effect with the original normal map of the target liquid material; realize the dissolution of the target liquid material by controlling the smooth step function. The present disclosure realizes the liquid dissolving effect by controlling the noise map, without considering the influence of the frame rate, and can realize the dissolving of the liquid material under the premise that the influence on the performance is small. Further, through the fusion of the constructed normal map of the dissolution effect and the original normal map, the thickness of the liquid material can be dissolved.

附图说明Description of drawings

为了更清楚地说明本公开或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the present disclosure or related technologies more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only for the present disclosure. In the embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为根据本公开实施例提供的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario provided according to an embodiment of the present disclosure;

图2为本公开实施例提供的液体材质溶解方法的流程示意图;2 is a schematic flowchart of a method for dissolving a liquid material according to an embodiment of the present disclosure;

图3为根据本公开实施例提供的液体材质的示意图;3 is a schematic diagram of a liquid material provided according to an embodiment of the present disclosure;

图4为根据本公开实施例提供的噪声贴图的示意图;4 is a schematic diagram of a noise map provided according to an embodiment of the present disclosure;

图5为根据本公开实施例提供的液体材质不带厚度溶解的示意图;5 is a schematic diagram of a liquid material dissolving without thickness according to an embodiment of the present disclosure;

图6为根据本公开实施例提供的偏移灰度信息的示意图;6 is a schematic diagram of offset grayscale information provided according to an embodiment of the present disclosure;

图7为根据本公开实施例提供的偏移灰度信息输入纹理采样器的示意图;7 is a schematic diagram of an offset grayscale information input texture sampler provided according to an embodiment of the present disclosure;

图8为根据本公开实施例提供的液体材质带厚度溶解的示意图;8 is a schematic diagram of the thickness dissolution of the liquid material strip provided according to an embodiment of the present disclosure;

图9为本公开实施例提供的液体材质溶解装置的结构示意图;9 is a schematic structural diagram of a liquid material dissolving device according to an embodiment of the present disclosure;

图10为本公开实施例提供的电子设备的结构示意图。FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.

具体实施方式Detailed ways

为使本公开的目的、技术方案和优点更加清楚明白,下面将参考若干示例性实施方式来描述本申请的原理和精神。应当理解,给出这些实施方式仅仅是为了使本领域技术人员能够更好地理解进而实现本公开,而并非以任何方式限制本申请的范围。相反,提供这些实施方式是为了使本公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的技术人员。In order to make the objectives, technical solutions and advantages of the present disclosure clearer, the principles and spirits of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are given only to enable those skilled in the art to better understand and implement the present disclosure, and not 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 the embodiments of the present disclosure, a liquid material dissolving method, device, electronic device and storage medium are provided.

在本文中,需要理解的是,附图中的任何元素数量均用于示例而非限制,以及任何命名都仅用于区分,而不具有任何限制含义。Herein, it is to be understood that any number of elements in the drawings is for illustration and not limitation, and any designation is for distinction only and does not have any limiting meaning.

需要说明的是,除非另外定义,本公开实施例使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开实施例中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the usual meanings understood by those with ordinary skill in the art to which the present disclosure belongs. "First", "second" and similar words used in the embodiments of the present disclosure do not denote any order, quantity or importance, but are only used to distinguish different components. "Comprises" or "comprising" and similar words mean that the elements or things appearing before the word encompass the elements or things recited after the word and their equivalents, but do not exclude other elements or things. Words like "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right", etc. are only used to represent the relative positional relationship, and when the absolute position of the described object changes, the relative positional relationship may also change 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 effect of dissolving the thickness of the liquid material band is realized, the performance is greatly affected.

本公开的发明人发现,造成上述相关技术对于性能的影响较大的原因是:相关技术中,把固有色和法线分别渲染成序列帧(序列帧:将活动视频用一帧一帧的图像文件来表示),然后通过材质播放序列帧来实现液体材质带厚度的溶解效果,为了使溶解效果看起来流畅真实,这种实现方案需要较多的中间帧,但是,中间帧越多则图片越大,图片越大则对于性能的影响越大。而减少中间帧则会影响溶解效果的流畅度。The inventors of the present disclosure have found that the reason why the above-mentioned related technologies have a greater impact on performance is that: in the related art, the intrinsic color and the normal are respectively rendered into sequential frames (sequential frames: a frame-by-frame image for an active video file), and then play the sequence frames through the material to achieve the dissolution effect of the liquid material with thickness. In order to make the dissolution effect look smooth and real, this implementation requires more intermediate frames. However, the more intermediate frames, the better the picture. Large, the larger the picture, the greater the impact on performance. Reducing the in-between frame will affect the smoothness of the dissolve effect.

为了解决上述问题,本申请提供了一种液体材质溶解方案,具体包括:In order to solve the above problems, the present application provides a solution for dissolving liquid materials, which specifically includes:

获取目标液体材质和与所述目标液体材质尺寸相等的噪声贴图,并将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联;通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息;将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图;将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合;通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。本公开不需要中间帧,因此能够在对于性能的影响较小的前提下,实现液体材质带厚度的溶解。Obtain a target liquid material and a noise map with the same size as the target liquid material, and associate the transparency of the target liquid material with the grayscale value of the noise map; perform a smooth transition on the noise map through a smooth step function process, and extract the gray value of the noise map after the smooth transition as the initial gray value; perform offset reorganization on the noise map after the smooth transition, and extract the gray value of the noise map after the offset and reorganization, as the offset Shift the gray value, and subtract the initial gray value from the offset gray value to obtain offset gray information; input the offset gray information into the texture sampler to obtain the output of the texture sampler Dissolving effect normal map; fuse the dissolving effect normal map with the original normal map of the target liquid material; realize the dissolution of the target liquid material by controlling the smooth step function. The present disclosure does not require an intermediate frame, so it can realize the dissolution of the thickness of the liquid material band with less impact on performance.

在介绍了本申请的基本原理之后,下面具体介绍本申请的各种非限制性实施方式。After introducing the basic principles of the present application, various non-limiting embodiments of the present application are described in detail below.

参考图1,其为本公开实施例提供的液体材质溶解方法的应用场景示意图。该应用场景包括终端设备101、服务器102和数据存储系统103。其中,终端设备101、服务器102以及数据存储系统103之间均可通过有线或无线的通信网络连接。终端设备101包括但不限于桌面计算机、移动电话、移动电脑、平板电脑、媒体播放器、智能可穿戴设备、个人数字助理(personal digital assistant,PDA)或其它能够实现上述功能的电子设备等。服务器102和数据存储系统103均可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据和人工智能平台等基础云计算服务的云服务器。Referring to FIG. 1 , which is a schematic diagram of an application scenario of the method for dissolving a liquid material provided by an 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 can all 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. Both the server 102 and the data storage system 103 may be independent physical servers, or may be server clusters or distributed systems composed of multiple physical servers, or may provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

服务器102用于向终端设备101的用户提供液体材质溶解服务,终端设备101中安装有与服务器102通信的客户端,用户可通过该客户端输入待溶解液体材质和厚度参数,点击确定按钮后,客户端将待溶解液体材质和厚度参数发送给服务器102,服务器102将该待溶解液体材质作为目标液体材质,并获取与目标液体材质尺寸相等的噪声贴图,并将目标液体材质的透明度与噪声贴图的灰度值相关联;通过平滑阶梯函数对噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;对平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用偏移灰度值减去初始灰度值,得到偏移灰度信息;将偏移灰度信息输入纹理采样器(厚度参数作用于此),得到纹理采样器输出的溶解效果法线贴图;将溶解效果法线贴图与目标液体材质的原法线贴图融合;通过控制平滑阶梯函数,实现目标液体材质的溶解。The server 102 is used to provide the user of the terminal device 101 with a liquid material dissolving service. A client terminal that communicates with the server 102 is installed in the terminal device 101. The user can input the liquid material to be dissolved and the thickness parameters through the client terminal. After clicking the OK button, The client sends the liquid material to be dissolved and the thickness parameters to the server 102, and the server 102 uses the liquid material to be dissolved as the target liquid material, obtains a noise map equal to the size of the target liquid material, and compares the transparency of the target liquid material with the noise map. The gray value of the noise map is correlated; the noise map is smoothly transitioned by the smooth step function, and the gray value of the noise map after the smooth transition is extracted as the initial gray value; the noise map after the smooth transition is offset and reorganized, Extract the gray value of the noise map after the offset and recombination as the offset gray value, and subtract the initial gray value from the offset gray value to obtain the offset gray value; input the offset gray value into the texture sampler (The thickness parameter is used here) to obtain the normal map of the dissolution effect output by the texture sampler; fuse the normal map of the dissolution effect with the original normal map of the target liquid material; realize the dissolution of the target liquid material by controlling the smooth step function.

数据存储系统103用于存储数据。The data storage system 103 is used to store data.

下面结合图1的应用场景,来描述根据本公开示例性实施方式的液体材质溶解方案。需要注意的是,上述应用场景仅是为了便于理解本公开的精神和原理而示出,本公开的实施方式在此方面不受任何限制。相反,本公开的实施方式可以应用于适用的任何场景。The solution for dissolving a liquid material according to an exemplary embodiment of the present disclosure will be described below with reference to the application scenario of FIG. 1 . It should be noted that the above application scenarios are only shown 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, the embodiments of the present disclosure can be applied to any scenario where applicable.

参考图2,其为本公开实施例提供的液体材质溶解方法的流程示意图。Referring to FIG. 2 , which is a schematic flowchart of a method for dissolving a liquid material according to an embodiment of the present disclosure.

液体材质溶解方法,包括以下步骤:The liquid material dissolving method includes the following steps:

步骤S210、获取目标液体材质和与目标液体材质尺寸相等的噪声贴图,并将目标液体材质的透明度与噪声贴图的灰度值相关联。Step S210 , acquiring a target liquid material and a noise map of the same size as the target liquid material, and associating the transparency of the target liquid material with the grayscale value of the noise map.

其中,液体材质是一种材质,噪声贴图是一种贴图。Among them, the liquid material is a kind of material, and the noise map is a kind of texture.

在计算机动画(CG,Computer Graphics)领域中,材质(Material)包含贴图(Map),贴图包含纹理(Texture)。纹理是最基本的数据输入单位,贴图用于通过UV坐标把纹理映射到3D物体表面。贴图中还包含了除了纹理以外的其他信息,例如UV坐标、贴图输入输出控制等。其中,U和V用于表示2D空间的水平轴和垂直轴,因为X,Y和Z已在3D空间中使用。材质是一个数据集,主要功能就是给渲染器提供数据和光照算法。贴图就是其中数据的一部分,根据用途不同,贴图也会被分成不同的类型,例如漫反射贴图(Diffuse Map),高光贴图(Specular Map),法线贴图(Normal Map)和光泽贴图(Gloss Map)等。In the field of computer animation (CG, Computer Graphics), the material (Material) contains the map (Map), and the map contains the texture (Texture). Texture is the most basic unit of data input, and maps are used to map textures to the surface of 3D objects through UV coordinates. The map also contains other information besides the texture, such as UV coordinates, texture input and output controls, etc. Among them, U and V are used to represent the horizontal and vertical axes of 2D space, since X, Y and Z are already used in 3D space. A material is a dataset whose main function is to provide data and lighting algorithms to the renderer. The map is a part of the data. Depending on the purpose, the map will be divided into different types, such as Diffuse Map, Specular Map, Normal Map and Gloss Map. Wait.

参考图3,其为根据本公开实施例提供的液体材质的示意图。其中,浅色部分为液体部分,深色部分为背景,液体溶解即浅色部分逐渐消失,其实质是让某些像素显示,某些像素消失。Referring to FIG. 3 , it is a schematic diagram of a liquid material provided according to an embodiment of the present disclosure. Among them, the light-colored part is the liquid part, and the dark-colored part is the background. When the liquid dissolves, the light-colored part gradually disappears. The essence is to display some pixels and some pixels to disappear.

参考图4,其为根据本公开实施例提供的噪声贴图的示意图。噪声贴图是一种黑白贴图,其中只存在黑和白两种颜色,噪声贴图中的每个像素点的黑、白的程度可以用一个在0-1之间的数值来表示,可以称这个数值为灰度值。Referring to FIG. 4 , it is a schematic diagram of a noise map provided according to an embodiment of the present disclosure. The noise map is a black and white map in which there are only two colors of black and white. The degree of black and white of each pixel in the noise map can be represented by a value between 0-1, which can be called this value. is the gray value.

在一些示例性实施例中,噪声贴图可以随机生成。其中,每个像素点的灰度值为一个在0-1之间的随机数,其中的每个随机数都是离散的,相互之间没有关系。In some exemplary embodiments, the noise map may be randomly generated. Among them, the gray value of each pixel is a random number between 0 and 1, and each random number is discrete and has no relationship with each other.

在一些示例性实施例中,噪声贴图可以设定生成。其中,通过连续化处理即插值,在离散数据中间通过函数插值的方法把空隙填满使空间自然连续。插值函数可以是三角函数、正态分布和样条曲线等。In some exemplary embodiments, the noise map may be set to generate. Among them, through the continuous processing, that is, interpolation, the gap is filled in the discrete data through the method of function interpolation, so that the space is naturally continuous. The interpolation function can be trigonometric function, normal distribution, spline curve, etc.

参考图5,其为根据本公开实施例提供的液体材质不带厚度溶解的示意图。Referring to FIG. 5 , it is a schematic diagram of a liquid material dissolved without thickness according to an embodiment of the present disclosure.

在一些示例性实施例中,将目标液体材质的透明度与噪声贴图的灰度值相关联,具体包括:In some exemplary embodiments, associating the transparency of the target liquid material with the grayscale value of the noise map includes:

对于目标液体材质中的像素点,使该像素点的透明度的值为该像素点的位置坐标在噪声贴图中对应的像素点的灰度值的值。For a pixel in the target liquid material, the value of the transparency of the pixel is set to the value of the gray value of the pixel corresponding to the position coordinate of the pixel in the noise map.

液体材质具有透明度属性,透明度为0时即为完全透明不可见(已溶解),透明度为1时即为完全不透明(未溶解)。将噪声贴图的灰度值与液体材质的透明度相关联,使液体材质中的每一个像素点的透明度的值为该像素点的位置坐标在噪声贴图中对应的像素点的灰度值,建立液体材质与噪声贴图的联系,从而通过控制噪声贴图的灰度值控制液体材质的透明度,实现液体材质的溶解效果。具体的,使灰度值逐渐减小,则透明度逐渐为0,则每个像素点逐渐透明不可见,直到透明度为0时,每个像素点均为完全透明不可见,呈现液体完全溶解的效果。The liquid material has a transparency property. When the transparency is 0, it is completely transparent and invisible (dissolved), and when the transparency is 1, it is completely opaque (not dissolved). The gray value of the noise map is associated with the transparency of the liquid material, so that the transparency value of each pixel in the liquid material is the gray value of the pixel corresponding to the position coordinate of the pixel in the noise map, and the liquid is established. The relationship between the material and the noise map, so that the transparency of the liquid material can be controlled by controlling the gray value of the noise map, and the dissolution effect of the liquid material can be achieved. Specifically, if the gray value is gradually reduced, the transparency gradually becomes 0, and each pixel is gradually transparent and invisible. When the transparency is 0, each pixel is completely transparent and invisible, showing the effect of completely dissolving the liquid. .

采用不同的噪声贴图,可以实现不同的溶解效果,液体可以根据随机生成的噪声贴图实现随机溶解,也可以根据设定生成的噪声贴图按照设定的规则实现溶解。Different noise maps can be used to achieve different dissolution effects. The liquid can be dissolved randomly according to the randomly generated noise map, or it can be dissolved according to the set rules according to the noise map generated by the settings.

通过控制噪声贴图实现液体溶解效果,不需要考虑帧率的影响,能够在对于性能的影响较小的前提下,实现液体材质的溶解。但是,其缺失了液体厚度的表现,其效果是平面不立体的,在表现上不能体现液体具有厚度的效果。By controlling the noise map to achieve the liquid dissolution effect, it does not need to consider the influence of the frame rate, and can achieve the dissolution of the liquid material under the premise of less impact on the performance. However, it lacks the expression of the thickness of the liquid, the effect is not three-dimensional in plane, and cannot reflect the effect of the thickness of the liquid in the performance.

步骤S220、通过平滑阶梯函数对噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值。Step S220 , performing smooth transition processing on the noise map through a smooth step function, and extracting the gray value of the noise map after the smooth transition as the initial gray value.

在一些示例性实施例中,平滑阶梯函数中包含最大值参数和最小值参数;In some exemplary embodiments, the smooth step function includes a maximum value parameter and a minimum value parameter;

通过平滑阶梯函数对噪声贴图进行平滑过渡处理,具体包括:The noise map is smoothly transitioned by a smooth step function, including:

对于噪声贴图中的像素点,响应于确定该像素点的灰度值大于最大值参数,使该像素点的灰度值为最大灰度值;响应于确定该像素点的灰度值小于最小值参数,使该像素点的灰度值为最小灰度值。For a pixel in the noise map, in response to determining that the gray value of the pixel is greater than the maximum value parameter, make the gray value of the pixel the maximum gray value; in response to determining that the gray value of the pixel is less than the minimum value parameter, so that the gray value of the pixel is the minimum gray value.

作为一个示例,最大灰度值为1,最小灰度值为0。As an example, the maximum grayscale value is 1 and the minimum grayscale value is 0.

具体实施时,通过控制平滑阶梯函数的最小值参数逐渐增大,使灰度值逐渐减小,则透明度逐渐为0,则每个像素点逐渐透明不可见,直到透明度为0时,每个像素点均为完全透明不可见,呈现液体完全溶解的效果。In the specific implementation, by controlling the minimum parameter of the smooth step function to gradually increase, the gray value gradually decreases, the transparency gradually becomes 0, and each pixel is gradually transparent and invisible, until the transparency is 0, each pixel The dots are all completely transparent and invisible, showing the effect of completely dissolving the liquid.

在一些示例性实施例中,通过纹理采样器提取噪声贴图的灰度值。In some exemplary embodiments, the grayscale values of the noise map are extracted by a texture sampler.

纹理采样器,可以将纹理拆分并获取RGBA四个通道的灰度值,并且获取纹理的uv信息。其中,RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha(不透明度)的色彩空间。Texture sampler, which can split the texture and obtain the gray value of the four channels of RGBA, and obtain the uv information of the texture. Among them, RGBA is a color space representing Red (red) Green (green) Blue (blue) and Alpha (opacity).

步骤S230、对平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用偏移灰度值减去初始灰度值,得到偏移灰度信息。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 the offset gray value, and subtracting the initial gray value from the offset gray value to obtain the offset gray value. Shift grayscale information.

参考图6,其为根据本公开实施例提供的偏移灰度信息的示意图。Referring to FIG. 6 , it is a schematic diagram of offset grayscale information provided according to an embodiment of the present disclosure.

在一些示例性实施例中,偏移灰度信息包括第一偏移灰度信息和第二偏移灰度信息;In some exemplary embodiments, the offset grayscale information includes first offset grayscale information and second offset grayscale information;

对平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用偏移灰度值减去初始灰度值,得到偏移灰度信息,具体包括:Offset and reorganize the noise map after smooth transition, extract the gray value of the noise map after offset and reorganization, as the offset gray value, and subtract the initial gray value from the offset gray value to obtain the offset gray value information, including:

将平滑过渡后的噪声贴图沿水平轴方向偏移第一预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第一偏移噪声贴图,提取第一偏移噪声贴图的灰度值,作为第一偏移灰度值,并用第一偏移灰度值减去初始灰度值,得到第一偏移灰度信息;Offset the noise map after smooth transition by a first preset distance along the horizontal axis, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a first offset noise map, Extracting the grayscale value of the first offset noise map as the first offset grayscale value, and subtracting the initial grayscale value from the first offset grayscale value to obtain the first offset grayscale information;

将平滑过渡后的噪声贴图沿垂直轴方向偏移第二预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第二偏移噪声贴图,提取第二偏移噪声贴图的灰度值,作为第二偏移灰度值,并用第二偏移灰度值减去初始灰度值,得到第二偏移灰度信息。Offset the noise map after the smooth transition by a second preset distance along the vertical axis, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a second offset noise map, The grayscale value of the second offset noise map is extracted as the second offset grayscale value, and the second offset grayscale value is subtracted from the initial grayscale value to obtain the second offset grayscale information.

在一些示例性实施例中,第一预设距离与第二预设距离相等。In some exemplary embodiments, the first preset distance is equal to the second preset distance.

其中,偏移重组指的是将图像偏移定义的像素数,将原图像边界以外的任何像素移动到图像的另一侧,以填充移动图像所产生的间隙,这样不会丢失图像的任何部分。Among them, offset reorganization refers to offsetting the image by a defined number of pixels, moving any pixels outside the boundaries of the original image to the other side of the image to fill in the gaps created by moving the image, so that no part of the image is lost .

步骤S240、将偏移灰度信息输入纹理采样器,得到纹理采样器输出的溶解效果法线贴图。Step S240: Input the offset grayscale information into the texture sampler to obtain the normal map of the dissolution effect output by the texture sampler.

参考图7,其为根据本公开实施例提供的偏移灰度信息输入纹理采样器的示意图。Referring to FIG. 7 , it is a schematic diagram of a texture sampler for inputting offset grayscale information according to an embodiment of the present disclosure.

在一些示例性实施例中,纹理采样器中包含r通道、g通道和b通道;In some exemplary embodiments, the texture sampler includes an r-channel, a g-channel and a b-channel;

将偏移灰度信息输入纹理采样器,得到纹理采样器输出的溶解效果法线贴图,具体包括:Input the offset grayscale information into the texture sampler to obtain the normal map of the dissolution effect output by the texture sampler, including:

将第一偏移灰度信息输入纹理采样器的r通道中;Input the first offset grayscale information into the r channel of the texture sampler;

将第二偏移灰度信息输入纹理采样器的g通道中;Input the second offset grayscale information into the g channel of the texture sampler;

将第一偏移灰度信息和第二偏移灰度信息分别与厚度参数相乘后输入纹理采样器的b通道中,并进行叉乘。The first offset grayscale information and the second offset grayscale information are respectively multiplied by the thickness parameter and then input into the b channel of the texture sampler, and cross-multiplied is performed.

在一些示例性实施例中,通过控制厚度参数,可以控制目标液体材质的溶解边缘的厚度。In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material can be controlled.

具体实施时,厚度参数与液体材质的厚度相匹配。In specific implementation, the thickness parameter matches the thickness of the liquid material.

步骤S250、将溶解效果法线贴图与目标液体材质的原法线贴图融合。Step S250, fuse the normal map of the dissolution effect with the original normal map of the target liquid material.

在一些示例性实施例中,将溶解效果法线贴图与目标液体材质的原法线贴图融合,具体包括:In some exemplary embodiments, the dissolve effect normal map is fused with the original normal map of the target liquid material, including:

将原法线贴图的r通道的值、g通道的值和b通道的值加一作为第一三维向量;Add 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 map as the first three-dimensional vector;

将溶解效果法线贴图的r通道的值乘以负一、g通道的值乘以负一和b通道的值作为第二三维向量;Multiply the value of the r channel of the normal map of the dissolve effect by the value of the negative one, the value of the g channel multiplied by the value of the negative one and the b channel as the second three-dimensional vector;

将第一三维向量和第二三维向量进行点乘,得到点乘值;Do the dot product of the first three-dimensional vector and the second three-dimensional vector to obtain the dot product value;

将点乘值与第一三维向量相乘,得到第一rgb值;Multiply the dot product value with the first three-dimensional vector to obtain the first rgb value;

将原法线贴图的b通道的值加一后与第二三维向量相乘,得到第二rgb值;Add one to the value of the b channel of the original normal map and multiply it by the second three-dimensional vector to obtain the second rgb value;

将第一rgb值减去第二rgb值,实现溶解效果法线贴图与原法线贴图的融合。Subtract the second rgb value from the first rgb value to realize the fusion of the normal map of the dissolution effect and the original normal map.

步骤S260、通过控制平滑阶梯函数,实现目标液体材质的溶解。In step S260, the target liquid material is dissolved by controlling the smooth step function.

在一些示例性实施例中,通过控制平滑阶梯函数,实现目标液体材质的溶解,具体包括:In some exemplary embodiments, the dissolution of the target liquid material is achieved by controlling the smooth step function, which specifically includes:

通过控制平滑阶梯函数的最小值参数逐渐增大,实现目标液体材质的溶解。By controlling the minimum parameter of the smooth step function to gradually increase, the dissolution of the target liquid material is realized.

参考图8,其为根据本公开实施例提供的液体材质带厚度溶解的示意图。Referring to FIG. 8 , which is a schematic diagram of the thickness dissolution of the liquid material tape provided according to an embodiment of the present disclosure.

具体实施时,通过控制厚度参数控制目标液体材质的溶解边缘的厚度;通过控制平滑阶梯函数的最小值参数逐渐增大,使灰度值逐渐减小,则透明度逐渐为0,则每个像素点逐渐透明不可见,直到透明度为0时,每个像素点均为完全透明不可见,呈现液体完全溶解的效果。In the specific implementation, the thickness of the dissolved edge of the target liquid material is controlled by controlling the thickness parameter; by controlling the minimum parameter of the smooth step function to gradually increase, so that the gray value gradually decreases, the transparency gradually becomes 0, then each pixel point Gradually become transparent and invisible, until the transparency is 0, each pixel is completely transparent and invisible, showing the effect of completely dissolving the liquid.

从上面所述可以看出,本公开实施例提供的液体材质溶解方法、装置、电子设备及存储介质,通过控制噪声贴图实现液体溶解效果,不需要考虑帧率的影响,能够在对于性能的影响较小的前提下,实现液体材质的溶解。进一步的,通过构建的溶解效果法线贴图与原法线贴图的融合,能够实现液体材质带厚度的溶解。It can be seen from the above that the liquid material dissolving method, device, electronic device, and storage medium provided by the embodiments of the present disclosure realize the liquid dissolving effect by controlling the noise map, without considering the influence of the frame rate, and can reduce the impact on the performance. Under the premise of being small, the dissolution of liquid materials can be achieved. Further, through the fusion of the constructed normal map of the dissolution effect and the original normal map, the thickness of the liquid material can be dissolved.

需要说明的是,本公开实施例的方法可以由单个设备执行,例如一台计算机或服务器等。本实施例的方法也可以应用于分布式场景下,由多台设备相互配合来完成。在这种分布式场景的情况下,这多台设备中的一台设备可以只执行本公开实施例的方法中的某一个或多个步骤,这多台设备相互之间会进行交互以完成所述的方法。It should be noted that, the methods of the embodiments of the present disclosure may be executed by a single device, such as a computer or a server. The method in this embodiment can also be applied in a distributed scenario, and is completed by the cooperation of multiple devices. In the case of such a distributed scenario, one device among the multiple devices may only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete all the steps. method described.

需要说明的是,上述对本公开的一些实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于上述实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。It should be noted that some embodiments of the present disclosure are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the above-described embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种液体材质溶解装置。Based on the same inventive concept and corresponding to any of the methods in the above embodiments, the present disclosure also provides a liquid material dissolving device.

参考图9,所述液体材质溶解装置,包括:Referring to Figure 9, the liquid material dissolving device includes:

噪声贴图关联模块910,被配置为获取目标液体材质和与所述目标液体材质尺寸相等的噪声贴图,并将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联。The noise map association module 910 is configured to obtain a target liquid material and a noise map with the same size as the target liquid material, and associate the transparency of the target liquid material with the grayscale value of the noise map.

初始灰度值获取模块920,被配置为通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值。The initial grayscale value obtaining module 920 is configured to perform smooth transition processing on the noise map through a smooth step function, and extract the grayscale value of the noise map after the smooth transition as the initial grayscale value.

偏移灰度信息获取模块930,被配置为对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息。The offset grayscale information acquisition module 930 is configured to perform offset recombination on the noise map after the smooth transition, extract the grayscale value of the noise map after the offset recombination, as the offset grayscale value, and use the offset grayscale value. The shifted gray value is subtracted from the initial gray value to obtain the offset gray information.

溶解效果法线贴图获取模块940,被配置为将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图。The dissolving effect normal map obtaining module 940 is configured to input the offset grayscale information into the texture sampler to obtain the dissolving effect normal map output by the texture sampler.

法线贴图融合模块950,被配置为将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合。The normal map fusion module 950 is configured to fuse the normal map of the dissolving effect with the original normal map of the target liquid material.

溶解效果生成模块960,被配置为通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。The dissolving effect generating module 960 is configured to realize the dissolving of the target liquid material by controlling the smooth step function.

在一些示例性实施例中,噪声贴图关联模块910,具体被配置为:In some exemplary embodiments, the noise map association module 910 is specifically configured to:

对于所述目标液体材质中的像素点,使该像素点的透明度的值为该像素点的位置坐标在所述噪声贴图中对应的像素点的灰度值的值。For the pixel point in the target liquid material, the value of the transparency of the pixel point is set to the value of the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map.

在一些示例性实施例中,所述平滑阶梯函数中包含最大值参数和所述最小值参数;初始灰度值获取模块920,具体被配置为:In some exemplary embodiments, the smooth step function includes a maximum value parameter and the minimum value parameter; the initial gray value obtaining module 920 is specifically configured to:

对于所述噪声贴图中的像素点,响应于确定该像素点的灰度值大于所述最大值参数,使该像素点的灰度值为最大灰度值;响应于确定该像素点的灰度值小于所述最小值参数,使该像素点的灰度值为最小灰度值。For a pixel in the noise map, in response to determining that the gray value of the pixel is greater than the maximum value parameter, make the gray value of the pixel the maximum gray value; in response to determining the gray value of the pixel If the value is smaller than the minimum value parameter, the gray value of the pixel is made the minimum gray value.

在一些示例性实施例中,所述偏移灰度信息包括第一偏移灰度信息和第二偏移灰度信息;偏移灰度信息获取模块930,具体被配置为:In some exemplary embodiments, the offset grayscale information includes first offset grayscale information and second offset grayscale information; the offset grayscale information obtaining module 930 is specifically configured to:

将所述平滑过渡后的噪声贴图沿水平轴方向偏移第一预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第一偏移噪声贴图,提取所述第一偏移噪声贴图的灰度值,作为第一偏移灰度值,并用所述第一偏移灰度值减去所述初始灰度值,得到所述第一偏移灰度信息;Offset the noise map after the smooth transition by a first preset distance along the horizontal axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a first offset noise map, extract the gray value of the first offset noise map as the first offset gray value, and subtract the initial gray value from the first offset gray value to obtain the first offset gray value shift grayscale information;

将所述平滑过渡后的噪声贴图沿垂直轴方向偏移第二预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第二偏移噪声贴图,提取所述第二偏移噪声贴图的灰度值,作为第二偏移灰度值,并用所述第二偏移灰度值减去所述初始灰度值,得到所述第二偏移灰度信息。Offset the noise map after the smooth transition by a second preset distance along the vertical axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a second offset noise map, extract the grayscale value of the second offset noise map as the second offset grayscale value, and subtract the initial grayscale value from the second offset grayscale value to obtain the second offset grayscale value Shift grayscale information.

在一些示例性实施例中,所述第一预设距离与所述第二预设距离相等。In some exemplary embodiments, the first preset distance is equal to the second preset distance.

在一些示例性实施例中,所述纹理采样器中包含r通道、g通道和b通道;溶解效果法线贴图获取模块940,具体被配置为:In some exemplary embodiments, the texture sampler includes an r channel, a g channel and a b channel; the dissolving effect normal map acquisition module 940 is specifically configured as:

将所述第一偏移灰度信息输入所述纹理采样器的所述r通道中;inputting the first offset grayscale information into the r channel of the texture sampler;

将所述第二偏移灰度信息输入所述纹理采样器的所述g通道中;inputting the second offset grayscale information into the g channel of the texture sampler;

将所述第一偏移灰度信息和所述第二偏移灰度信息分别与厚度参数相乘后输入所述纹理采样器的所述b通道中,并进行叉乘。The first offset grayscale information and the second offset grayscale information are respectively multiplied by a thickness parameter and then input into the b channel of the texture sampler, and cross-multiplied is performed.

在一些示例性实施例中,通过控制所述厚度参数,可以控制所述目标液体材质的溶解边缘的厚度。In some exemplary embodiments, by controlling the thickness parameter, the thickness of the dissolution edge of the target liquid material can be controlled.

在一些示例性实施例中,法线贴图融合模块950,具体被配置为:In some exemplary embodiments, the normal map fusion module 950 is specifically configured to:

将所述原法线贴图的r通道的值、g通道的值和b通道的值加一作为第一三维向量;Add 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 map as the first three-dimensional vector;

将所述溶解效果法线贴图的r通道的值乘以负一、g通道的值乘以负一和b通道的值作为第二三维向量;Multiply the value of the r channel of the normal map of the dissolution effect by the value of the negative one, the value of the g channel multiplied by the value of the negative one and the b channel as the second three-dimensional vector;

将所述第一三维向量和所述第二三维向量进行点乘,得到点乘值;Doing a dot product with the first three-dimensional vector and the second three-dimensional vector to obtain a dot product value;

将所述点乘值与所述第一三维向量相乘,得到第一rgb值;multiplying the dot product value with the first three-dimensional vector to obtain a first rgb value;

将所述原法线贴图的b通道的值加一后与所述第二三维向量相乘,得到第二rgb值;Adding one to the value of the b channel of the original normal map and multiplying it by the second three-dimensional vector to obtain a second rgb value;

将所述第一rgb值减去所述第二rgb值,实现所述溶解效果法线贴图与所述原法线贴图的融合。The second rgb value is subtracted from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map.

在一些示例性实施例中,溶解效果生成模块960,具体被配置为:In some exemplary embodiments, the dissolving effect generation module 960 is specifically configured to:

通过控制平滑阶梯函数的最小值参数逐渐增大,实现目标液体材质的溶解。By controlling the minimum parameter of the smooth step function to gradually increase, the dissolution of the target liquid material is realized.

为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本公开时可以把各模块的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above device, the functions are divided into various modules and described respectively. Of course, when implementing the present disclosure, the functions of each module may be implemented in one or more software and/or hardware.

上述实施例的装置用于实现前述任一实施例中相应的液体材质溶解方法,并且具有相应的方法实施例的有益效果,在此不再赘述。The apparatus of the above-mentioned embodiment is used to realize the corresponding liquid material dissolving method in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上任意一实施例所述的液体材质溶解方法。Based on the same inventive concept and corresponding to any of the above-mentioned embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, the processor When the program is executed, the liquid material dissolving method described in any one of the above embodiments is realized.

图10示出了本实施例所提供的一种更为具体的电子设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。FIG. 10 shows a schematic diagram of a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010 , a memory 1020 , an input/output interface 1030 , a communication interface 1040 and a bus 1050 . The processor 1010 , the memory 1020 , the input/output interface 1030 and the communication interface 1040 realize the communication connection among each other within the device through the bus 1050 .

处理器1010可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute related program to implement the technical solutions provided by the embodiments of this specification.

存储器1020可以采用ROM(Read Only Memory,只读存储器)、RAM(Random AccessMemory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。The memory 1020 may be implemented in the form of a ROM (Read Only Memory, read only memory), a RAM (Random Access Memory, random access memory), a static storage device, a dynamic storage device, and the like. The memory 1020 may store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and invoked by the processor 1010 for execution.

输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入/输出模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。The input/output interface 1030 is used to connect the input/output module to realize information input and output. The input/output module can be configured in the device as a component (not shown in the figure), or can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, and the like.

通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。The communication interface 1040 is used to connect a communication module (not shown in the figure), so as to realize the communication interaction between the device and other devices. The communication module may implement communication through wired means (eg, USB, network cable, etc.), or may implement communication through wireless means (eg, mobile network, WIFI, Bluetooth, etc.).

总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出接口1030和通信接口1040)之间传输信息。Bus 1050 includes a path to transfer information between the various components of the device (eg, processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).

需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。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 the specific implementation process, the device may also include necessary components for normal operation. other components. In addition, those skilled in the art can understand that, the above-mentioned device may only include components necessary to implement the solutions of the embodiments of the present specification, rather than all the components shown in the figures.

上述实施例的电子设备用于实现前述任一实施例中相应的液体材质溶解方法,并且具有相应的方法实施例的有益效果,在此不再赘述。The electronic device in 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 will not be repeated here.

基于同一发明构思,与上述任意实施例方法相对应的,本公开还提供了一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上任一实施例所述的液体材质溶解方法。Based on the same inventive concept and corresponding to any of the above-mentioned embodiments, the present disclosure also provides a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions use to make the computer execute the liquid material dissolving method described in any of the above embodiments.

上述非暂态计算机可读存储介质可以是计算机能够存取的任何可用介质或数据存储设备,包括但不限于磁性存储器(例如软盘、硬盘、磁带、磁光盘(MO)等)、光学存储器(例如CD、DVD、BD、HVD等)、以及半导体存储器(例如ROM、EPROM、EEPROM、非易失性存储器(NAND FLASH)、固态硬盘(SSD))等。The above-mentioned non-transitory computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (eg, floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc.), optical storage (eg. CD, DVD, BD, HVD, etc.), and semiconductor memory (eg, ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state disk (SSD)), and the like.

上述实施例的存储介质存储的计算机指令用于使所述计算机执行如上示例性方法部分中任一实施例所述的液体材质溶解方法,并且具有相应的方法实施例的有益效果,在此不再赘述。The computer instructions stored in the storage medium of the above-mentioned embodiments are used to cause the computer to execute the liquid material dissolving method described in any one of the above exemplary method sections, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here. Repeat.

本领域技术技术人员知道,本发明的实施方式可以实现为一种系统、方法或计算机程序产品。因此,本公开可以具体实现为以下形式,即:完全的硬件、完全的软件(包括固件、驻留软件、微代码等),或者硬件和软件结合的形式,本文一般称为“电路”、“模块”或“系统”。此外,在一些实施例中,本发明还可以实现为在一个或多个计算机可读介质中的计算机程序产品的形式,该计算机可读介质中包含计算机可读的程序代码。As will be appreciated by those skilled in the art, embodiments of the present invention may be implemented as a system, method or computer program product. Accordingly, the present disclosure may be embodied in complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as "circuits," "circuits," Module" or "System". Furthermore, in some embodiments, the present invention may also be implemented in the form of a computer program product on one or more computer-readable media having computer-readable program code embodied thereon.

可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是,但不限于,电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举示例)例如可以包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。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. The computer readable storage medium can 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 (non-exhaustive examples) of computer readable storage media may include, for example, electrical connections with 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 fiber, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer-readable signal medium may include a propagated data signal in baseband or as part of a carrier wave, with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .

计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络(包括局域网(LAN)或广域网(WAN))连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language. 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. Where a remote computer is involved, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider via the Internet connect).

应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合都可以由计算机程序指令实现。这些计算机程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,这些计算机程序指令通过计算机或其它可编程数据处理装置执行,产生了实现流程图和/或框图中的方框中规定的功能/操作的装置。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, and the execution of these computer program instructions by the computer or other programmable data processing apparatus produces a flow chart of implementation and/or means that function/operate as specified in the blocks in the block diagrams.

也可以把这些计算机程序指令存储在能使得计算机或其它可编程数据处理装置以特定方式工作的计算机可读介质中,这样,存储在计算机可读介质中的指令就产生出一个包括实现流程图和/或框图中的方框中规定的功能/操作的指令装置的产品。These computer program instructions can also be stored in a computer-readable medium that can cause a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable medium produce a flow chart including an implementation flowchart and /or product of instruction means for the functions/operations specified in the blocks in the block diagram.

也可以把计算机程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机或其它可编程装置上执行的指令能够提供实现流程图和/或框图中的方框中规定的功能/操作的过程。Computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process, thereby Cause the instructions to be executed on a computer or other programmable apparatus to provide processes for implementing the functions/operations specified in the blocks in the flowchart and/or block diagrams.

此外,尽管在附图中以特定顺序描述了本发明方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。相反,流程图中描绘的步骤可以改变执行顺序。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。Furthermore, although the operations of the methods of the present invention are depicted in the figures in a particular order, this does not require or imply that the operations must be performed in the particular order, or that all 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 may be combined to be performed as one step, and/or one step may be decomposed into multiple steps to be performed.

申请文件中提及的动词“包括”、“包含”及其词形变化的使用不排除除了申请文件中记载的那些元素或步骤之外的元素或步骤的存在。元素前的冠词“一”或“一个”不排除多个这种元素的存在。The use of the verbs "comprise", "comprise" and their conjugations mentioned in the application documents do not exclude the presence of elements or steps other than those recited in the application documents. The articles "a" or "an" before an element do not exclude the presence of a plurality of such elements.

虽然已经参考若干具体实施方式描述了本发明的精神和原理,但是应该理解,本发明并不限于所公开的具体实施方式,对各方面的划分也不意味着这些方面中的特征不能组合以进行受益,这种划分仅是为了表述的方便。本发明旨在涵盖所附权利要求的精神和范围内所包括的各种修改和等同布置。所附权利要求的范围符合最宽泛的解释,从而包含所有这样的修改及等同结构和功能。While the spirit and principles of the present invention have been described with reference to a number of specific embodiments, it should be understood that the invention is not limited to the specific embodiments disclosed, nor does the division of aspects imply that features of these aspects cannot be combined to perform Benefit, this division is only for convenience of presentation. 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 appended claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

Claims (12)

1.一种液体材质溶解方法,包括: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 grayscale value of the noise map; 通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,并提取平滑过渡后的噪声贴图的灰度值,作为初始灰度值;Perform smooth transition processing on the noise map through a smooth step function, and extract the grayscale value of the noise map after the smooth transition as an initial grayscale value; 对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息;performing offset reorganization on the noise map after the smooth transition, extracting the gray value of the noise map after offset reorganization as an offset gray value, and subtracting the initial gray value from the offset gray value , get the offset grayscale information; 将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图;Inputting the offset grayscale information into a texture sampler to obtain a normal map of the dissolution effect output by the texture sampler; 将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合;fusing the normal map of the dissolving effect with the original normal map of the target liquid material; 通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。By controlling the smooth step function, the dissolution of the target liquid material is achieved. 2.根据权利要求1所述的方法,其中,所述目标液体材质的透明度为所述目标液体材质中的像素点的透明度;所述噪声贴图的灰度值为所述噪声贴图中的像素点的灰度值;2 . The method according to claim 1 , wherein the transparency of the target liquid material is the transparency of the pixel points in the target liquid material; the grayscale value of the noise map is the pixel point in the noise map The gray value of ; 所述将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联,具体包括:The associating the transparency of the target liquid material with the grayscale value of the noise map specifically includes: 对于所述目标液体材质中的像素点,使该像素点的透明度的值为该像素点的位置坐标在所述噪声贴图中对应的像素点的灰度值的值。For the pixel point in the target liquid material, the value of the transparency of the pixel point is set to the value of the gray value of the pixel point corresponding to the position coordinate of the pixel point in the noise map. 3.根据权利要求1所述的方法,其中,所述平滑阶梯函数中包含最大值参数和最小值参数;3. The method according to claim 1, wherein the smooth step function includes a maximum value parameter and a minimum value parameter; 所述通过平滑阶梯函数对所述噪声贴图进行平滑过渡处理,具体包括:The performing smooth transition processing on the noise map through a smooth step function specifically includes: 对于所述噪声贴图中的像素点,响应于确定该像素点的灰度值大于所述最大值参数,使该像素点的灰度值为最大灰度值;响应于确定该像素点的灰度值小于所述最小值参数,使该像素点的灰度值为最小灰度值。For a pixel in the noise map, in response to determining that the gray value of the pixel is greater than the maximum value parameter, make the gray value of the pixel the maximum gray value; in response to determining the gray value of the pixel If the value is smaller than the minimum value parameter, the gray value of the pixel is made the minimum gray value. 4.根据权利要求1所述的方法,其中,所述偏移灰度信息包括第一偏移灰度信息和第二偏移灰度信息;4. The method of claim 1, wherein the offset grayscale information comprises first offset grayscale information and second offset grayscale information; 所述对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息,具体包括:performing offset reorganization on the noise map after the smooth transition, extracting the grayscale value of the noise map after the offset recombination as an offset grayscale value, and subtracting the initial grayscale value from the offset grayscale value degree value to get the offset grayscale information, including: 将所述平滑过渡后的噪声贴图沿水平轴方向偏移第一预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第一偏移噪声贴图,提取所述第一偏移噪声贴图的灰度值,作为第一偏移灰度值,并用所述第一偏移灰度值减去所述初始灰度值,得到所述第一偏移灰度信息;Offset the noise map after the smooth transition by a first preset distance along the horizontal axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a first offset noise map, extract the gray value of the first offset noise map as the first offset gray value, and subtract the initial gray value from the first offset gray value to obtain the first offset gray value shift grayscale information; 将所述平滑过渡后的噪声贴图沿垂直轴方向偏移第二预设距离,将偏移后超出该噪声贴图的原边界的部分移动到该噪声贴图的另一侧,得到第二偏移噪声贴图,提取所述第二偏移噪声贴图的灰度值,作为第二偏移灰度值,并用所述第二偏移灰度值减去所述初始灰度值,得到所述第二偏移灰度信息。Offset the noise map after the smooth transition by a second preset distance along the vertical axis direction, and move the part beyond the original boundary of the noise map after the offset to the other side of the noise map to obtain a second offset noise map, extract the grayscale value of the second offset noise map as the second offset grayscale value, and subtract the initial grayscale value from the second offset grayscale value to obtain the second offset grayscale value Shift grayscale information. 5.根据权利要求4所述的方法,其中,所述第一预设距离与所述第二预设距离相等。5. The method of claim 4, wherein the first preset distance is equal to the second preset distance. 6.根据权利要求4所述的方法,其中,所述纹理采样器中包含r通道、g通道和b通道;6. The method according to claim 4, wherein the texture sampler comprises an r channel, a g channel and a b channel; 所述将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图,具体包括:The inputting the offset grayscale information into the texture sampler to obtain the normal map of the dissolving effect output by the texture sampler specifically includes: 将所述第一偏移灰度信息输入所述纹理采样器的所述r通道中;inputting the first offset grayscale information into the r channel of the texture sampler; 将所述第二偏移灰度信息输入所述纹理采样器的所述g通道中;inputting the second offset grayscale information into the g channel of the texture sampler; 将所述第一偏移灰度信息和所述第二偏移灰度信息分别与厚度参数相乘后输入所述纹理采样器的所述b通道中,并进行叉乘。The first offset grayscale information and the second offset grayscale information are respectively multiplied by a thickness parameter and then input into the b channel of the texture sampler, and cross-multiplied is performed. 7.根据权利要求6所述的方法,其中,通过控制所述厚度参数,可以控制所述目标液体材质的溶解边缘的厚度。7. The method of claim 6, wherein by controlling the thickness parameter, the thickness of the dissolved edge of the target liquid material can be controlled. 8.根据权利要求1所述的方法,其中,所述将所述溶解效果法线贴图与所述目标液体材质的原法线贴图融合,具体包括:8. The method according to claim 1, wherein the fusion of the normal map of the dissolving effect with the original normal map of the target liquid material specifically comprises: 将所述原法线贴图的r通道的值、g通道的值和b通道的值加一作为第一三维向量;Add 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 map as the first three-dimensional vector; 将所述溶解效果法线贴图的r通道的值乘以负一、g通道的值乘以负一和b通道的值作为第二三维向量;Multiply the value of the r channel of the normal map of the dissolution effect by the value of the negative one, the value of the g channel multiplied by the value of the negative one and the b channel as the second three-dimensional vector; 将所述第一三维向量和所述第二三维向量进行点乘,得到点乘值;Doing a dot product with the first three-dimensional vector and the second three-dimensional vector to obtain a dot product value; 将所述点乘值与所述第一三维向量相乘,得到第一rgb值;multiplying the dot product value with the first three-dimensional vector to obtain a first rgb value; 将所述原法线贴图的b通道的值加一后与所述第二三维向量相乘,得到第二rgb值;adding one to the value of the b channel of the original normal map and multiplying it by the second three-dimensional vector to obtain a second rgb value; 将所述第一rgb值减去所述第二rgb值,实现所述溶解效果法线贴图与所述原法线贴图的融合。The second rgb value is subtracted from the first rgb value to realize the fusion of the normal map of the dissolving effect and the original normal map. 9.根据权利要求3所述的方法,其中,所述通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解,具体包括:9 . The method according to claim 3 , wherein the dissolving of the target liquid material is realized by controlling the smooth step function, specifically comprising: 10 . 通过控制所述平滑阶梯函数的所述最小值参数逐渐增大,实现所述目标液体材质的溶解。By controlling the minimum value parameter of the smooth step function to gradually increase, the dissolution of the target liquid material is achieved. 10.一种液体材质溶解装置,包括:10. A liquid material dissolving device, comprising: 噪声贴图关联模块,被配置为获取目标液体材质和与所述目标液体材质尺寸相等的噪声贴图,并将所述目标液体材质的透明度与所述噪声贴图的灰度值相关联;a noise map association module, configured to obtain a target liquid material and a noise map equal in size to the target liquid material, and associate the transparency of the target liquid material with the grayscale 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 the smooth transition as the initial gray value; 偏移灰度信息获取模块,被配置为对所述平滑过渡后的噪声贴图进行偏移重组,提取偏移重组后的噪声贴图的灰度值,作为偏移灰度值,并用所述偏移灰度值减去所述初始灰度值,得到偏移灰度信息;The offset grayscale information acquisition module is configured to perform offset recombination on the noise map after the smooth transition, extract the grayscale value of the noise map after the offset recombination, as the offset grayscale value, and use the offset The grayscale value is subtracted from the initial grayscale value to obtain offset grayscale information; 溶解效果法线贴图获取模块,被配置为将所述偏移灰度信息输入纹理采样器,得到所述纹理采样器输出的溶解效果法线贴图;a dissolving effect normal map acquisition module, configured to input the offset grayscale 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 dissolve effect normal map with the original normal map of the target liquid material; 溶解效果生成模块,被配置为通过控制所述平滑阶梯函数,实现所述目标液体材质的溶解。The dissolving effect generating module is configured to realize the dissolving of the target liquid material by controlling the smooth step function. 11.一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如权利要求1至9任意一项所述的方法。11. An electronic device, comprising a memory, a processor and a computer program stored on the memory and running on the processor, the processor implementing the program according to any one of claims 1 to 9 when the processor executes the program method. 12.一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使计算机执行权利要求1至9任一所述方法。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 device 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 device 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 device 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 device and storage medium

Country Status (1)

Country Link
CN (1) CN114359081A (en)

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
CN115501590A (en) * 2022-09-30 2022-12-23 网易(杭州)网络有限公司 Display method, device, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110458914A (en) * 2019-08-15 2019-11-15 北京攸乐科技有限公司 A kind of multi-functional tinter and engine renders method
JP2020157653A (en) * 2019-03-27 2020-10-01 株式会社ミマキエンジニアリング Image generator and image generation method
CN112435304A (en) * 2020-07-20 2021-03-02 上海哔哩哔哩科技有限公司 Water body interactive mapping method and system
CN113506362A (en) * 2021-06-02 2021-10-15 湖南大学 A new view synthesis method for single-view transparent objects based on encoder-decoder network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020157653A (en) * 2019-03-27 2020-10-01 株式会社ミマキエンジニアリング Image generator and image generation method
CN110458914A (en) * 2019-08-15 2019-11-15 北京攸乐科技有限公司 A kind of multi-functional tinter and engine renders method
CN112435304A (en) * 2020-07-20 2021-03-02 上海哔哩哔哩科技有限公司 Water body interactive mapping method and system
CN113506362A (en) * 2021-06-02 2021-10-15 湖南大学 A new view synthesis method for single-view transparent objects based on encoder-decoder network

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LAIN_VV: "Shader学习笔记 01 - 溶解", Retrieved from the Internet <URL:https://www.cnblogs.com/lain-vv/p/12855685.html> *
范靖宇: "基于纹理材质的三维特效合成研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》, no. 3, 15 March 2016 (2016-03-15) *

Cited By (3)

* 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
CN115501590A (en) * 2022-09-30 2022-12-23 网易(杭州)网络有限公司 Display method, device, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US10311548B2 (en) Scaling render targets to a higher rendering resolution to display higher quality video frames
CN112042182B (en) Manipulating remote avatars by facial expressions
CN112596843B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN111669646A (en) Method, device, equipment and medium for playing transparent video
CN112053370A (en) Augmented reality-based display method, device and storage medium
CN105550973B (en) Graphics processing unit, graphics processing system and anti-aliasing processing method
CN114782612A (en) Image rendering method, device, electronic device and storage medium
CN110782387A (en) Image processing method and device, image processor and electronic equipment
CN114359081A (en) Liquid material dissolving method, device, electronic device and storage medium
CN111127469A (en) Thumbnail display method, device, storage medium and terminal
CN115100337A (en) A full-body portrait video re-lighting method and device based on convolutional neural network
CN115705668A (en) View drawing method and device and storage medium
CN115391692A (en) Video processing method and device
CN113553128B (en) Screen corner generation method, device, electronic device and storage medium
CN114119797B (en) Data processing method, data processing device, computer readable medium, processor and electronic equipment
WO2023197911A1 (en) Three-dimensional virtual object generation method and apparatus, and device, medium and program product
WO2023197912A1 (en) Image processing method and apparatus, device, storage medium, and program product
KR20240101117A (en) Image processing method and apparatus using the same
KR20230156046A (en) Processing of data in pixel-to-pixel neural networks
CN116843812A (en) Image rendering method and device and electronic equipment
EP4538979A1 (en) Method and apparatus for image processing, and storage medium
US12347016B2 (en) Image rendering method and apparatus, device, medium, and computer program product
JP7524452B2 (en) SYSTEM AND METHOD FOR PROJECTING CONTENT INTO AN ENVIRONMENT - Patent application
KR102800992B1 (en) Method and system for processing image for lip makeup based on augmented reality
US20230053462A1 (en) Image rendering method and apparatus, device, medium, and computer program product

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