Error compiling shader in Monogame Pipeline

I am a complete noob with shaders in both XNA and Monogame and shader programming in general. I am trying to follow this tutorial: http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/ . When trying to compile the lighteffect.fx shader in the Monogame Pipline I get “Unexpected token ‘l’ found. Expected LessThan or OpenParenthesis.
Unexpected token ‘;’ found. Expected GreaterThan or CloseParenthesis.” this is at (4,61) which is weird because there is no “I” in it.

Here is the Shader code:

sampler s0;  
	
texture lightMask;  
sampler lightSampler = sampler_state{Texture = lightMask;};  
  
float4 PixelShaderLight(float2 coords: TEXCOORD0) : COLOR0  
{  
    float4 color = tex2D(s0, coords);  
    float4 lightColor = tex2D(lightSampler, coords);  
    return color * lightColor;  
}  

      
technique Technique1  
{  
    pass Pass1  
    {  
        PixelShader = compile ps_2_0 PixelShaderLight();  
    }  
}  

Thank you for anyone willing to help! :slight_smile:

Just a quick glance at the error message and code, it looks like there is an extra semicolon in line #4. Try removing the one after lightmask and see if it works?

You must change line 4 like this:

sampler lightSampler = sampler_state{ Texture = <lightMask>; };  

That’s because the compiler is expecting “<” (GreaterThan symbol) after "Texture = "

Thank you so much :slight_smile: