Fix T63393 Eevee: Specular Shader's Clear Coat does not function

This commit is contained in:
Clément Foucault 2019-04-30 14:07:16 +02:00
parent d1f6ea2793
commit 2445d5abc2
Notes: blender-bot 2023-02-14 03:05:16 +01:00
Referenced by issue #63393, Eevee Specular Shader's Clear Coat does not function
3 changed files with 21 additions and 9 deletions

View File

@ -591,6 +591,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
datatoc_lit_surface_frag_glsl,
datatoc_lit_surface_frag_glsl,
datatoc_lit_surface_frag_glsl,
datatoc_lit_surface_frag_glsl,
datatoc_volumetric_lib_glsl);
e_data.volume_shader_lib = BLI_string_joinN(datatoc_common_view_lib_glsl,

View File

@ -44,6 +44,14 @@ uniform int hairThicknessRes = 1;
#define CLOSURE_GLOSSY
#endif /* SURFACE_DEFAULT */
#if !defined(SURFACE_DEFAULT_CLEARCOAT) && !defined(CLOSURE_NAME)
#define SURFACE_DEFAULT_CLEARCOAT
#define CLOSURE_NAME eevee_closure_default_clearcoat
#define CLOSURE_DIFFUSE
#define CLOSURE_GLOSSY
#define CLOSURE_CLEARCOAT
#endif /* SURFACE_DEFAULT_CLEARCOAT */
#if !defined(SURFACE_PRINCIPLED) && !defined(CLOSURE_NAME)
#define SURFACE_PRINCIPLED
#define CLOSURE_NAME eevee_closure_principled

View File

@ -3428,15 +3428,18 @@ void node_eevee_specular(vec4 diffuse,
out Closure result)
{
vec3 out_diff, out_spec, ssr_spec;
eevee_closure_default(normal,
diffuse.rgb,
specular.rgb,
int(ssr_id),
roughness,
occlusion,
out_diff,
out_spec,
ssr_spec);
eevee_closure_default_clearcoat(normal,
diffuse.rgb,
specular.rgb,
int(ssr_id),
roughness,
clearcoat_normal,
clearcoat * 0.25,
clearcoat_roughness,
occlusion,
out_diff,
out_spec,
ssr_spec);
vec3 vN = normalize(mat3(ViewMatrix) * normal);
result = CLOSURE_DEFAULT;