Fix T60005: Eevee: Volume material doen't write alpha
This commit is contained in:
parent
31fba57677
commit
3146a07e3e
Notes:
blender-bot
2023-02-14 04:15:57 +01:00
Referenced by issue #60005, Volume material doen't write alpha in Eevee
|
@ -834,7 +834,8 @@ void main()
|
|||
# if defined(USE_ALPHA_BLEND_VOLUMETRICS)
|
||||
/* XXX fragile, better use real viewport resolution */
|
||||
vec2 uvs = gl_FragCoord.xy / vec2(2 * textureSize(maxzBuffer, 0).xy);
|
||||
fragColor = volumetric_resolve(vec4(cl.radiance, cl.opacity), uvs, gl_FragCoord.z);
|
||||
fragColor.rgb = volumetric_resolve(vec4(cl.radiance, cl.opacity), uvs, gl_FragCoord.z).rgb;
|
||||
fragColor.a = cl.opacity;
|
||||
# else
|
||||
fragColor = vec4(cl.radiance, cl.opacity);
|
||||
# endif
|
||||
|
|
|
@ -151,5 +151,8 @@ vec4 volumetric_resolve(vec4 scene_color, vec2 frag_uvs, float frag_depth)
|
|||
vec3 scattering = texture(inScattering, volume_cos).rgb;
|
||||
vec3 transmittance = texture(inTransmittance, volume_cos).rgb;
|
||||
|
||||
return vec4(scene_color.rgb * transmittance + scattering, scene_color.a);
|
||||
/* Approximate volume alpha by using a monochromatic transmitance
|
||||
* and adding it to the scene alpha. */
|
||||
float final_alpha = mix(1.0, scene_color.a, dot(transmittance, vec3(1.0 / 3.0)));
|
||||
return vec4(scene_color.rgb * transmittance + scattering, final_alpha);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue