From afffed5bf161b5972a02f055225701118ed5a4e7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 25 Sep 2022 20:15:03 +0300 Subject: [PATCH] Only apply ambient occlusion to the ambient lighting component --- shaderlib/cooktorrance.glsl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shaderlib/cooktorrance.glsl b/shaderlib/cooktorrance.glsl index 8a69d473..25289ed5 100644 --- a/shaderlib/cooktorrance.glsl +++ b/shaderlib/cooktorrance.glsl @@ -164,9 +164,8 @@ vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metaln color += cooktorrance_one_light_direct(normal, look, incoming.direction, base_color, metalness, roughness)*incoming.color*shadow; } - color += cooktorrance_environment(normal, look, base_color, metalness, roughness); - - color *= get_occlusion_value(); + float occlusion = get_occlusion_value(); + color += cooktorrance_environment(normal, look, base_color, metalness, roughness)*occlusion; if(use_emission) color += get_emission_color(); -- 2.45.2