9

I'm creating a simple fireball sprite for my game and I want to render a fire animation.

I would like to get the upper images with transparent background, but when is set the transparency on under Render -> Film one of my frames will look like lower pictures.

You can see the difference of these two images.

without transparency with transparency

David
  • 49,291
  • 38
  • 159
  • 317
  • This works for me in 2.76b – J Sargent Dec 12 '15 at 23:17
  • Oh. I am very sorry for asking it then... I was still using an obsolete version of Blender... – TheLast_BlenderBender Dec 13 '15 at 00:30
  • That's ok. Try using the latest version from Blender.org, it should work correctly. There are a lot of cool new features too :) – J Sargent Dec 13 '15 at 00:43
  • Also note that if you have an Emission Shader plugged into the Volume output it won't be visible against a transparent background unless you are rendering out to EXR format. I don't know what kind of node setup you have, but figured it wouldn't hurt to mention that. – Mentalist Dec 13 '15 at 02:10
  • I used the transparency setting with the latest Blender version, but something went wrong. I didn' t get the result I desired.

    Here's the image of the basic settings I use to test, whether my flame gets rendered. https://gyazo.com/f3829e2e83d284344ecd841473c4397a And here's my node system for domain. Not sure, but I think I have missed something important.

    https://gyazo.com/de7a3281fa693f06440e0924b8f68e2f

    – TheLast_BlenderBender Dec 13 '15 at 13:53
  • Related - http://blender.stackexchange.com/questions/41574/render-semi-transparent-volume-with-cycles ? – Mr Zak Jan 03 '16 at 13:20

2 Answers2

7

Blender's viewer is broken for that kind of images, so it's possible that your fire is rendered properly but the viewer isn't showing it correctly when you activated the "transparent" checkbox. Try to switch the channels preview setting in the viewer from "color and alpha" (RGBA) to "color" (RGB).

enter image description here

enter image description here

If after doing that you can see the fire on black background, then your output is ok. (The ball occludes and emits, while the fire only emits.)

The next step is making sure that you're exporting the image correctly: You'll have to use a format that supports associated alpha. As @mentalist mentioned, EXR is one of those formats. You'll have to make sure that the program where you're going to use that sprite supports EXR and associated alpha images, otherwise it won't be composited properly.

Keep in mind that PNG won't work for that, as it uses unassociated alpha.

EDIT:

On version 2.92 the viewer has been fixed, so you can see the proper associated alpha.

susu
  • 14,002
  • 3
  • 25
  • 48
Gez
  • 2,220
  • 18
  • 27
  • In 2.93 the issue srill persist and you get an empty image when rendering a tranparent background png. Using composition method results in a ugly green flame. – Ebi Oct 20 '21 at 13:32
2

The emission shader renders almost completely transparent to PNGs, I believe, because it is rendering no volume. You can use the Emission Strength and Emission Color properties of the Principled Volume shader to correct this, and then you don't need the emission shader. Shader Configuration

Transparent Fire

wizulus
  • 129
  • 1
  • Hey, I appreciate the downvotes.. What I'd appreciate more is some constructive criticism. This method works for me. How can I improve it? – wizulus Jan 27 '21 at 19:15
  • This worked for me too. The critical step seems to be setting "Density Attribute" to "flame". – Mike Playle Jun 13 '22 at 12:19