diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-10-02 20:44:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-10-02 20:44:44 +0300 |
commit | 5f7192018eb81af1cf406999d8d7871b4f47cd31 (patch) | |
tree | baad096703fc06f690d371a4b4d0b81e770e77ea /source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl | |
parent | 04e4a0db0dec2f52b0059c58c32fc5fa423a0407 (diff) |
Eevee : SSR : Make sure to not apply Specular Occlusion to SSR.
This makes the metals shine more.
Previous behaviour was not correct.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl index 16b3283b624..e23effb854c 100644 --- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl @@ -136,7 +136,10 @@ vec3 eevee_surface_lit(vec3 N, vec3 albedo, vec3 f0, float roughness, float ao, vec2 uv = lut_coords(dot(N, V), roughness); vec2 brdf_lut = texture(utilTex, vec3(uv, 1.0)).rg; - ssr_spec = F_ibl(f0, brdf_lut) * specular_occlusion(dot(N, V), final_ao, roughness); + ssr_spec = F_ibl(f0, brdf_lut); + if (!(ssrToggle && ssr_id == outputSsrId)) { + ssr_spec *= specular_occlusion(dot(N, V), final_ao, roughness); + } out_light += spec_accum.rgb * ssr_spec * float(specToggle); /* ---------------- DIFFUSE ENVIRONMENT LIGHTING ----------------- */ @@ -308,7 +311,10 @@ vec3 eevee_surface_clearcoat_lit( vec2 uv = lut_coords(dot(N, V), roughness); vec2 brdf_lut = texture(utilTex, vec3(uv, 1.0)).rg; - ssr_spec = F_ibl(f0, brdf_lut) * specular_occlusion(dot(N, V), final_ao, roughness); + ssr_spec = F_ibl(f0, brdf_lut); + if (!(ssrToggle && ssr_id == outputSsrId)) { + ssr_spec *= specular_occlusion(dot(N, V), final_ao, roughness); + } out_light += spec_accum.rgb * ssr_spec * float(specToggle); uv = lut_coords(dot(C_N, V), C_roughness); @@ -533,15 +539,18 @@ vec3 eevee_surface_glossy_lit(vec3 N, vec3 f0, float roughness, float ao, int ss vec4 rand = texture(utilTex, vec3(gl_FragCoord.xy / LUT_SIZE, 2.0)); - /* Ambient Occlusion */ - vec3 bent_normal; - float final_ao = occlusion_compute(N, viewPosition, ao, rand.rg, bent_normal); - /* Get Brdf intensity */ vec2 uv = lut_coords(dot(N, V), roughness); vec2 brdf_lut = texture(utilTex, vec3(uv, 1.0)).rg; - ssr_spec = F_ibl(f0, brdf_lut) * specular_occlusion(dot(N, V), final_ao, roughness); + ssr_spec = F_ibl(f0, brdf_lut); + if (!(ssrToggle && ssr_id == outputSsrId)) { + /* Ambient Occlusion */ + vec3 bent_normal; + float final_ao = occlusion_compute(N, viewPosition, ao, rand.rg, bent_normal); + + ssr_spec *= specular_occlusion(dot(N, V), final_ao, roughness); + } out_light += spec_accum.rgb * ssr_spec * float(specToggle); return out_light; @@ -785,7 +794,10 @@ vec3 eevee_surface_glass(vec3 N, vec3 transmission_col, float roughness, float i /* Apply fresnel on lamps. */ out_light *= vec3(fresnel); - ssr_spec = vec3(fresnel) * F_ibl(vec3(1.0), brdf_lut) * specular_occlusion(NV, final_ao, roughness); + ssr_spec = vec3(fresnel) * F_ibl(vec3(1.0), brdf_lut); + if (!(ssrToggle && ssr_id == outputSsrId)) { + ssr_spec *= specular_occlusion(dot(N, V), final_ao, roughness); + } out_light += spec_accum.rgb * ssr_spec; |