diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-27 15:40:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-06-27 15:41:35 +0300 |
commit | 2a22b8af04eb2edccfd3d378b8e279bec54639e0 (patch) | |
tree | a87fc64f39a65f46b1cacd1927c3896c332fce8c /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | |
parent | 1f4e9754c02891076ffe5c29a2d7c030aace219c (diff) |
Eevee: Make use of dual source blending for volumetric resolve
This simplify the code and add an example use of dual source
blending.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index c332f68728f..3a31afc0224 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -899,7 +899,10 @@ Closure nodetree_exec(void); /* Prototype */ # if defined(USE_ALPHA_BLEND) /* Prototype because this file is included before volumetric_lib.glsl */ -vec4 volumetric_resolve(vec4 scene_color, vec2 frag_uvs, float frag_depth); +void volumetric_resolve(vec2 frag_uvs, + float frag_depth, + out vec3 transmittance, + out vec3 scattering); # endif # define NODETREE_EXEC @@ -914,7 +917,9 @@ void main() # if defined(USE_ALPHA_BLEND) /* XXX fragile, better use real viewport resolution */ vec2 uvs = gl_FragCoord.xy / vec2(2 * textureSize(maxzBuffer, 0).xy); - fragColor.rgb = volumetric_resolve(vec4(cl.radiance, cl.opacity), uvs, gl_FragCoord.z).rgb; + vec3 transmittance, scattering; + volumetric_resolve(uvs, gl_FragCoord.z, transmittance, scattering); + fragColor.rgb = cl.radiance * transmittance + scattering; fragColor.a = cl.opacity; # else fragColor = vec4(cl.radiance, cl.opacity); |