From ca6103f57c452c9e3bb23a94899725d4f7ca8197 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 6 Aug 2014 21:56:32 -0400 Subject: Fix for BUG-6895. This brings projector reflections more in line with the originally intended behavior of environment reflections. --- indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 0e6ab80d4d..c299d89455 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -323,7 +323,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb*spec.rgb; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 8d8a6c9dde..5094513e52 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -334,7 +334,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*spec.rgb; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index c20e00163c..2117056b6c 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -347,7 +347,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb*shadow*spec.rgb; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 7689b72d20..08f5438e8a 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -348,7 +348,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*shadow*spec.rgb; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity; } } } -- cgit v1.2.3 From 2ffa387560d26acdd90a32321f593036fa36c294 Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 7 Aug 2014 16:50:36 -0400 Subject: Glossy reflections for projectors. --- .../app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 6 +++--- .../newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 6 +++--- .../app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 8 ++++---- .../newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index c299d89455..63ad6fa7c7 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -314,16 +314,16 @@ void main() stc /= stc.w; if (stc.z > 0.0) { - float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0); + float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 5094513e52..6d282115dd 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -324,17 +324,17 @@ void main() { stc.xy /= stc.w; - float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0); + float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 2117056b6c..d5bc56e27a 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -338,16 +338,16 @@ void main() if (stc.z > 0.0) { - float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0); - - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + + stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 08f5438e8a..56b01eff8c 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -338,17 +338,17 @@ void main() { stc.xy /= stc.w; - float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0); + float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); + stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; } } } -- cgit v1.2.3 From 703be164cf4205117fa0e1adc9316fb77645ce25 Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 7 Aug 2014 17:27:34 -0400 Subject: Code cleanup for BUG-6898 --- .../app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 8 +++++--- .../newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 7 +++---- .../app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 8 ++++---- .../newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 7 +++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 63ad6fa7c7..62acbbf36b 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -311,12 +311,14 @@ void main() vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - stc /= stc.w; + if (stc.z > 0.0) { - float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + stc /= stc.w; + + //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); + //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 6d282115dd..10b47291e3 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -322,12 +322,11 @@ void main() if (stc.z > 0.0) { - stc.xy /= stc.w; + stc /= stc.w; - float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); + //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index d5bc56e27a..dd99c029e6 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -334,13 +334,14 @@ void main() vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - stc /= stc.w; if (stc.z > 0.0) { - float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + stc /= stc.w; - stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); + //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + + //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && @@ -352,7 +353,6 @@ void main() } } } - //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 56b01eff8c..acf474c489 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -336,12 +336,11 @@ void main() if (stc.z > 0.0) { - stc.xy /= stc.w; + stc /= stc.w; - float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); + //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5); - stc.xy = (stc.xy - vec2(0.5)) + vec2(0.5); + //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && -- cgit v1.2.3 From b67bff90369ada09f9f30055bebd49af3906565f Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 21 Aug 2014 13:08:24 -0400 Subject: Removal of commented out code. --- .../newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 4 ---- indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 4 ---- .../newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 4 ---- indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 4 ---- 4 files changed, 16 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 62acbbf36b..39613c2872 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -315,10 +315,6 @@ void main() if (stc.z > 0.0) { stc /= stc.w; - - //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - - //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 10b47291e3..b8cb6b6491 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -323,10 +323,6 @@ void main() if (stc.z > 0.0) { stc /= stc.w; - - //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - - //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index dd99c029e6..7a0641084e 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -338,10 +338,6 @@ void main() if (stc.z > 0.0) { stc /= stc.w; - - //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - - //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index acf474c489..a61e66e0fa 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -337,10 +337,6 @@ void main() if (stc.z > 0.0) { stc /= stc.w; - - //float fatten = clamp(spec.a*spec.a+spec.a*0.25, 0.25, 1.0); - - //stc.xy = (stc.xy - vec2(0.25)) * fatten + vec2(0.5); if (stc.x < 1.0 && stc.y < 1.0 && -- cgit v1.2.3 From 0c34a92d43eb8ae4450df7e87f9d216648ebd50b Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 3 Sep 2014 19:56:46 -0400 Subject: Switch to using texture2DLodDiffuse for reasons of having a nice soft edge for less glossy projector reflections. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes far more sense than having the “spot” functionality, and opens projectors up to much more practical use cases and fits much better within the concept of glossy reflections than the previous spot behavior. --- .../newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl | 4 ++-- .../newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 39613c2872..34bd4a7e21 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -321,7 +321,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; + col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index b8cb6b6491..38f383f0c4 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -138,7 +138,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) float d = dot(dist,dist); - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + ret *= min(clamp((0.125-d)/0.125, 0.0, 1.0)+det, 1.0); return ret; } @@ -329,7 +329,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; + col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 7a0641084e..09cb195fa3 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -344,7 +344,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index a61e66e0fa..3d0cbbcc4d 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -343,7 +343,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; } } } -- cgit v1.2.3 From 5282e021abd94b3687c8aadfeab4fcad6e5ef348 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 3 Sep 2014 22:13:01 -0400 Subject: Switch back to texture2dSpecular with a custom falloff dependent upon LOD. --- .../shaders/class1/deferred/multiSpotLightF.glsl | 16 ++++++++++------ .../shaders/class1/deferred/spotLightF.glsl | 18 +++++++++++------- .../shaders/class2/deferred/multiSpotLightF.glsl | 20 ++++++++++++-------- .../shaders/class2/deferred/spotLightF.glsl | 18 +++++++++++------- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 34bd4a7e21..c08e9d361a 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -127,13 +127,17 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) vec4 ret = texture2DLod(projectionMap, tc, lod); ret.rgb = srgb_to_linear(ret.rgb); - vec2 dist = tc-vec2(0.5); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - float det = max(1.0-lod/(proj_lod*0.5), 0.0); + float det = min(lod/(proj_lod*0.5), 1.0); - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + float d = min(dist.x, dist.y); + + d *= min(1, d * (proj_lod - lod)); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); return ret; } @@ -321,7 +325,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 38f383f0c4..f50635a139 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -130,15 +130,19 @@ vec4 correctWithGamma(vec4 col) vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); - vec2 dist = tc-vec2(0.5); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - float det = max(1.0-lod/(proj_lod*0.5), 0.0); + float det = min(lod/(proj_lod*0.5), 1.0); - float d = dot(dist,dist); - - ret *= min(clamp((0.125-d)/0.125, 0.0, 1.0)+det, 1.0); + float d = min(dist.x, dist.y); + + d *= min(1, d * (proj_lod - lod)); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); return ret; } @@ -329,7 +333,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 09cb195fa3..65bf08ee66 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -131,15 +131,19 @@ vec4 correctWithGamma(vec4 col) vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); - - vec2 dist = tc-vec2(0.5); + ret.rgb = srgb_to_linear(ret.rgb); - float det = max(1.0-lod/(proj_lod*0.5), 0.0); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + float det = min(lod/(proj_lod*0.5), 1.0); + + float d = min(dist.x, dist.y); + + d *= min(1, d * (proj_lod - lod)); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); return ret; } @@ -344,7 +348,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, ((1 - spec.a) * 2) * (proj_lod)).rgb * shadow * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 3d0cbbcc4d..3053315275 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -131,15 +131,19 @@ vec4 correctWithGamma(vec4 col) vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); - ret = correctWithGamma(ret); + ret.rgb = srgb_to_linear(ret.rgb); - vec2 dist = tc-vec2(0.5); + vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - float det = max(1.0-lod/(proj_lod*0.5), 0.0); + float det = min(lod/(proj_lod*0.5), 1.0); - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0); + float d = min(dist.x, dist.y); + + d *= min(1, d * (proj_lod - lod)); + + float edge = 0.25*det; + + ret *= clamp(d/edge, 0.0, 1.0); return ret; } @@ -343,7 +347,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodDiffuse(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod * 0.5)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod)).rgb * shadow * envIntensity; } } } -- cgit v1.2.3 From 5974a8eae5c76ac27fe1879145f764294af46ab8 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 3 Sep 2014 22:33:41 -0400 Subject: Ensure projectors with shadows have the same mip level calculation as without shadows. --- indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl | 2 +- indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 65bf08ee66..94bd07bec6 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -348,7 +348,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, ((1 - spec.a) * 2) * (proj_lod)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 3053315275..92e1ac95a6 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -347,7 +347,7 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a * spec.a) * (proj_lod)).rgb * shadow * envIntensity; + col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity; } } } -- cgit v1.2.3