When rendering volumes with Film > Transparent enabled, the alpha appears to be the wrong type (premultiplied/straight). In the 3D view it works as expected:
This is a known bug.
Is there any way to work around this?
It's a viewer issue only. Try compositing over a gray background using the alpha-over node. If the result is correct, then your file output (without the gray background, of course) will be correct as long as you store it as EXR or any other format with associated (premultiplied) alpha channel, as it's the only way to store pixels that are both transparent and emissive (which is what fire is). The resulting EXR will be fine to be composited over any background, and fire should look ok.
It looks like alpha simply isn't modelled for emissive volumes in the render. This makes sense because it's an addition rather than an absorption. If the final image is treated as pre-multiplied then alpha simply multiplies the background colour and it works. Perhaps this is what's intended in the current implementation? Otherwise I guess it could be faked by dividing the emission component by the final alpha value, although as colour is clamped this would break the hue for bright emissive volumes. Maybe tone mapping could lessen the effect.
Anyway, I'll try to get some positive alpha value for the emissive volume parts of a render...
Here's my test scene with two intersecting cubes. One with an emissive volume and the other with absorption:
A screenshot from (left) the 3D view and (right) the render.
I first tried to reconstruct the alpha for the emissive cube. I figured I'd guess the emissive colour is close to one and the alpha value is then close to the average colour value. Then merge the emissive alpha and real alpha with a maximum node. The gamma node is there because this didn't work so well and needed tweaking:
yes, I found the "set alpha" node but it was too late
The second approach was to render with a white background and then black. The difference should indicate any transparent parts of the scene. I'm still not entirely sure why but until I clamped the white background render (with the mix node) the subtraction gave no difference even though it was visually different. The result doesn't look as good as the previous method even though I thought it'd be more accurate.
The key here is multiplying the final image by alpha and taking the difference in colour to get just the emissive intensity in the transparent parts. Then adding that amount of alpha to the original.
Comparing this to the 3D view render below shows some colour issues. This is caused by alpha scaling the colour when its meant to be pre-multiplied. I tried a few tricks like the division I mentioned earlier but couldn't get anything that looked any better. The emissive cube looks pretty good, without alpha continuity issues in the previous attempts, although a little darker and more transparent.
Unfortunately, (as you mentionned), this issue is a bug.
There is a workaround however (as @NoviceInDisguise mentioned), which isn't ideal or 100% polished, but its a quick and dirty method to get the job done.
1. As you can see in the screenshot, I have the same issue (Note: This bug only applies to the 'Fire' flow type, the 'Fire & Smoke' type renders without issues).
2. Begin by ensuring that
Transparent is checked under
Film in the Render Properties Panel, and also that the PNG Type is set to
3. Next add a large plane behind the fire object. Ensure that it is wider than the bounds of the camera and is far enough back from the fire object as not to cast light onto it. Give it a simple deep blue emission shader, with strength set to 1. (Note: I've noticed a bug here in 2.74 whereby if there is an object behind the viewport display of the smoke and fire, it wont dispay properly. Don't worry though, this doesn't seem to affect the renders.)
4. Render the image and jump on into the
Compositing Screen Layout. Check the
Free Unused, and
Backdrop boxes below the Node Editor, and add in a
5. Hit Shift+A and go Matte>Keying, add this to the Node tree.
6. In the
Key Colour setting, use the Eye Dropper tool to sample the blue from the original render, this will mask out all hues from the render which display the selected colour. If the blue appears black, it's likely that you don't have the
Use Alpha check-box ticked on the
7. This should update the render automatically in the bottom left
Image Editor. If it has simply hover over the transparent render and hit F3. If not just give it another render, ensuring that the
Compositing check-box is ticked under the
Post Processing tab in the Render Properties Panel, and it should display the composite fine.
Et Voila, the final render! :) As I mentioned it's not a perfect solution, and where the blue was subtracted from the edge of the flame it has become slightly pink tinted, but for all intensive purposes it works okay, and colour correction could be applied either in Blender or in Photoshop/Gimp. Finger's crossed the bugs'll be fixed in the next release.
Note: I also posted this workaround in the following thread... Smoke+fire wispy and transparent in render, but fine in render preview
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?