使用着色器图将轮廓添加到一个储罐的精灵中。尽管遵循教程,但大纲会扭曲精灵

发布于 2025-02-02 18:12:23 字数 1125 浏览 3 评论 0 原文

我正在尝试在我的水箱上添加一个黑色轮廓。

我已经尝试遵循我可以在2D大纲上找到的每个教程的精灵,但是几乎所有的都使用了以前的Unity版本(我使用的是2021.1.3f1),并且似乎没有任何我的问题一直有。

在样本纹理的偏移副本上使用alpha减法(并乘以颜色)后,我尝试将其添加到原始样品纹理中。那是什么时候出错的时候,无论我尝试过什么,它都会砍掉精灵的右侧(我试图首先添加左图),或者使精灵的右侧以我的相反颜色为'm放在左边。

我的意思是“切断右侧”,这些胎面应与左侧相同的厚度,就像将轮廓添加到另一侧一样。

如果重要的话,Sprite是我从肯尼得到的PNG,然后在Krita进行了修改。 无论出于何种原因,更改轮廓的颜色似乎也改变了修剪的数量。

我一直在猛击这个问题四个小时,任何想法或建议都非常感谢。

更新:按照下面的全职同等建议之后,我确实在整个精灵周围得到了大纲,但是现在它正在扭曲精灵边缘的颜色,如下所示:

替换添加混合物后

I'm trying to add a black outline surrounding a sprite I have for a tank.

I've tried following every tutorial I could find on 2d outlines for sprites, however almost all of them were done using a previous unity version (I'm using 2021.1.3f1) and don't seem to have any of the problems I've been having.

After using Alpha subtraction on an offset copy of the sample texture (and multiplying by a color) I then try to add it back to the original sample texture. That's when things go wrong, no matter what I've tried it keeps either chopping off the right side of the sprite (I was trying to add the left outline first), or making the right side of the sprite the opposite color of what I'm putting on the left.

enter image description here

What I mean by "cutting off the right", those treads should be the same thickness on the right as on the left, it's like adding the outline to one side trimmed the other.

If it matters, the sprite is a PNG I got from Kenney and then modified in Krita.
For whatever reason, changing the color of the outline seems to also change how much is getting trimmed.

I've been banging my head against this for four hours now, any ideas or suggestions are greatly appreciated.

Update: After following One Full Time Equivalent's suggestion below I do get an outline surrounding the entire sprite, but now it's distorting the colors at the edges of the sprite as seen here:
enter image description here

After replacing Add with Blend
enter image description here

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

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

发布评论

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

评论(1

月下凄凉 2025-02-09 18:12:23

减法节点后,放入绝对节点,否则您将在Alpha通道中减去正确的边缘(这正是您现在观察到的)。始终要注意,您只能看到一半的颜色空间,而负面的频道可能很棘手。

After your subtraction node, put in an Absolute node, otherwise you will subtract the right edge in the alpha channel (this is exactly what you observe right now). Always be aware that you can only see half the color space and negative channels can be tricky to deal with.

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