Hey guys, this is something I've thought could be useful many times but I've yet to find out how to do it if it's possible at all.
Basically at the moment I'm creating a texture for a terrain where each of the channels corresponds to what texture will be used. So I have a base texture for my terrain then 4 other textures given by the R, G, B and A components of the image. The base texture is determined by the leftover, ie the black parts of the image.
So in the shader it'll look something like this.
colour += texture1 * image.R;
colour += texture2 * image.G;
colour += texture3 * image.B;
colour += texture4 * image.A;
colour += baseTexture * (255 - image.R + image.G + image.B + image.A);
That's not really important for my issue but it's the background to the problem. To achieve the image I want I split it into layers in photoshop for each of the different colours, I pick the areas where I want the different textures and colour them in with their respective colour. But to add a little noise around the mid-height of the terrain I took the greyscale heightmap, removed the low and high values so I'm left with the middle values then added some noise and did some other things to it so I'm left with some nice noisy white values on a black background. I colourised the white to green (the channel colour for that texture) but now I'm left with green on a black background.
What I need is the green on a transparent background. The green goes smoothly down from 255 to 0 so using the magic wand to select the black parts and delete them wouldn't work, I'd either still be left with a black halo around the green or lose the blurriness around the green parts.
My question is, is it possible to convert the darkness of that layer to its transparency.What I want is the same as if I took a completely transparent layer and painted each bit of green with the paintbrush so the green blurred into the transparency of the layer. Is it possible to get this from the darkness of the pixels?
Basically at the moment I'm creating a texture for a terrain where each of the channels corresponds to what texture will be used. So I have a base texture for my terrain then 4 other textures given by the R, G, B and A components of the image. The base texture is determined by the leftover, ie the black parts of the image.
So in the shader it'll look something like this.
colour += texture1 * image.R;
colour += texture2 * image.G;
colour += texture3 * image.B;
colour += texture4 * image.A;
colour += baseTexture * (255 - image.R + image.G + image.B + image.A);
That's not really important for my issue but it's the background to the problem. To achieve the image I want I split it into layers in photoshop for each of the different colours, I pick the areas where I want the different textures and colour them in with their respective colour. But to add a little noise around the mid-height of the terrain I took the greyscale heightmap, removed the low and high values so I'm left with the middle values then added some noise and did some other things to it so I'm left with some nice noisy white values on a black background. I colourised the white to green (the channel colour for that texture) but now I'm left with green on a black background.
What I need is the green on a transparent background. The green goes smoothly down from 255 to 0 so using the magic wand to select the black parts and delete them wouldn't work, I'd either still be left with a black halo around the green or lose the blurriness around the green parts.
My question is, is it possible to convert the darkness of that layer to its transparency.What I want is the same as if I took a completely transparent layer and painted each bit of green with the paintbrush so the green blurred into the transparency of the layer. Is it possible to get this from the darkness of the pixels?