Maniphest T96200

Fire not showing in saved PNG
Closed, Duplicate

Assigned To
None
Authored By
Andreas Becker (AndreasBecker)
Mar 6 2022, 4:58 PM
Tags
  • BF Blender
Subscribers
Andreas Becker (AndreasBecker)
Ethan Hall (Ethan1080)
Germano Cavalcante (mano-wii)
Omar Emara (OmarSquircleArt)
Pratik Borhade (PratikPB2123)

Description

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 780/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.98

Blender Version
Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-03-04 16:11, hash: rB295d5c6ef5b9

  • Also broken with 3.1 RC (downloaded 2022-03-06) and 3.0.1 Release

Worked: Unknown

Short description of error
When rendering a smoke/fire simulation, the fire shows in Blender's image editor after rendering, but not in the saved image.
In this example screenshot, you can see the render result in Blender's image editor (on the left) and the saved image (on the right), opened with my default image viewer. I also tried another image viewer as well as GIMP, which both showed the same result, just like the Windows image preview. The grey background in the image viewer (as opposed to checkerboard) is the viewer's background color, not the actual color of the image, which is instead transparent.

Exact steps for others to reproduce the error

  1. Open Blender (default settings, right after downloading)
  2. Set render engine to Cycles
  3. Enable Film > Transparent (bug doesn't happen with this option disabled)
  4. Add "Quick Smoke" effect to the default cube
  5. Set the flow type of the cube to "Fire" (bug doesn't happen with "Smoke" or "Fire + Smoke")
  6. In the material of the smoke domain, add an attribute node, set it to "flame", and connect its "Fac" output to the "Blackbody Intensity" input of the Principled Volume node (so the fire actually shows up in render)
  7. Render frame 1, where the fire is clearly visible in the image editor inside Blender (bug also happens after ESC-ing the rendering process before it finishes)
  8. Go to "Image" > "Save Image As..." and save the image in PNG file format and with RGBA color channels (fire is shown as intended when saving in JPG format, which doesn't support transparency)
  9. Open the saved image, where the fire is not visible (but its light on the cube is visible)

Thank you to all developers for your work on Blender, I really love this software!

Event Timeline

Andreas Becker (AndreasBecker) created this task.Mar 6 2022, 4:58 PM
Andreas Becker (AndreasBecker) updated the task description.Mar 6 2022, 7:01 PM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).Mar 7 2022, 7:22 AM
Omar Emara (OmarSquircleArt) changed the task status from Needs Triage to Needs Information from User.Mar 7 2022, 9:23 AM
Omar Emara (OmarSquircleArt) added a subscriber: Omar Emara (OmarSquircleArt).

I can't replicate this issue. Attached is the output PNG image I get and the file that follows your instructions. Does this image and file have the same issue you described? If not, can you attach the image and file you got?

Andreas Becker (AndreasBecker) added a comment.EditedMar 7 2022, 5:14 PM

Hi Omar,

for me, your file has the same issue I described in my original post.

I attached your file again after saving it on my system, maybe there is some difference between the two versions (your upload and mine) that causes this issue.

I'll also try to replicate this on my old laptop later. That laptop runs on Linux Mint and has an integrated GPU, so it shouldn't be quite different in that sense.
Edit: I tried on my Linux laptop now with Omar's file, but it also gave me the same result: It shows the fire as expected inside Blender after rendering, but when I save and open the image, the fire is gone.
Edit2: On my laptop, I have Blender 3.0.0 installed. It runs Linux Mint 20.3 Cinnamon and has an Intel Core i5 2430M with integrated graphics controller.

Omar Emara (OmarSquircleArt) added a comment.Mar 7 2022, 7:54 PM

Are you sure it is just not related to how the application you use to view the image is handling alpha? Some applications don't handle different cases of alpha like premultiplication well. Does the image I attached above get viewed correctly for you or is it just the same?

Andreas Becker (AndreasBecker) added a comment.Mar 7 2022, 9:27 PM

Here is a screenshot of my saved render (left) vs. your image from above, both opened in the same application. As you can see, the cube in my render has sharp edges, whereas in your image, the fire shows up correctly.

Here is my render, just to check if that is displayed correctly for you.

And here is a full resolution screenshot of that same render in my viewer application

There seems to be a very faint hint of the fire in the image, but it's far less than in Blender.

Omar Emara (OmarSquircleArt) changed the task status from Needs Information from User to Needs Triage.Mar 7 2022, 9:28 PM
Ethan Hall (Ethan1080) added a subscriber: Ethan Hall (Ethan1080).Mar 7 2022, 9:57 PM
Ethan Hall (Ethan1080) added a comment.EditedMar 7 2022, 10:19 PM

It seems like the image viewer and compositor perform some tone mapping that causes bright transparent values to contribute to the alpha. However, the alpha channel is not modified when saving the image. The same problem happens when using bloom and transparency, particularly when using EEVEE's bloom.

Note that you can save the render as an EXR. Then, when you load the image back into Blender, Blender will reintroduce the tone mapping to the alpha channel and you can use the image in the compositor as expected. Then if you save the composite without alpha, there will not be a discrepancy between Blender's internal image viewer and an external image viewer.

Also, node that if you enable Convert Premultiplied, the alpha is not effected in the same way.

Germano Cavalcante (mano-wii) added a subscriber: Germano Cavalcante (mano-wii).Mar 8 2022, 3:58 PM

It's the same problem described in T81199: Some effects [bloom, smoke, fire, ..] still don't save in PNG with transparent background (occlusion vs. emission).
Basically, Alpha + Emission + PGN don't get along well together.
That's because an emission like fire, although visible, can still have alpha 0.0, and PNG sees this as invisible.
Maybe the PNG codec needs to be edited to do a correct emission + alpha conversion.

Ethan Hall (Ethan1080) added a comment.Mar 9 2022, 4:18 AM

@Germano Cavalcante (mano-wii) I would like to see two additional checkbox options for the PNG RGBA format.

  1. Clean Alpha: Set RGB pixels to black if the pixel is fully transparent.
  2. Modify Alpha: Modify the alpha channel to correctly represent the image when used as a straight alpha.