SOLVED: Render raytraced glass WITH alpha channel

Hi all,

having some issues rendering a glass with refractions and reflections that writes to the alpha channel of the output image in the same way that Z-transparency would. I’ve managed to get a composite setup that renders an image that looks correct to me, but when i save to an rgba png or TGA the image has no useful alpha channel. I’m trying to use the technique outlined here:

specifically that page says:

To set the Alpha value of an object AND use raytracing, set the Pass Index the object (Object and Links panel). Render the image using Ray Transp and the Index pass (Render Layer panel). Then use the Index OB node to mask it out and the Set Alpha node to set the alpha for that portion of the image.

( which doesnt really make much sense to me ).

Basically I need a pint glass rendered with nice reflections and refractions, but with alpha transparency, so the image is transparent where nothing is being reflected in the glass.

my blend is here ( 2.54 beta ):


i’d greatly appreciate any help that anyone can give. If you render the image it looks nearly exactly right in the composite render result, but the saved image does not work :no:

The alpha output should be the same as what you see as alpha channel in composite, as long as you have checked RGBA in render/output tab, by default it’s RGB.
Use png, or tga.

Yeah Im definitely using a 4-channel output format in the render settings and have tried saving the file as both PNG and TGA, unfortunately the alpha channel is blank when I load the png or tga into photoshop.

In the composite view, the combined ( RGB multiplied with alpha ) output looks right - however the straight alpha output ( again in render result view ) is blank which seems weird as it should be a monochrome rendition of the composite shouldn’t it?

Heres a couple of screenshots to show whats happening:

( Composite RGB output )

( Composite RGBA - looks exactly what im after )

( Straight Alpha output - definitely seems wrong )

( Node setup - trying to follow what it says to do on the wiki, probably not correct tho )

The idea for this project is to create a preloader for a flash piece - you guessed it the glass gradually fills with beer as the site loads - it needs to be realistic ( so requires IOR and fresnel rather than z-transparency ) but also needs to have the correct alpha information in the image to work in the site.

please help if you know what Im doing wrong - spent most of the day on this and no joy!

RGBA has to be on.
Shading Alpha set to “pre-multiplied.”

Nodes not necessary.

Render attached.


beer_glass_sooo_alpha.blend (763 KB)

Brilliant - Thanks Pappy exactly the result i was after