diff options
Diffstat (limited to 'hlsl/vector.fx')
-rw-r--r-- | hlsl/vector.fx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hlsl/vector.fx b/hlsl/vector.fx index e93d8dee4cf..89072253e88 100644 --- a/hlsl/vector.fx +++ b/hlsl/vector.fx @@ -11,6 +11,7 @@ struct VS_OUTPUT float4 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; struct VS_INPUT @@ -18,12 +19,14 @@ struct VS_INPUT float3 Position : POSITION; float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; struct PS_INPUT { float4 Color : COLOR0; float2 TexCoord : TEXCOORD0; + float2 LineInfo : TEXCOORD1; }; //----------------------------------------------------------------------------- @@ -48,7 +51,7 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f); Output.Color = Input.Color; Output.TexCoord = Input.Position.xy / float2(TargetWidth, TargetHeight); - + Output.LineInfo = Input.LineInfo; return Output; } @@ -58,17 +61,18 @@ VS_OUTPUT vs_main(VS_INPUT Input) // TimeParams.x: Frame time of the vector // TimeParams.y: How much frame time affects the vector's fade -// LengthParams.x: Length of the vector // LengthParams.y: How much length affects the vector's fade // LengthParams.z: Size at which fade is maximum float4 ps_main(PS_INPUT Input) : COLOR { - float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 2.0; + float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 1.0; - float lengthModulate = clamp(1.0f - LengthParams.x / LengthParams.z, 0.0f, 1.0f); - lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 2.0; + float lengthModulate = 1.0f - clamp(Input.LineInfo.x / LengthParams.z, 0.0f, 1.0f); + float minLength = 2.0f - clamp(Input.LineInfo.x - 1.0f, 0.0f, 2.0f); + lengthModulate = lerp(lengthModulate, 4.0f, minLength * 0.5f); + lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 1.0; - float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 8.0; + float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 2.0; return outColor; } |