Trying and failing to get 2D normal mapping sorted

Hiya, first off I know there have been quesitons about this before, but I have not found anything with my particular issue.
In order to debug my lighting shader, I tried to set it up so it purely rendered the color of the normal map, instead of any lighting, as the normal mapping wasn’t working so I was wondering if the normalMap texture was sampling correctly.
I’m using a shadow system based off generating traingles and rendering over them. This is working fine with normal lighting, just not when I try and implement normal mapping.

My rendering code for the shadows is as follows

        VertexPositionTexture[] vertices = getTriangles(pWorld);
        RasterizerState rasterizerState = new RasterizerState();
        rasterizerState.CullMode = CullMode.None;
        graphicsDevice.RasterizerState = rasterizerState;
        graphicsDevice.BlendState = BlendState.Additive;
        // Samplers states are set by the shader itself            
        graphicsDevice.DepthStencilState = DepthStencilState.None;

        //lightEffect.Parameters["lightSource"].SetValue(position);
        //lightEffect.Parameters["lightColor"].SetValue(color.ToVector3() * intensity);
        //lightEffect.Parameters["lightRadius"].SetValue(radius);
        lightEffect.Parameters["normalMap"].SetValue(normalTarget);
       
        lightEffect.Techniques[0].Passes[0].Apply();
        ProjectVertices(vertices, 1080, 700);
        graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);

this code worked fine for normal lighting (Hence the commented out lighting parameters)

My shader

const float3 black = float3(0.0f, 0.0f, 0.0f);

float2 lightSource; // Light position in 2D world space
float3 lightColor;  // Color of the light
float  lightRadius; // Radius of the light

texture normalMap;

sampler normalSampler = sampler_state
{
  Texture = (normalMap);
  AddressU = CLAMP;
  AddressV = CLAMP;
  MagFilter = LINEAR;
  MinFilter = LINEAR;
  Mipfilter = LINEAR;
};

struct VertexShaderInput
{
  float3 Position : POSITION0;
  float2 TexCoord : TEXCOORD0;
};

struct VertexShaderOutput
{
  float4 Position : POSITION0;
  float2 WorldPos : TEXCOORD0;

};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
  VertexShaderOutput output;
  output.Position = float4(input.Position, 1);
  output.WorldPos = input.TexCoord; // Vertex position in 2D world space

  return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{     
  float3 normalCol = tex2D(normalSampler, input.WorldPos).rgb;

  return float4(normalCol, 1.0f);
}

technique Technique1
{
  pass Pass1
  {
    VertexShader = compile vs_5_0 VertexShaderFunction();
    PixelShader = compile ps_5_0 PixelShaderFunction();
  }
}

Whilst I expected this simply to render the normal map color in the triangles, it instead renders

The shadows are therefore rendering correctly, but the normal map doesn’t appear to be being sampled correctly?(the normal map should just be a brick normal map texture, which is being generated correctly as I have tested just rendering the normal map rendertarget without a shader and it looks fine)

Any help would be greatly appreciated.
I’m sorry if this issue is completely trivial, I am new to shaders and am just stuck with this, I have tried looking up the answer all of google but to no avail.

Thank you

You should probably search the forums first.

…results on these forums for normal mapping.

http://community.monogame.net/search?q=normal%20mapping

As I said in my question, I have already browsed the forums. However these issues are not the same as mine. The main issue i am having is that the texture is incorrectly sampling, not an issue with the actual lighting generation, and I have been unable to find a solution elsewhere.

Ah edit scratch that sorry im tired.

It looks like it should draw. Can you change the pass1 in your shader to pass0 and try it.

you should also probably call your technique like so.

lightEffect.CurrentTechnique = lightEffect.Techniques["Technique1"];
foreach (EffectPass pass in lightEffect.CurrentTechnique.Passes)
{
     pass.Apply();
     graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
}

Hmm no change unfortunately. Could it be related to the triangle normals possibly facing the wrong way or would that not affect the way it is rendered?

Not the facing you have cull mode set to none that will render them either way they are facing.

Ah I found the issue, I had completely forgotten to project the texture coordinate, I was only projecting the position. Sorry for wasting your time

ya i figured uv’s not set nothin much left, glad you got it working.