Time for action – building Particles.fx
In order to create effects for our particles, perform the following steps:
1. Right-click on the Effects folder in the game's content project and select Add | New Item.
2. From the Add New Item dialog box, select the Effect File type from the central pane.
3. Name the effect file
Particles.fx
and click on Add.4. In the declarations area at the beginning of the file, add the following new declarations:
float alphaValue; texture particleTexture; sampler2D textureSampler = sampler_state { Texture = (particleTexture); AddressU = Wrap; AddressV = Wrap; };
5. Replace the current
VertexShaderInput
andVertexShaderOutput
structs with new ones that include texture coordinates as follows:struct VertexShaderInput { float4 Position : POSITION0; float2 TextureCoordinate : TEXCOORD0; }; struct VertexShaderOutput { float4 Position : POSITION0; float2 TextureCoordinate : TEXCOORD0; };
6. Replace the current
VertexShaderFunction()
method with...