mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 01:59:59 +02:00
Experimenting with AO on the lightmaped surface
This commit is contained in:
parent
c5c3f464cd
commit
584d50b594
8 changed files with 10 additions and 4 deletions
|
@ -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<Parameters>()._radiusInfo;
|
||||
current.x = radius;
|
||||
current.y = radius * radius;
|
||||
current.z = 1.0f / pow(radius, 6.0f);
|
||||
current.z = 1.0f / pow(radius, 6.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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@>
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
|
@ -33,6 +33,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
|
@ -32,6 +32,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
|
@ -34,6 +34,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
|
@ -32,6 +32,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
|
@ -34,6 +34,7 @@ void main(void) {
|
|||
vec3 color = evalLightmappedColor(
|
||||
deferredTransform.viewInverse,
|
||||
shadowAttenuation,
|
||||
frag.obscurance,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
|
|
Loading…
Reference in a new issue