TA-Shader-文件 印度TA_Joyce分享的用Shader Graph造假液体shader(内含代码和shader)
发布于
2019-7-20
13195
14
TA资源类型
TA资源类型: 算法思路 
shader资源类型: SG节点 脚本文件 shader代码 
适用引擎: unity 
资源介绍: -

您需要 登录 才可以下载或查看,没有账号?注册

x
不要问我啥意思,我就是一个搬运工,相关的代码和shader节点图在镶嵌在文章里,收点搬运费。汉语是机翻,即供参考。

高清大图的shader节点图以及源文件
价格:15元素币收益:1890元素币 销量:126

尊敬的游客 ,本内容需要支付后可见.
您可以[充值][发帖] [悬赏] [任务]来赚取积分。


Here's the last post to end this ShaderGraph month, all graphs are attached!

这是结束这个月关于ShaderGraph的最后一篇文章,所有图表都附上了!


These are a little bit more complicated, I would've liked to do more, but without a double pass option I can't make my Outline shaders (Direcitonal Rim Light, Aura Outline) and the Foam Edge/Intersection effects are also not possible from the nodes given.

But I did manage to convert these other popular shader effects :)

这些有点复杂,我会喜欢做更多,但没有双通选项我不能使我的轮廓着色器(直线轮廓光,灵气轮廓)和泡沫边缘/交叉效果也是不可能的从给定的节点。但我确实设法转换这些其他流行的着色器来制作这个效果:)


Liquid Shader
2 - 1.gif

Original Code Shader Tip
早期代码


价格:5元素币收益:250元素币 销量:50

尊敬的游客 ,本内容需要支付后可见.
您可以[充值][发帖] [悬赏] [任务]来赚取积分。


以下是代码
价格:1元素币收益:76元素币 销量:76

尊敬的游客 ,本内容需要支付后可见.
您可以[充值][发帖] [悬赏] [任务]来赚取积分。


The difference with the Shader Graph version is that there is no different color for the fake surface and the side foam, because Zwrite On is not an option from graphs, but it still looks pretty cool.

Let's get started.

First part is getting the right positioning to keep the liquid level with the world, while it's in the same position within the bottle.

    与Shader Graph版本的不同之处在于假表面和侧面泡沫没有不同的颜色,因为Zwrite On不是图表的选项,但它看起来仍然很酷。    让我们开始吧。    首先是获得正确的定位,以保持液位与世界,而它在瓶内的相同位置。

                                                      

This is done by subtracting the Object's Position (Not Position Set to Object, very confusing!)  from the world Position


    这是通过从世界位置减去对象的位置(非位置设置为对象,非常混乱!)来完成的

                                                      

When you make a step of the Position.y and a slider for the fill amount, you can "fill" the object locally



Plug the result into the alpha, and set the Blend mode to Alpha, Turn on Two Sided, and create a Vector`1 for the AlphaClipThreshold to work.
Now it only shows the filled part of the object.



Creating a false surface is done by using the Is Front Face Node, as the name suggests, this returns true when it's a front face and false when its a backface, with a Branch node, you can have a different color for these two cases. Multiply the branch result with the step and you've got a fake filling!



Now it just needs to wobble!
  The script that you add to the object with this shader will give it 2 values, _WobbleX, and _WobbleZ, these two values drive how much rotation happens. First they need to be added to the properties, so don't forget to do that!  




The code version uses this rotation function, Shader Graph has a Rotate About Axis Node, it doesn't seem to work exactly the same, but we can sort of create a rotation with this.



Rotate the object by 90 degrees and multiply by the WobbleZ, and add the object position multplied by WobbleX to add the wobble rotation to the Local Position.



Don't forget to add the Wobble Script!

图文无关















参与人数 2 元素币 +60 活跃度 +20
还没有设置签名!您可以在此展示你的链接,或者个人主页!

使用道具 举报 登录

回复 <
水陌格子  发表于 2019-7-26 17:08:37  
2#
回复 收起回复
使用道具
Viveka  发表于 2019-8-2 14:35:55  
3#
感谢大佬的分享
回复 收起回复
使用道具
シキ  发表于 2019-8-2 17:30:27  
4#
感谢大佬分享
回复 收起回复
使用道具
布衣丸  发表于 2019-8-6 08:58:39  
5#
带你赚币带你飞,元素里面有正妹
回复 收起回复
使用道具
qq_木子李_H0H  发表于 2019-8-30 15:41:00  
6#
不错
回复 收起回复
使用道具
囧囧有神  发表于 2019-11-7 09:16:29  
7#
感谢分享~~~~~~~~~~~~~~~~~~~~~~
回复 收起回复
使用道具
哔咔哔咔  发表于 2019-12-6 10:24:14  
8#

感谢分享~~~~~~~~~~~~~~~~~~~~~~
回复 收起回复
使用道具
qq_蓝色海洋_gzT  发表于 2020-5-29 14:09:03  
9#
感谢分享~~~~~~~~~~~~~
回复 收起回复
使用道具
液沬眠  发表于 2020-7-4 15:31:52  
10#
不兼容啊,看不了 到底是哪个版本的
回复 收起回复
使用道具
阿来  发表于 2020-7-28 13:46:53  
11#
带你赚币带你飞,元素里面有正妹
回复 收起回复
使用道具
~华生  发表于 2020-8-25 14:43:44  
12#
带你赚币带你飞,元素里面有正妹
回复 收起回复
使用道具
全村唯一的猫  发表于 2020-11-17 11:03:28  
13#
带你赚币带你飞,元素里面有正妹
回复 收起回复
使用道具
想不到名字的H  发表于 2020-12-31 19:01:16  
14#
带你赚币带你飞,元素里面有正妹
回复 收起回复
使用道具
qq_依怡已翼_at9  发表于 2021-6-9 11:59:08  
15#
感谢大佬分享,牛逼
回复 收起回复
使用道具

快来发表你宝贵的意见吧!

元素动效狂 实名

通过了实名认证的内容创造者

  

主题
126
精华
18
超神
1
扩散
1316
微金
400
智慧
46
余额
5
在线时间
268 小时

长枪

快速回复 返回顶部 返回列表