summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
authorGravatarGravatar Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-27 23:24:53 +0000
committerGravatarGravatar Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-27 23:24:53 +0000
commit3e437e09f04166aac3b9e6aa60ae4ea7865cccda (patch)
tree599dc89f1cbb94d706e15a3a72daf68b93139289 /hlsl
parent6c3b5405709b314a0dc1ad616e2083eb3d5cae81 (diff)
HLSL updates, nwn:
- Favor bilinear sampling on X and point sampling on Y. Best of both worlds.
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/deconverge.fx23
-rw-r--r--hlsl/focus.fx2
-rw-r--r--hlsl/phosphor.fx12
-rw-r--r--hlsl/post.fx7
4 files changed, 28 insertions, 16 deletions
diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx
index 74f7be1447f..91c40cb999a 100644
--- a/hlsl/deconverge.fx
+++ b/hlsl/deconverge.fx
@@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state
{
Texture = <Diffuse>;
- MipFilter = POINT;
- MinFilter = POINT;
- MagFilter = POINT;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
@@ -113,9 +113,20 @@ float4 ps_main(PS_INPUT Input) : COLOR
float Deconverge = 1.0f - MagnetDistance / MagnetCenter;
Deconverge = 1.0f;//clamp(Deconverge, 0.0f, 1.0f);
float Alpha = tex2D(DiffuseSampler, Input.TexCoord).a;
- float RedTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.RedCoord, Deconverge) + 0.5f / float2(RawWidth, RawHeight)).r;
- float GrnTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.GrnCoord, Deconverge) + 0.5f / float2(RawWidth, RawHeight)).g;
- float BluTexel = tex2D(DiffuseSampler, lerp(Input.TexCoord, Input.BluCoord, Deconverge) + 0.5f / float2(RawWidth, RawHeight)).b;
+
+ float2 RawDims = float2(RawWidth, RawHeight);
+ float2 TexCoord = Input.TexCoord * RawDims;
+ float2 RedCoord = Input.RedCoord * RawDims;
+ float2 GrnCoord = Input.GrnCoord * RawDims;
+ float2 BluCoord = Input.BluCoord * RawDims;
+ TexCoord.y = TexCoord.y - frac(TexCoord.y);
+ RedCoord.y = RedCoord.y - frac(RedCoord.y);
+ GrnCoord.y = GrnCoord.y - frac(GrnCoord.y);
+ BluCoord.y = BluCoord.y - frac(BluCoord.y);
+
+ float RedTexel = tex2D(DiffuseSampler, lerp(TexCoord, RedCoord, Deconverge) / RawDims + 0.5f / float2(RawWidth, RawHeight)).r;
+ float GrnTexel = tex2D(DiffuseSampler, lerp(TexCoord, GrnCoord, Deconverge) / RawDims + 0.5f / float2(RawWidth, RawHeight)).g;
+ float BluTexel = tex2D(DiffuseSampler, lerp(TexCoord, BluCoord, Deconverge) / RawDims + 0.5f / float2(RawWidth, RawHeight)).b;
RedTexel *= Input.RedCoord.x < (1.0f / TargetWidth) ? 0.0f : 1.0f;
RedTexel *= Input.RedCoord.y < (1.0f / TargetHeight) ? 0.0f : 1.0f;
diff --git a/hlsl/focus.fx b/hlsl/focus.fx
index b1b05520b60..c5e95baf6e8 100644
--- a/hlsl/focus.fx
+++ b/hlsl/focus.fx
@@ -90,7 +90,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Color = Input.Color;
float2 InvTexSize = float2(1.0f / TargetWidth, 1.0f / TargetHeight);
- float2 TexCoord = (Input.Position.xy * InvTexSize);
+ float2 TexCoord = Input.TexCoord;
TexCoord = TexCoord + 0.5f * InvTexSize;
float2 DefocusVal = float2(DefocusX, DefocusY);
Output.TexCoord0 = TexCoord + Coord0Offset * InvTexSize * DefocusVal;
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx
index 242c23d26a2..6512cc4739a 100644
--- a/hlsl/phosphor.fx
+++ b/hlsl/phosphor.fx
@@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state
{
Texture = <Diffuse>;
- MipFilter = POINT;
- MinFilter = POINT;
- MagFilter = POINT;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
@@ -20,9 +20,9 @@ texture LastPass;
sampler PreviousSampler = sampler_state
{
Texture = <LastPass>;
- MipFilter = POINT;
- MinFilter = POINT;
- MagFilter = POINT;
+ MipFilter = LINEAR;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
diff --git a/hlsl/post.fx b/hlsl/post.fx
index 9a22a7cdc9c..2128dc222e1 100644
--- a/hlsl/post.fx
+++ b/hlsl/post.fx
@@ -79,7 +79,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Color = Input.Color;
Output.TexCoord = Input.TexCoord + 0.5f / float2(RawWidth, RawHeight);
- //float Zoom = 1.0f;
+ //float Zoom = 32.0f;
//Output.TexCoord /= Zoom;
//Output.TexCoord += float2(0.175f * (1.0f - 1.0f / Zoom) / WidthRatio, 0.175f * (1.0f - 1.0f / Zoom) / HeightRatio);
return Output;
@@ -156,13 +156,14 @@ float4 ps_main(PS_INPUT Input) : COLOR
// -- Scanline Simulation --
float InnerSine = BaseCoord.y * RawHeight * ScanlineScale + 0.5f;
float3 ScanBrightness = lerp(1.0f, abs(sin(InnerSine * PI + ScanlineOffset * RawHeight)) * ScanlineBrightScale + 1.0f, ScanlineAmount);
+ //float3 Scanned = BaseTexel.rgb * ScanBrightness;
float3 Scanned = BaseTexel.rgb * ScanBrightness;
float2 ShadowDims = float2(ShadowWidth, ShadowHeight);
float2 ShadowUV = float2(ShadowU, ShadowV);
float2 ShadowMaskSize = float2(ShadowMaskSizeX, ShadowMaskSizeY);
- float2 ShadowFrac = frac((ScreenCurveCoord * ShadowMaskSize * 0.5f) / Ratios);
- float2 ShadowCoord = ShadowFrac * ShadowUV + 1.5f / ShadowDims;
+ float2 ShadowFrac = frac(BaseCoord * ShadowMaskSize * 0.5f);
+ float2 ShadowCoord = ShadowFrac * ShadowUV + float2(1.5f / ShadowWidth, 1.5f / ShadowHeight);
float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord), UseShadow);
// -- Final Pixel --