Render Glass like materials with Alpha Channel to composite in external app Hope you can help me with some issues I've been dealing these days.

As I'm rendering products, most of the time I need to render some transparent materials in order to do a post-pro in Photoshop, change the backgrounds, superpose images, etc.

I've been looking for an answer but yet I've couldn't get a solution for this problem.

I need to render materials with transparency and no background in Cycles.

I've found that there are two ways to do this:


Render with transparency in the materials. 
Render and get two renders, the original and another one only with the alpha channel to edit in Photoshop.


For the first option, I've achieved to render a glass-like material, as PET plastic using this node tree:



For the second option, I haven't found a way to get the alpha channel in cycles that includes the object with transparency and, if possible, the shadows in the background| but without the background.
Newer builds of Cycles (post 2.79, currently available from the buildbot) include a native functionality for this:



This is activated by enabling the new "transparent glass" option in the "Film" panel. The normal "transparent" option must be activated as well, or "transparent glass" will be greyed out. There is also a "roughness threshold" control, which allows you to have only clear glass transparent, with frosted glass blocking alpha. Alpha transparency will only be enabled for glass with roughness below the set value. Above a certain roughness, you're usually better off getting blurred refractions from whatever environment/HDRI you're using for reflections. The default setting of 0.1 is pretty decent cutoff point to start with.