diff options
author | 2016-06-05 23:50:44 +0200 | |
---|---|---|
committer | 2016-06-05 23:50:44 +0200 | |
commit | 6ea15072a718b093e3688d22f7f6954e44e383b6 (patch) | |
tree | b65e08cad8e07f8ce1f5f52f7e2438181cad158b /hlsl/distortion.fx | |
parent | 396c2a094622e742e96ab3d16a72dfca4e498eaf (diff) |
Procedural texture for vectors in HLSL
* added simple procedural texture for vectors with rounded line ends and beam smoothness
* added optional -vector_beam_smooth option
* removed -antialias option, antialiasing is now always applied, except for plain D3D
Diffstat (limited to 'hlsl/distortion.fx')
-rw-r--r-- | hlsl/distortion.fx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/hlsl/distortion.fx b/hlsl/distortion.fx index bd78efde8c5..1ee1641e646 100644 --- a/hlsl/distortion.fx +++ b/hlsl/distortion.fx @@ -170,22 +170,18 @@ float GetSpotAddend(float2 coord, float amount) return saturate(SigmoidSpot); } -float GetRoundCornerFactor(float2 coord, float radiusAmount, float smoothAmount) +float GetRoundCornerFactor(float2 coord, float2 bounds, float radiusAmount, float smoothAmount) { // reduce smooth amount down to radius amount smoothAmount = min(smoothAmount, radiusAmount); - float2 quadDims = QuadDims; - quadDims = SwapXY - ? quadDims.yx - : quadDims.xy; - - float range = min(quadDims.x, quadDims.y) * 0.5; - float radius = range * max(radiusAmount, 0.0025f); - float smooth = 1.0 / (range * max(smoothAmount, 0.0025f)); + float range = min(bounds.x, bounds.y); + float amountMinimum = range > 0.0f ? 1.0f / range : 0.0f; + float radius = range * max(radiusAmount, amountMinimum); + float smooth = 1.0f / (range * max(smoothAmount, amountMinimum * 3.0f)); // compute box - float box = roundBox(quadDims * (coord * 2.0f), quadDims, radius); + float box = roundBox(bounds * (coord * 2.0f), bounds, radius); // apply smooth box *= smooth; @@ -279,8 +275,11 @@ float4 ps_main(PS_INPUT Input) : COLOR // Round Corners Simulation float2 RoundCornerCoord = CornerCoordCentered; + float2 RoundCornerBounds = SwapXY + ? QuadDims.yx + : QuadDims.xy; - float roundCornerFactor = GetRoundCornerFactor(RoundCornerCoord, RoundCornerAmount, SmoothBorderAmount); + float roundCornerFactor = GetRoundCornerFactor(RoundCornerCoord, RoundCornerBounds, RoundCornerAmount * 0.5f, SmoothBorderAmount * 0.5f); BaseColor.rgb *= roundCornerFactor; return BaseColor; |