Using alpha channel on image in compositing?


I’ve been following tutorial in which it is explained how to create flag that is waving in the wind.

Unlike most other tutorials on this topic, this one doesn’t really use textures on the material, but instead uses UV data (Cycles must be enabled as render engine), and then uses “map UV” node in compositor to map whatever image on that flag.
And it works ok as long as the image is in rectangle shape.

But, what if I want to make something that has alpha channel? For instance, Nepal flag?

I guess there should be way to enable transparency in compositor, but I wasn’t able to do that. Could someone please help?
Also, since I am still beginner and I’m struggling to understand nodes, compositor, shader… Is there any reason why this approach with compositor is better vs approach of using textures?

Thanks! :slight_smile:

A flag does not have to be square. Build a shape that correctly matches the proportions of the underlying map image, then map it onto the image. Both the geometry of the pennant and the associated UV map can be arbitrary shapes.

I would put that map-image as a background in the design window so that you can very accurately construct a polygon to match it. Then, UV-map it onto the image: the map-region shape will of course match the object geometry.

Yes, that is definitely one way to approach this situation, and I would know how to do that. But what I really would like is to learn how to use alpha channel with textures.
I’ve solved this “problem” using regular shader, but not really using compositor. Maybe this approach with compositor doesn’t make sense at all, but if that’s the case I would like to know why?
Sorry, this question is maybe stupid, but since I’m still beginner who struggles with a lot of different concepts in Blender, I would like to really understand some things and not just repeat them mechanically.

Thanks :slight_smile:


What you’ve done is the way to go !
With the compositor you can do greenscreen keying to create an alpha channel from a video .
It’s the technique used in VFX when an actor is filmed behind a greenscreen. That’s one of the way to get an alpha channel from an image that don’t have one. But as your flag is in 3D it’s much simpler to do that in the shader and you get a much better result.

You can see the technique here :

Maybe that was something along these line you had in mind ?

Hum, I may have answered a bit too quicky, forget about the greenscreen…
You’ve used Map UV in the compositor to get something in the flag, but you can actally do something much simpler, by putting the flag texture in the shader and also get the transparency.

Using map uv node in the compositor is more complicated and maybe not needed in your case.

Thanks, great!
Now I feel as if I’ve really learned something :slight_smile:
Btw, I will definitely also try using Blender for keying out greenscreen footage. Thanks for that tip!