Imrpove RTAO and SSGI and add the option to make them take the sky into account.

This commit is contained in:
Xonk
2023-07-31 18:03:50 -04:00
parent 51b20180cb
commit bc431c7e0c
6 changed files with 72 additions and 65 deletions

View File

@ -21,6 +21,17 @@ vec3 DoAmbientLighting (vec3 SkyColor, vec3 TorchColor, vec2 Lightmap, float sky
return SkyLight * skyLightDir + TorchLight;
}
void DoRTAmbientLighting (vec3 TorchColor, vec2 Lightmap, inout float SkyLM, inout vec3 TorchLight, inout vec3 SkyLight){
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
TorchLight = (TorchColor * TorchLM * 0.75) * TORCH_AMOUNT;
SkyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
SkyLight = max((SkyLight * ambient_brightness) / 10.0, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision));
}
vec3 DoDirectLighting(vec3 SunColor, float Shadow, float NdotL, float SubsurfaceScattering){
// vec3 SunLight = max(NdotL * Shadow, SubsurfaceScattering) * SunColor;