Fix T71402 EEVEE: Transparent material add volume scattering

This adds correct scattering handling by removing the extra light added
to opaque pass.

Also fix T69062 EEVEE alpha blend and volumetrics
This commit is contained in:
Clément Foucault 2020-01-14 16:47:54 +01:00
parent ba5bbf14f9
commit 39d5d11e02
Notes: blender-bot 2023-02-14 10:21:15 +01:00
Referenced by issue #71402, Transparent objects are visible inside volumetric materials (eevee)
Referenced by issue #69062, EEVEE alpha blend and volumetrics
1 changed files with 5 additions and 0 deletions

View File

@ -934,6 +934,11 @@ void main()
vec3 vol_transmit, vol_scatter;
volumetric_resolve(uvs, gl_FragCoord.z, vol_transmit, vol_scatter);
/* Removes part of the volume scattering that have
* already been added to the destination pixels.
* Since we do that using the blending pipeline we need to account for material transmittance. */
vol_scatter -= vol_scatter * cl.transmittance;
outRadiance = vec4(cl.radiance * vol_transmit + vol_scatter, alpha * holdout);
outTransmittance = vec4(cl.transmittance, transmit * holdout);
# else