Fix T88766 EEVEE: Missing glossy reflections with Shader to RGB & SSR is active.

This was due to the shading evaluation being outdated inside the ShaderToRGBA
glsl code.
This commit is contained in:
Clément Foucault
2021-10-13 20:51:15 +02:00
parent d39cd851c0
commit 10abaf3ddf

View File

@@ -1,14 +1,22 @@
#ifndef VOLUMETRICS
CLOSURE_EVAL_FUNCTION_DECLARE_1(node_shader_to_rgba, Glossy)
void node_shader_to_rgba(Closure cl, out vec4 outcol, out float outalpha)
{
vec4 spec_accum = vec4(0.0);
if (ssrToggle && FLAG_TEST(cl.flag, CLOSURE_SSR_FLAG)) {
vec3 V = cameraVec(worldPosition);
CLOSURE_VARS_DECLARE_1(Glossy);
vec3 vN = normal_decode(cl.ssr_normal, viewCameraVec(viewPosition));
vec3 N = transform_direction(ViewMatrixInverse, vN);
float roughness = cl.ssr_data.a;
float roughnessSquared = max(1e-3, roughness * roughness);
fallback_cubemap(N, V, worldPosition, viewPosition, roughness, roughnessSquared, spec_accum);
in_Glossy_0.N = N; /* Normalized during eval. */
in_Glossy_0.roughness = cl.ssr_data.a;
CLOSURE_EVAL_FUNCTION_1(node_shader_to_rgba, Glossy);
spec_accum.rgb = out_Glossy_0.radiance;
}
outalpha = saturate(1.0 - avg(cl.transmittance));