Removing a color from a material / texture or making it Transparent

Hi all, I have a green screened video texture I am trying to remove the green screen out of it or make it transparent I need help, So right now I can remove the green channel but this makes all the green in the video disappear, I want to just remove a specific green that makes up the green screen. can some one educate me here on how to do that? thanks for any help you can give.

You need to use Photoshop to create an Alpha Channel using the Green Colour.

Select the green area using the Quick-Selection tool in Photoshop, then go into the ‘Channels’ window and add a new Alpha Channel. Then save out the image as a 32-bit TGA file, and import it into the engine. You can use the alpha channel to make the green area transparent.

EDIT: Or follow this method:

Thank you for your help TheJamsh! but there is a problem here I am using a video texture, I can’t use Photoshop, there’s not a way to make a color transparent using the material editor?

Try to limit the amount of green you mask out with a Clamp node.

Thanks Jacky for the help i went ahead and tried that it does remove the green but doesn’t make it transparent I need the green to be transparent it also has a lot of anti aliasing going on.

Hi polemos,

Make sure you’ve got your material set to Translucent. The thing you need to do in your material is called chroma keying, and you’re trying to estimate an alpha value. Output this alpha value as the Opacity output in your material. The wiki page http://en.wikipedia.org/wiki/Chroma_key has a high-level survey but not a lot of practical info. For the simplest case, you’d just do something like alpha = Distance(KeyColor, CurrentColor) > Theshold ? 1 : 0, but you probably want a fuzzier value and to do something with the color as well to remove the key color from the fuzzy edges (I hazily remember something like R’=R,G’=Min(G,B),B’=B for greenscreening).

Cheers,
Michael Noland

Thanks Michael! Yea I should of just stated I am trying to do a chroma keying effect; is there anyway you can post a image of how each of these set ups would look inside the material editor? I am having trouble.

So I can’t get it to work, I just don’t know the material editor well enough to pull off what others are suggesting, I have a work around if anyone can tell me how do you control the blend amount using the Blend mode Additive, I need to limit the blend amount So the Blend Mode additive blends the pixels from the material and the background how do you control that blend amount? The reason why is the blend mode additive does what I want it removes a color from a texture black, I wish it was green but I have to work with black, but it also makes the rest of the texture transparent / blend with the background which I do not want. can anyone help

You could also make an opacity map using a video editing program like After Effects where it has better tools for Chroma keying and then plug that into your material.

That is a good suggestion and was thinking about it but wanted to avoid that approach, because that would force me to load in and play two videos for every clip instead of one, doubling the load and rendering.

There is also another way to do it. You can create a constant3 with the color you want to filter, then you multiply your texture’s RGB with that constant3 and then multiply it with a constant with a value of 0 (white). That should give you a good opacity map which would remove that specific color.

Keytotruth I thought you might of had it right, but that removed all the color from the texture it is just a black material now , but maybe I am missing something what blend mode do I use I tried them all but any more info could only help.

I got this to work Michael Nolands way but one quick problem I had to set the Material to Translucent, but how do I keep my material from being transparent can I control the amount of transparency with Translucent materials and if so how? Thanks you everyone for your help so far I almost got it!

Yes, you will have to set it to translucent. Here’s what I did to filter out a black background:

Thanks Furroy! but isn’t your video Transparent now that it is translucent? How do you make it not transparent when you use translucent blend?

Also Furroy I get a lot of black Anti Aliasing around the edges did you notice that? or know how to fix it?

Here is another ? so far the best look is using Blend Additive on a black screen black ground - but the problem with that is of course my texture is blending with the background making it transparent how do you control the amount of blending in additive mode / how to you determine the opacity value with out disrupting the inherent black background removal that comes with the blend additive mode? Thanks again for any help I hope I can return the favor someday.

I still can not figure out how to control the amount of opacity in a Translucent or Additive material, can anyone out there help??

Furroy I ended up using your technique but have black speckles everywhere on the edges you or anyone else know how to remove those

well that is the whole point of doing green screen, it’s much easier to remove cleanly. you might be able to use a contrast or cheapcontrast node before the ceiling node to help.