summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2015-10-04 15:57:07 +0200
committer ImJezze <jezze@gmx.net>2015-10-04 15:57:07 +0200
commit5addcdd2da21daab21b1f0332114f8f5a595cd08 (patch)
tree2790268a67a196e01b38c85ce53e2be80815fea2 /hlsl
parent062e6e0383050546656dfed7261273a2d7d142a4 (diff)
Small fixes
- fixed defocus strength with difference prescales - removed default screen ratio of 4:3, ratio is now based on the screen quad size - reverted some space to tab changes
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/distortion.fx22
-rw-r--r--hlsl/focus.fx16
2 files changed, 15 insertions, 23 deletions
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx
index 9db6edd4fb5..61eda38defa 100644
--- a/hlsl/distortion.fx
+++ b/hlsl/distortion.fx
@@ -112,8 +112,6 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Post-Processing Pixel Shader
//-----------------------------------------------------------------------------
-uniform float2 DefaultScreenRatio = float2(1.0f, 3.0f / 4.0f); // normalized screen ratio (defalt ratio of 4:3)
-
uniform float CurvatureAmount = 0.0f;
uniform float RoundCornerAmount = 0.0f;
uniform float SmoothBorderAmount = 0.5f;
@@ -159,9 +157,8 @@ float GetSpotAddend(float2 coord, float amount)
{
float2 RatioCorrection = GetRatioCorrecton();
- float2 defaultScreenRatio = xor(OrientationSwapXY, RotationSwapXY)
- ? DefaultScreenRatio.yx
- : DefaultScreenRatio.xy;
+ // normalized screen quad ratio
+ float2 QuadRatio = float2 (1.0f, QuadDims.y / QuadDims.x);
// upper right quadrant
float2 spotOffset =
@@ -174,7 +171,9 @@ float GetSpotAddend(float2 coord, float amount)
: float2(-0.25f, 0.25f);
float2 SpotCoord = coord;
- SpotCoord += spotOffset * defaultScreenRatio * RatioCorrection;
+ SpotCoord += spotOffset * RatioCorrection;
+ SpotCoord *= QuadRatio;
+ SpotCoord /= RatioCorrection;
float SpotBlur = amount;
@@ -274,13 +273,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
// // BaseCoord.x += (TexCoord.x > 0.5f ? +0.5f : 0.0f);
// BaseCoord.y += (TexCoord.y > 0.5 ? +0.5f : 0.0f);
- float2 defaultScreenRatio = xor(OrientationSwapXY, RotationSwapXY)
- ? DefaultScreenRatio.yx
- : DefaultScreenRatio.xy;
-
- float2 BaseRatioCoordCentered = BaseCoordCentered;
- BaseRatioCoordCentered *= defaultScreenRatio;
-
// Color
float4 BaseColor = tex2D(DiffuseSampler, BaseCoord);
BaseColor.a = 1.0f;
@@ -294,8 +286,8 @@ float4 ps_main(PS_INPUT Input) : COLOR
// Light Reflection Simulation
float3 LightColor = float3(1.0f, 0.90f, 0.80f);
- float2 SpotCoord = BaseRatioCoordCentered;
- float2 NoiseCoord = BaseRatioCoordCentered;
+ float2 SpotCoord = BaseCoordCentered;
+ float2 NoiseCoord = BaseCoordCentered;
float SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount);
float NoiseFactor = GetNoiseFactor(SpotAddend, random(NoiseCoord));
diff --git a/hlsl/focus.fx b/hlsl/focus.fx
index 39e642b58c4..ffa763e06d4 100644
--- a/hlsl/focus.fx
+++ b/hlsl/focus.fx
@@ -76,7 +76,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
- float2 TargetTexelDims = 1.0f / TargetDims;
+ float2 ScreenTexelDims = 1.0f / ScreenDims;
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
@@ -88,13 +88,13 @@ VS_OUTPUT vs_main(VS_INPUT Input)
TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)
Output.TexCoord0 = TexCoord;
- Output.TexCoord1 = TexCoord + Coord1Offset * TargetTexelDims * Defocus;
- Output.TexCoord2 = TexCoord + Coord2Offset * TargetTexelDims * Defocus;
- Output.TexCoord3 = TexCoord + Coord3Offset * TargetTexelDims * Defocus;
- Output.TexCoord4 = TexCoord + Coord4Offset * TargetTexelDims * Defocus;
- Output.TexCoord5 = TexCoord + Coord5Offset * TargetTexelDims * Defocus;
- Output.TexCoord6 = TexCoord + Coord6Offset * TargetTexelDims * Defocus;
- Output.TexCoord7 = TexCoord + Coord7Offset * TargetTexelDims * Defocus;
+ Output.TexCoord1 = TexCoord + Coord1Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord2 = TexCoord + Coord2Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord3 = TexCoord + Coord3Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord4 = TexCoord + Coord4Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord5 = TexCoord + Coord5Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord6 = TexCoord + Coord6Offset * ScreenTexelDims * Defocus;
+ Output.TexCoord7 = TexCoord + Coord7Offset * ScreenTexelDims * Defocus;
Output.Color = Input.Color;