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.
我有一个纹理 2D,我想在其中获取指定像素的颜色。用它做点什么,然后在另一个纹理 2D 中添加新颜色。
我需要对纹理中的所有像素执行此操作。我怎样才能做到这一点。
请不要使用像素着色器。它需要在 C# 中
该类Texture2D包含应该完全按照您的意愿执行的GetData和方法。SetData
Texture2D
GetData
SetData
我发现了我的问题。
当我试图获取像素的颜色时,颜色的 Alpha 值为 0。这意味着颜色将是完全透明的。为了解决这个问题,我只需要将 Alpha 值更改为 255。
我认为这是因为我使用的是 jpg 文件。Jpg 文件不支持 Alpha 值。