summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2015-05-22 18:56:30 +0200
committer ImJezze <jezze@gmx.net>2015-05-22 18:56:30 +0200
commit0fa1503782fc2dea2c93dbd3488dc70451c17e5a (patch)
treec4f069347134fb7fb399894e967a3fe8ab792d8a /hlsl
parent578f8b5bbe73e8381781ee56fd5982bbf3afda0e (diff)
Changed vignetting simulation
- removed screen ratio influence - changed radius, blur and intensity
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/post.fx28
1 files changed, 13 insertions, 15 deletions
diff --git a/hlsl/post.fx b/hlsl/post.fx
index a5a6cccf164..1a6abf92f93 100644
--- a/hlsl/post.fx
+++ b/hlsl/post.fx
@@ -173,14 +173,12 @@ float GetVignetteFactor(float2 coord, float amount)
{
float2 VignetteCoord = coord;
- float VignetteBlur = amount * 2.0f;
+ float VignetteLength = length(VignetteCoord);
+ float VignetteBlur = (amount * 0.75f) + 0.25;
// 0.5 full screen fitting circle
- float VignetteRadius = 1.0f - amount * 0.5f;
- float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, length(VignetteCoord));
-
- // reduce strength to 50%
- Vignette = lerp(1.0, 1.0 * Vignette, 0.5f);
+ float VignetteRadius = 1.0f - (amount * 0.25f);
+ float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, VignetteLength);
return saturate(Vignette);
}
@@ -283,18 +281,18 @@ float4 ps_main(PS_INPUT Input) : COLOR
BaseCoordCentered *= CurvatureZoom; // zoom
BaseCoordCentered += CurvatureCurve; // distortion
- // float2 BaseAreaRatioCoord = BaseCoord;
- // BaseAreaRatioCoord *= UsedArea * ScreenRatio;
-
- float2 BaseAreaRatioCoordCentered = BaseCoordCentered;
- BaseAreaRatioCoordCentered *= UsedArea * ScreenRatio;
-
- // float2 BaseAreaCoord = BaseCoord;
- // BaseAreaCoord *= UsedArea;
+ float2 BaseAreaCoord = BaseCoord;
+ BaseAreaCoord *= UsedArea;
float2 BaseAreaCoordCentered = BaseCoordCentered;
BaseAreaCoordCentered *= UsedArea;
+ float2 BaseAreaRatioCoord = BaseAreaCoord;
+ BaseAreaRatioCoord *= ScreenRatio;
+
+ float2 BaseAreaRatioCoordCentered = BaseAreaCoordCentered;
+ BaseAreaRatioCoordCentered *= ScreenRatio;
+
// // Alpha Clipping (round corners applies smoother clipping when screen is curved)
// clip((BaseCoord < SourceTexelDims) ? -1 : 1);
// clip((BaseCoord > SourceRect + SourceTexelDims) ? -1 : 1);
@@ -303,7 +301,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
BaseColor.a = 1.0f;
// Vignetting Simulation (may affect bloom)
- float2 VignetteCoord = BaseAreaRatioCoordCentered;
+ float2 VignetteCoord = BaseAreaCoordCentered;
float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
BaseColor.rgb *= VignetteFactor;