diff options
author | Dave Parks <davep@lindenlab.com> | 2022-05-16 17:21:08 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-05-16 17:21:08 +0000 |
commit | 3400e5fd302c0d9dea6386c4d5bf38876f2cc287 (patch) | |
tree | e791863ef5dabe1a6fb6cba59771607912362ab7 /indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl | |
parent | 6c1fdac9df52ff920860066905a08db748ab0d95 (diff) |
SL-17284 Reflection probe tuning and optimization take 1
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl index 23adbded5e..73c125bbdc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl @@ -29,8 +29,6 @@ uniform sampler2DRect depthMap; uniform float ssao_radius; uniform float ssao_max_radius; -uniform float ssao_factor; -uniform float ssao_factor_inv; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -83,14 +81,14 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen) { float ret = 1.0; vec3 pos_world = pos.xyz; - vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy/128.0).xy; + float angle_hidden = 0.0; float points = 0; - float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); + vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy/128.0).xy; for (int i = 0; i < 8; i++) { vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect); @@ -105,14 +103,14 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen) //(k should vary inversely with # of samples, but this is taken care of later) float funky_val = (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) ? 1.0 : 0.0; - angle_hidden = angle_hidden + funky_val * min(1.0/dist2, ssao_factor_inv); + angle_hidden = angle_hidden + funky_val * min(1.0/dist2, 1.0); // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" float diffz_val = (diff.z > -1.0) ? 1.0 : 0.0; points = points + diffz_val; } - - angle_hidden = min(ssao_factor*angle_hidden/points, 1.0); + + angle_hidden = min(angle_hidden/points, 1.0); float points_val = (points > 0.0) ? 1.0 : 0.0; ret = (1.0 - (points_val * angle_hidden)); |