Volume material doen't write alpha in Eevee #60005

Closed
opened 2018-12-31 10:19:00 +01:00 by sebastien · 8 comments

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

**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
Author

Added subscriber: @sebastientricoire

Added subscriber: @sebastientricoire
Clément Foucault was assigned by Sebastian Parborg 2018-12-31 14:12:35 +01:00

Added subscriber: @JoelArt

Added subscriber: @JoelArt

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.

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.

Added subscriber: @Sereda

Added subscriber: @Sereda
Author

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/

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/

This issue was referenced by 3146a07e3e

This issue was referenced by 3146a07e3ecff46e4b006e761de2ac04af09d370

@sebastientricoire 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.

@sebastientricoire 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.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#60005
No description provided.