summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/distortion.fx
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl/distortion.fx')
-rw-r--r--hlsl/distortion.fx16
1 files changed, 9 insertions, 7 deletions
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx
index 7624d962a58..3dd1dbd44b6 100644
--- a/hlsl/distortion.fx
+++ b/hlsl/distortion.fx
@@ -120,6 +120,7 @@ uniform float RoundCornerAmount = 0.0f;
uniform float SmoothBorderAmount = 0.0f;
uniform float VignettingAmount = 0.0f;
uniform float ReflectionAmount = 0.0f;
+uniform float3 LightReflectionColor = float3(1.0f, 0.90f, 0.80f); // color temperature 5.000 Kelvin
uniform bool SwapXY = false;
@@ -280,7 +281,12 @@ float4 ps_main(PS_INPUT Input) : COLOR
float2 QuadCoord = GetQuadCoords(Input.TexCoord, BaseTargetQuadScale, distortCornerAmount, 0.0f);
// clip border
- clip(BaseCoord < 0.0f - TexelDims || BaseCoord > 1.0f + TexelDims ? -1 : 1);
+ if (BaseCoord.x < 0.0f - TexelDims.x || BaseCoord.y < 0.0f - TexelDims.y ||
+ BaseCoord.x > 1.0f + TexelDims.x || BaseCoord.y > 1.0f + TexelDims.y)
+ {
+ // we don't use the clip function, because we don't clear the render target before
+ return float4(0.0f, 0.0f, 0.0f, 1.0f);
+ }
// Color
float4 BaseColor = tex2D(DiffuseSampler, BaseCoord);
@@ -293,14 +299,10 @@ float4 ps_main(PS_INPUT Input) : COLOR
BaseColor.rgb *= VignetteFactor;
// Light Reflection Simulation
- float3 LightColor = float3(1.0f, 0.90f, 0.80f); // color temperature 5.000 Kelvin
-
float2 SpotCoord = QuadCoord;
- float2 NoiseCoord = QuadCoord;
- float SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount);
- float NoiseFactor = GetNoiseFactor(SpotAddend, random(NoiseCoord));
- BaseColor.rgb += SpotAddend * NoiseFactor * LightColor;
+ float SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount) * LightReflectionColor;
+ BaseColor.rgb += SpotAddend * GetNoiseFactor(SpotAddend, random(SpotCoord));
// Round Corners Simulation
float2 RoundCornerCoord = QuadCoord;