From 96e8dadda0b2dda7ce771b1eba2d901a056a039f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 4 Nov 2020 17:16:06 +0100 Subject: Fix T82385 EEVEE: Alpha Clip shadows actually using Alpha Hashed shadows The shadow path was not using the alpha threshold. --- .../shader/nodes/node_shader_output_material.c | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c index 578262e9f17..fb0b6e7b263 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c @@ -45,18 +45,29 @@ static int node_shader_gpu_output_material(GPUMaterial *mat, GPUNodeStack *in, GPUNodeStack *out) { - GPUNodeLink *outlink, *alpha_threshold_link; - + GPUNodeLink *outlink, *alpha_threshold_link, *shadow_threshold_link; Material *ma = GPU_material_get_material(mat); - if (ma && ma->blend_method == MA_BM_CLIP) { - alpha_threshold_link = GPU_uniform(&ma->alpha_threshold); + + static float no_alpha_threshold = -1.0f; + if (ma) { + alpha_threshold_link = GPU_uniform((ma->blend_method == MA_BM_CLIP) ? &ma->alpha_threshold : + &no_alpha_threshold); + shadow_threshold_link = GPU_uniform((ma->blend_shadow == MA_BS_CLIP) ? &ma->alpha_threshold : + &no_alpha_threshold); } else { - static float no_alpha_threshold = -1.0f; alpha_threshold_link = GPU_uniform(&no_alpha_threshold); + shadow_threshold_link = GPU_uniform(&no_alpha_threshold); } - GPU_stack_link(mat, node, "node_output_material", in, out, alpha_threshold_link, &outlink); + GPU_stack_link(mat, + node, + "node_output_material", + in, + out, + alpha_threshold_link, + shadow_threshold_link, + &outlink); GPU_material_output_link(mat, outlink); return true; -- cgit v1.2.3