Replace green with transparant color

I have this white plane with a green cube on top of it. What I want to achieve is to have the green pixels replaced with transparent ones. For the shading to be correct I need half transparent pixels. Does anyone know how to achieve this in the compositor?

The goal of this operation is to have a cube mask PNG file so I can put any arbitrary colour as background in order to colour the cube.


What is the desired use of the end result? If you just want to key the green out then you can simply use the Keying Node, just like a Green Screen.

I tried that one but the problem is my shadow on the floor isn’t “green” enough. There is still some glow on the floor.


Are you rendering in cycles? Do you want the shadow area to be transparent?

I’m rendering in cycles. I want the shadow on the floor to be half transparent. I think the problem is the shadow is not pure green and therefore not transparent.

Use a channel key instead, works better in my opinion, that way you can play with the threshold etc to get a soft key for that part.

The channel key worked! I had some spots around the borders and used a HUE correct node to remove the remaining green pixels. Thanks!

No problem, glad it did the trick.