summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-23 23:10:34 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-23 23:10:34 -0300
commit81c9cfdc1b4df336ba3cd01024e01c3a65ee4797 (patch)
tree3a34b1147ddac28a3b35bdb5fbc4f82951f7a01a /drivers/gles3/shaders
parent3c857033df954b481fb6ba9545b074588b1aee02 (diff)
Added light affect parameter to baked AO
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r--drivers/gles3/shaders/scene.glsl5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 0eb26ae58f..25115bc18a 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1536,6 +1536,7 @@ void main() {
#if defined(ENABLE_AO)
float ao=1.0;
+ float ao_light_affect=0.0;
#endif
float alpha = 1.0;
@@ -1920,9 +1921,13 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_AO)
ambient_light*=ao;
+ ao_light_affect = mix(1.0,ao,ao_light_affect);
+ specular_light*=ao_light_affect;
+ diffuse_light*=ao_light_affect;
#endif
+
//energu conservation
diffuse_light=mix(diffuse_light,vec3(0.0),metallic);
ambient_light=mix(ambient_light,vec3(0.0),metallic);