diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.cpp b/libraries/render-utils/src/AmbientOcclusionEffect.cpp index 20393816dc..1558c99585 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.cpp +++ b/libraries/render-utils/src/AmbientOcclusionEffect.cpp @@ -36,7 +36,7 @@ class GaussianDistribution { public: static double integral(float x, float deviation) { - return 0.5 * erf(x / (deviation * sqrt(2.0))); + return 0.5 * erf((double)x / ((double)deviation * sqrt(2.0))); } static double rangeIntegral(float x0, float x1, float deviation) { @@ -227,7 +227,7 @@ void AmbientOcclusionEffect::setRadius(float radius) { auto& current = _parametersBuffer.edit()._radiusInfo; current.x = radius; current.y = radius * radius; - current.z = 1.0f / pow(radius, 6.0f); + current.z = 1.0f / pow(radius, 6.0); } } diff --git a/libraries/render-utils/src/DeferredGlobalLight.slh b/libraries/render-utils/src/DeferredGlobalLight.slh index a995bdbac4..75fe187e46 100755 --- a/libraries/render-utils/src/DeferredGlobalLight.slh +++ b/libraries/render-utils/src/DeferredGlobalLight.slh @@ -136,7 +136,7 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu <@endfunc@> <@func declareEvalLightmappedColor()@> -vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, vec3 normal, vec3 diffuse, vec3 lightmap) { +vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 normal, vec3 diffuse, vec3 lightmap) { Light light = getLight(); @@ -156,7 +156,7 @@ vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, vec3 normal, // ambient is a tiny percentage of the lightmap and only when in the shadow vec3 ambientLight = (1 - lightAttenuation) * lightmap * getLightAmbientIntensity(light); - return diffuse * (ambientLight + diffuseLight); + return obscurance * diffuse * (ambientLight + diffuseLight); } <@endfunc@> diff --git a/libraries/render-utils/src/directional_ambient_light.slf b/libraries/render-utils/src/directional_ambient_light.slf index bfc0709406..3d1b9db46c 100755 --- a/libraries/render-utils/src/directional_ambient_light.slf +++ b/libraries/render-utils/src/directional_ambient_light.slf @@ -31,6 +31,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz); diff --git a/libraries/render-utils/src/directional_ambient_light_shadow.slf b/libraries/render-utils/src/directional_ambient_light_shadow.slf index 3368400f6c..ffe0e21851 100644 --- a/libraries/render-utils/src/directional_ambient_light_shadow.slf +++ b/libraries/render-utils/src/directional_ambient_light_shadow.slf @@ -33,6 +33,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz); diff --git a/libraries/render-utils/src/directional_light.slf b/libraries/render-utils/src/directional_light.slf index 0e706a0a14..e07c57a905 100644 --- a/libraries/render-utils/src/directional_light.slf +++ b/libraries/render-utils/src/directional_light.slf @@ -32,6 +32,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz); diff --git a/libraries/render-utils/src/directional_light_shadow.slf b/libraries/render-utils/src/directional_light_shadow.slf index 7ae462ea71..4aa041b847 100644 --- a/libraries/render-utils/src/directional_light_shadow.slf +++ b/libraries/render-utils/src/directional_light_shadow.slf @@ -34,6 +34,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz); diff --git a/libraries/render-utils/src/directional_skybox_light.slf b/libraries/render-utils/src/directional_skybox_light.slf index 07349f8b90..78fdc4e234 100755 --- a/libraries/render-utils/src/directional_skybox_light.slf +++ b/libraries/render-utils/src/directional_skybox_light.slf @@ -32,6 +32,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz); diff --git a/libraries/render-utils/src/directional_skybox_light_shadow.slf b/libraries/render-utils/src/directional_skybox_light_shadow.slf index 4c7cdfddf5..bbce15be68 100644 --- a/libraries/render-utils/src/directional_skybox_light_shadow.slf +++ b/libraries/render-utils/src/directional_skybox_light_shadow.slf @@ -34,6 +34,7 @@ void main(void) { vec3 color = evalLightmappedColor( deferredTransform.viewInverse, shadowAttenuation, + frag.obscurance, frag.normal, frag.diffuse, frag.specularVal.xyz);