在游戏中制作类似 Photoshop 的阴影

发布于 2024-08-16 04:22:29 字数 148 浏览 5 评论 0原文

我正在制作一款游戏,游戏的大小各不相同,所以我想制作自己的阴影。我使用的 api 可以填充矩形、制作椭圆、水平线等。并且支持 rgba。鉴于此,我怎样才能制作阴影?我尝试制作一个黑到白的渐变并将 alpha 设置为 20%,但它看起来不太好......我不确定它们是如何完成的。谢谢

I'm making a game where the game's size varies, so I want to make my own shadows. The api i'm using can fill rectangles, make ellipses, horizontal lines etc. And supports rgba. Given this, how could I make a drop shadow? I tried making a black to white gradient and setting the alpha to 20%, but it didnt look very good... I'm not sure how they are done. Thanks

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

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

发布评论

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

评论(1

笑梦风尘 2024-08-23 04:22:29

我建议:

  1. 复制对象,
  2. 将其向光源的相反方向移动,并使用其距离作为权重,
  3. 将其完全变黑,
  4. 也使用光源的距离作为权重对其进行模糊处理,
  5. 将其放在对象后面,
  6. 如果需要,可以降低 alpha。
  7. ????
  8. 利润。

I would suggest:

  1. copy the object,
  2. move it in the opposite direction of the light source and use its distance as a weight,
  3. turn it totally black,
  4. blur it using the light source's distance as a weight, too,
  5. put it behind the object,
  6. lower the alpha if you want.
  7. ?????
  8. profit.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文