Page MenuHome

Volume material doen't write alpha in Eevee
Closed, ResolvedPublic

Description

System Information
Operating system: linux mint-x86_64
Graphics card: GTX 1060

Blender Version
Broken: blender-2.80-e4dbfe0a98c1-linux-glibc224-x86_64

Short description of error

smoke doesn’t seem to be opaque when using principled volume shader in eevee with transparent background.
It works well in Cycles with the same shader.

Exact steps for others to reproduce the error
just create a smoke domain with a volume shader, activate transparent background and render

Event Timeline

Sebastian Parborg (zeddb) lowered the priority of this task from 90 to 50.

Volume doesn't produce alpha channel in Cycles either. When I try to render out fire made with Smoke Domain it does not produce any alpha channel when making the background transparent (Properties panel>Render>Film>Transparent) neither F12 render nor a png sequence.

ok guys, i just compile blender to find where the problem comes and i think i found it

in the volumetric_lib.glsl in blender/draw/engines/eevee/shaders "volumetric_resolve" function return "scene_color.a" in his alpha channel:

return vec4(scene_color.rgb * transmittance + scattering, scene_color.a);

by changing it in:
float alpha_transmittance = (0.2126 * transmittance.r-scattering.r) + (0.7152 * transmittance.g-scattering.g) + (0.0722 * transmittance.b-scattering.b);
float alpha_scattering = (0.2126 * scattering.r) + (0.7152 * scattering.g) + (0.0722 * scattering.b);
return vec4(scene_color.rgb * transmittance + scattering, 1.0-(1.0-scene_color.a)*alpha_transmittance+alpha_scattering);

well, i got something pretty good.
i used those value to get luminance of rgb transmitance and scattering based on the Photometric/digital ITU BT.709 luma conversion formula
did i do something corect or is it a better/cleaner way to do it? is there a standard luminance convertion function in blender?

If i can commit it it will be my first contribution to blender code \o/

@sebastien (3dsman) Thank you for the patch! It was not completely correct so I fixed it.
Scattering should not produce alpha as it is just how much light is reflected towards the viewer.
Transmittance however is how much of light pass through the medium so that can considered as alpha.
I also try to avoid component specific weighting since it can change depending on the color space you use.
Also one change needed to be made for alpha blended surfaces.