我怎么能“结合”着色器图中的这两个材料/着色器?

发布于 2025-01-31 10:43:20 字数 1719 浏览 2 评论 0 原文

我正在使用HDRP和着色器图。从我研究的内容来看,看来着色器不能合并,但是我可以使用两种材料。但是,当我这样做时,它们并没有像我希望的那样真正结合在一起。

我有一个角色: 我想应用着着色器来创建传送效果: 它慢慢消失,边缘消失。我从这个brackeys视频我只是简单地替换了连接到alpha阈值的时间节点,并通过我打算从脚本中动画的浮标使一切都消失了。

当我将两种材料添加到我的皮肤网状渲染器中时,就会发生两个问题,而与材料清单中材料的顺序无关。

  1. 它没有完全消失在α阈值设置为1时,它只是光明的存在:
  2. 我根本看不到其他材料。当阈值设置为0时,我只是看到传送着着色器的基本颜色。

我尝试了一些东西,但似乎无法为我的着色器禁用“基本色”。我尝试使传送着着色器的材料透明,这揭示了下面的其他材料,但还有另外两个问题。

  1. 当Alpha阈值设置为0时,我仍然可以看到传送着色器(灰色)的基本颜色。
  2. 当alpha阈值达到1时,角色的正常材料只会完全显示出来,而不是按照我想要的角色消失。

我的传送着着色器:

“在此处输入图像描述”

我的渲染器设置:

”在此处输入图像描述

我在做什么错?如何将两者结合在一起?

I am using HDRP and Shader Graph. From what I researched, it seems that shaders can't be combined but that I can apply two materials. However, when I do, they aren't really combining as I was hoping they would.

I have a character:
upload_2022-5-23_1-17-9.png
And I want to apply a shader to create a teleportation effect:
upload_2022-5-23_1-18-5.png
It slowly disappears with glowing edges. I learned this effect from this Brackeys video https://www.youtube.com/watch?v=taMp1g1pBeE and I simply replaced the time node that connected to the Alpha Threshold and made everything disappear with a float that I intend to animate from script.

When I add both materials to my skinned mesh renderer, two problems happen, independently of the order of the materials in the materials list.

  1. Instead of fully disappearing when the alpha threshold is set to 1, it just becomes a being of light:
    upload_2022-5-23_1-20-57.png
  2. I can't see the other material at all. I simply see the base color of the teleportation shader when the threshold is set to 0.

I tried a few things but can't seem to disable the "base color" for my shader. I tried making the teleportation shader's material transparent, which reveals the other material underneath but two other problems occur.

  1. I can still see the base color of the teleportation shader (a grey) when the alpha threshold is set to 0.
    upload_2022-5-23_1-24-44.png
  2. When the alpha threshold reaches 1, the character's normal material simply shows fully through instead of the character disappearing as I want it to.

My teleportation shader:

enter image description here

My renderer settings:

enter image description here

What am I doing wrong? How can I combine both?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

归属感 2025-02-07 10:43:20

您要做的就是仅使用一个着色器,您的传送着色器,然后在其基本纹理中添加节点。然后,使用添加节点,您可以与基本颜色片段插槽的当前输入结合使用。

What you will want to do is use just one shader, your teleport shader, and add nodes to it for the base texture. Then, using the Add node, you can combine with the current input of the Base Color fragment slot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文