Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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:
    https://www.youtube.com/watch?v=K8SWiSlOznI

    Comment


      #3
      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?

      Comment


        #4
        Try to limit the amount of green you mask out with a Clamp node.
        FREE Lightshow
        FREE VR Drum Kit Project

        FREE Color LUT Collection
        FREE Physics Driven Spacecraft Project
        FREE GTA Style Vehicle Interaction
        Dynamic DoF(Depth of Field)
        Camera Crossfade

        Comment


          #5
          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.

          Comment


            #6
            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

            Comment


              #7
              Originally posted by Michael Noland View Post
              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.

              Comment


                #8
                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

                Comment


                  #9
                  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.

                  Comment


                    #10
                    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.

                    Comment


                      #11
                      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.

                      Comment


                        #12
                        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.

                        Comment


                          #13
                          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!

                          Comment


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

                            Click image for larger version

Name:	chroma_black.jpg
Views:	1
Size:	74.0 KB
ID:	1064958

                            Comment


                              #15
                              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?

                              Comment

                              Working...
                              X