diff --git a/Effects/GaleforceArrowTrail.fx b/Effects/GaleforceArrowTrail.fx new file mode 100644 index 0000000000..b91dddd7ce --- /dev/null +++ b/Effects/GaleforceArrowTrail.fx @@ -0,0 +1,69 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float shouldFlip; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float InverseLerp(float a, float b, float x) +{ + return saturate((x - a) / (b - a)); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, coords - float2(uTime * 0.6, 0)); + float opacity = fadeMapColor.r; + float bloomOpacity = sin(coords.y * 3.141) * 1.4; + return lerp(color * bloomOpacity, color * opacity, InverseLerp(0, 0.26, coords.x)); +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/GaleforceArrowTrail.xnb b/Effects/GaleforceArrowTrail.xnb new file mode 100644 index 0000000000..2b1d277c88 Binary files /dev/null and b/Effects/GaleforceArrowTrail.xnb differ