diff options
author | Graham Linden <graham@lindenlab.com> | 2019-01-30 08:37:07 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-01-30 08:37:07 -0800 |
commit | acbc7f4cddd6ad999c2bc7690c10b85a414a8102 (patch) | |
tree | 8af15ec5456494dc71d9eba0927ca4d5abb8aeac /indra/newview/app_settings/shaders/class3/deferred | |
parent | 38f69533780943b432edaac212475bea5fd013b6 (diff) |
SL-10415, SL-10434
Further tweaking of directional shadow sampling to balance between peter-panning and shadow acne.
Move stars to just this side of the sky some to reduce parallax.
Remove decodeNormF and uses of decode_normal in favor of unified use of getNorm
(try to help the Intel HD x000 compiler learn to link correctly).
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
5 files changed, 14 insertions, 12 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl index cccd01e0d7..e27bbce094 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl @@ -1,5 +1,5 @@ /** - * @file class3/deferred/deferredUtil.glsl + * @file class1/deferred/deferredUtil.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -29,8 +29,6 @@ uniform sampler2DRect depthMap; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 decode_normal(vec2 enc); - vec2 getScreenCoordinate(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; @@ -43,8 +41,14 @@ vec2 getScreenCoordinate(vec2 screenpos) vec3 getNorm(vec2 screenpos) { - vec2 enc_norm = texture2DRect(normalMap, screenpos.xy).xy; - return decode_normal(enc_norm); + vec2 enc = texture2DRect(normalMap, screenpos.xy).xy; + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; } float getDepth(vec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 0848adba73..72bccc5627 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -73,7 +73,7 @@ uniform mat4 inv_proj; vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 correctWithGamma(vec4 col) { @@ -166,7 +166,7 @@ void main() float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 9411e905d3..ad721a80d6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -76,7 +76,6 @@ vec3 GetSunAndSkyIrradiance(vec3 camPos, vec3 norm, vec3 dir, out vec3 sky_irrad vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance); vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance); -vec3 decode_normal(vec2 xy); vec3 ColorFromRadiance(vec3 radiance); vec4 getPositionWithDepth(vec2 pos_screen, float depth); vec4 getPosition(vec2 pos_screen); @@ -93,7 +92,7 @@ void main() vec3 pos = getPositionWithDepth(tc, depth).xyz; vec4 norm = texture2DRect(normalMap, tc); float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); + norm.xyz = getNorm(tc); float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); da = pow(da, global_gamma + 0.3); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 80e2a9dd55..3b2b0d5718 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -71,7 +71,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); @@ -164,7 +164,7 @@ void main() vec3 norm = texture2DRect(normalMap, frag.xy).xyz; float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl index e230ebb71c..112b498c90 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl @@ -38,7 +38,6 @@ out vec4 frag_color; // Inputs VARYING vec2 vary_fragcoord; -vec3 decode_normal (vec2 enc); vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); |