Reputation: 154
I want to change alpha-channel of RenderedTexture, that is target of camera. I know, I can GetPixels from Texture2d and SetPixels to another Texture2d. But how can I copy pixels from my own .psd texture (I need only alpha-channel pixels) and pass it into RenderTexture?
UPD: I can ReadPixels to temp texture from RenderTexture, but how can I GetPixels and SetPixels for only one channel?
Upvotes: 0
Views: 2169
Reputation: 439
Have a look here...
http://answers.unity3d.com/questions/902538/change-alpha-channel-of-a-texture-in-code.html
To quote: "A texture doesn't have one value for alpha that spans the entire texture, instead, the alpha channel is per pixel.
To copy the alpha channel from one texture to another, you have to pass through the texture in its entirety, pixel by pixel, and copy each pixel's alpha channel over."
Upvotes: 1