Added light affect parameter to baked AO

This commit is contained in:
Juan Linietsky 2017-09-23 23:10:34 -03:00
parent 3c857033df
commit 81c9cfdc1b
5 changed files with 34 additions and 0 deletions

View file

@ -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);