Principled volume material renders incorrectly when exported as PNG with alpha channel

I made a very simple volume object to create an atmosphere for my scene, however, when I save the render, all the color is gone from the volume. Also the alpha of the image is wrong. I tried to convert to premultiplied alpha, which did make it better, but it did not fix the color issue.

Here’s what the render shows inside blender:

And what the saved image is:

I very well know emission volumes don’t work if you save them to a PNG, but this is principled volume, so it should really work. Any ideas why it doesn’t?

Blend file

The problem is caused by 2 different things: dynamic range and color space.

The image contains very bright values, brighter than pure white. Blender is able to show the picture in a way that looks nice thanks to its “filmic” color space which squeezes the brighness into something visible, but all of this apparently doesn’t export well to a png with a transparency layer.

You can export the data still by using a more advanced format like .exr. Try these settings:
export_settings
This is going to export the exact, full render data with all the nuances in the gradient and the full brightness values.

You can then open it in an image or video editing software. If you open it in an other software than Blender, it will probably look a little different, because they don’t have the same color space, but because we exported it in a full float format, it can easily be color corrected to fit that other software without degrading the image.


The solution I just presented will be a bit heavy (full float exr takes a lot of space). If this is not an option, you could also try exporting your image without transparency and use it additively, it visually looks close enough to an emissive volume that it might work.

2 Likes

Is there a standard (or rule-of-thumb) method?

Or, is it trial and error?

Thanks

As far as I know, color doesn’t have a standard and can’t really ever have one. Color is a completely subjective experience: we can’t even know for sure if everyone sees color the exact same way. Also, computer art will have to be displayed on a bunch of different monitors.

Of course, there can be some science done with sensors, wavelenghts and imitating cameras, but the various color spaces and techniques that exist are based in part on what people judged looked good to the human eye.

2 Likes

Glowing things don’t work well in transparent .pngs, go ask @troy_s if you need to know why (buckle up)

Maybe this will help:

2 Likes

Thanks, but this won’t work for me unfortunately, I really need this image as a png with alpha channel, in a non additive mode.

Thank you. I have seen this vid, but it doesn’t really apply here, it is about bloom, but I have volumetric here, and not emissive volumes, at that. This is principled volume.

The core issue is the way that PNG stores alpha, regardless of the source

2 Likes

Could you tell us more about how this image is going to be used?

Also, even though your image is not emissive, it’s lit so brightly and so evenly that it’s acting almost like it is. If you were to render it on a non-transparent background and use it as additive, I think there is a good chance it would be pretty close. It doesn’t have to be additive either, you could try other blending modes too if that’s supported where you intend to use it.

An other possibility: save the image without transparency and have the color double as the opacity mask, the brighter parts of your volume seem like they are the most opaque anyway.

It’s gonna be a skybox for a game which only accepts pngs. I’ll give your method a go. Also, would it be possible to somehow “compress” the brightness while still in blender to be 0-1, but still looking the same? That way it may work when saved as a png.

The brightness is already compressed in the final image as long as you don’t save with transparency. If you deactivate the transparency and just save in png, it should look the same it did in Blender.

Gosh that’s an embarrassing video.

TL;DR: The video is lost. Alpha is very basic; RGB is the magnitude of tristimulus, and alpha is the degree of occlusion. Blooms are purely additive, and as such, FG.RGB + (1.0 - Alpha) * BG.RGB is all you need. And nearly every piece of software fucks this up because of similar buffoonery as present in that video. Blender also fucks this up, with the sole exception being float EXRs. The entire alpha pipe is pooched in Blender thanks to woefully broken encodings like PNG. Pure garbage encoding that should never have been adopted, and sure as fuck shouldn’t be default in Blender.

1 Like