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
This commit is contained in:
ImJezze 2015-10-04 15:57:07 +02:00
parent 062e6e0383
commit 5addcdd2da
3 changed files with 86 additions and 94 deletions

View File

@ -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));

View File

@ -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;