Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个从具有 alpha 通道的 PNG 加载的精灵。该图像包含一个不透明的磁盘,其余部分是透明的。
我想使用 的color参数SpriteBatch.Draw(...)来改变磁盘的色调。然而,默认的混合行为将颜色应用到整个精灵,所以我最终在有色圆盘周围形成了一个不透明的方形轮廓。
color
SpriteBatch.Draw(...)
有没有办法改变混合模式,使透明像素不受color参数影响?
我从未见过这种情况发生,而且我从 XNA 开始就一直在使用像这样的透明 PNG。你在混合 2D 和 3D 吗?如果是这样,您的 3D 渲染设置可能会混淆 SpriteBatch,但我认为 SpriteBatch 应该为您正确设置这些。也许您使用的 PNG 图像有问题?
比尔,你是对的。我忘了清除其中一个 PNG 中的背景。这个问题应该被删除。