Fix #114691: EEVEE-Next: Dithered transparency closure weights
Remove transparency weight from other closure weights. Since closure weights take transparency into account, scaling closure colors by their weight applies alpha pre-multiplication to them, causing dithered transparency materials to be darker than they should be. Pull Request: https://projects.blender.org/blender/blender/pulls/117675
This commit is contained in:
parent
8315143c59
commit
f9a0e825c6
|
@ -47,6 +47,15 @@ void main()
|
|||
|
||||
float thickness = nodetree_thickness();
|
||||
|
||||
/** Transparency weight is already applied through dithering, remove it from other closures. */
|
||||
float transparency = 1.0 - average(g_transmittance);
|
||||
float transparency_rcp = safe_rcp(transparency);
|
||||
g_emission *= transparency_rcp;
|
||||
g_diffuse_data.weight *= transparency_rcp;
|
||||
g_translucent_data.weight *= transparency_rcp;
|
||||
g_reflection_data.weight *= transparency_rcp;
|
||||
g_refraction_data.weight *= transparency_rcp;
|
||||
|
||||
g_diffuse_data.color *= g_diffuse_data.weight;
|
||||
g_translucent_data.color *= g_translucent_data.weight;
|
||||
g_reflection_data.color *= g_reflection_data.weight;
|
||||
|
|
|
@ -50,6 +50,15 @@ void main()
|
|||
|
||||
g_thickness = max(0.0, nodetree_thickness());
|
||||
|
||||
/** Transparency weight is already applied through dithering, remove it from other closures. */
|
||||
float transparency = 1.0 - average(g_transmittance);
|
||||
float transparency_rcp = safe_rcp(transparency);
|
||||
g_emission *= transparency_rcp;
|
||||
g_diffuse_data.weight *= transparency_rcp;
|
||||
g_translucent_data.weight *= transparency_rcp;
|
||||
g_reflection_data.weight *= transparency_rcp;
|
||||
g_refraction_data.weight *= transparency_rcp;
|
||||
|
||||
g_diffuse_data.color *= g_diffuse_data.weight;
|
||||
g_translucent_data.color *= g_translucent_data.weight;
|
||||
g_reflection_data.color *= g_reflection_data.weight;
|
||||
|
|
Loading…
Reference in New Issue