summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-02-07 16:27:42 -0800
committerMerov Linden <merov@lindenlab.com>2014-02-07 16:27:42 -0800
commit73c9e42fafc0ad21af1ed38735c0ed9212640dd2 (patch)
tree506dec10e0c1612dbe2d32431a6b5f57febbc1e7
parentd7f5afdc5dbbc5f2b9da031322d9e24669978c46 (diff)
ACME-1314 : Fix screen filter to make it less harsh on edges, modify Jules Verne and Newspaper filters as a result
-rwxr-xr-xindra/llimage/llimagefilter.cpp10
-rw-r--r--indra/newview/app_settings/filters/JulesVerne.xml11
-rwxr-xr-xindra/newview/app_settings/filters/Newspaper.xml11
3 files changed, 9 insertions, 23 deletions
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index a5b5888bb2..742b0ad802 100755
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -500,6 +500,14 @@ void LLImageFilter::filterScreen(EScreenMode mode, const F32 wave_length, const
F32 wave_length_pixels = wave_length * (F32)(height) / 2.0;
F32 sin = sinf(angle*DEG_TO_RAD);
F32 cos = cosf(angle*DEG_TO_RAD);
+
+ // Precompute the gamma table : gives us the gray level to use when cutting outside the screen (prevents strong aliasing on the screen)
+ U8 gamma[256];
+ for (S32 i = 0; i < 256; i++)
+ {
+ F32 gamma_i = llclampf((float)(powf((float)(i)/255.0,1.0/4.0)));
+ gamma[i] = (U8)(255.0 * gamma_i);
+ }
U8* dst_data = mImage->getData();
for (S32 j = 0; j < height; j++)
@@ -522,7 +530,7 @@ void LLImageFilter::filterScreen(EScreenMode mode, const F32 wave_length, const
value = (sinf(2*F_PI*dj/wave_length_pixels)+1.0)*255.0/2.0;
break;
}
- U8 dst_value = (dst_data[VRED] >= (U8)(value) ? 255 : 0);
+ U8 dst_value = (dst_data[VRED] >= (U8)(value) ? gamma[dst_data[VRED] - (U8)(value)] : 0);
// Blend result
blendStencil(getStencilAlpha(i,j), dst_data, dst_value, dst_value, dst_value);
diff --git a/indra/newview/app_settings/filters/JulesVerne.xml b/indra/newview/app_settings/filters/JulesVerne.xml
index 35bc657c11..981e221da9 100644
--- a/indra/newview/app_settings/filters/JulesVerne.xml
+++ b/indra/newview/app_settings/filters/JulesVerne.xml
@@ -11,17 +11,6 @@
<string>grayscale</string>
</array>
<array>
- <string>stencil</string>
- <string>vignette</string>
- <string>blend</string>
- <real>1.0</real>
- <real>0.1</real>
- <real>0.0</real>
- <real>0.0</real>
- <real>1.0</real>
- <real>1.0</real>
- </array>
- <array>
<string>screen</string>
<string>line</string>
<real>0.02</real>
diff --git a/indra/newview/app_settings/filters/Newspaper.xml b/indra/newview/app_settings/filters/Newspaper.xml
index 8441decf3b..6cfe319281 100755
--- a/indra/newview/app_settings/filters/Newspaper.xml
+++ b/indra/newview/app_settings/filters/Newspaper.xml
@@ -11,17 +11,6 @@
<string>grayscale</string>
</array>
<array>
- <string>stencil</string>
- <string>vignette</string>
- <string>blend</string>
- <real>1.0</real>
- <real>0.1</real>
- <real>0.0</real>
- <real>0.0</real>
- <real>1.0</real>
- <real>1.0</real>
- </array>
- <array>
<string>screen</string>
<string>2Dsine</string>
<real>0.02</real>