I have pretty much zero experience working with shaders as my first couple phone games were just 2d games that didn't use any sort of shaders. Now I'm working on a PC game that has a day and night cycle so I found a tutorial and implemented a shader effect with only a basic understand of how it's working. Enough so that I've been able to accomplish what I've desired with darkness and lighting. This is a 2d game as well. Anyway here's my shader effect that I'm using:

texture lightMask;
sampler mainSampler : register(s0);
sampler lightSampler = sampler_state{Texture = lightMask;};

{
float4 TextureCoords: TEXCOORD0;
};

{
float2 texCoord = input.TextureCoords;

float4 mainColor = tex2D(mainSampler, texCoord);
float4 lightColor = tex2D(lightSampler, texCoord);

return mainColor * lightColor;
}

technique Technique1
{
pass Pass1
{
}
}


And Implement like so:

drawMain();

ScreenManager.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
lightingEffect.CurrentTechnique.Passes[0].Apply();
ScreenManager.SpriteBatch.Draw(mainScene, Vector2.Zero, Color.White);
ScreenManager.SpriteBatch.End();


I didn't notice any problem at first on my 27" S-IPS 2560x1440 monitor. When I change primary monitors to my 1920x1080 LCD monitor the shaders don't appear to work the same. It doesn't have the soft gradient lighting from my lightmask. It's kind of difficult to describe. The outside edge of the lightmask isn't a fade into darkness. It's more of an abrupt change from being lighter to darker. I've tested on another computer and it's not working right on that other computer either. It has a 22" or so LCD monitor. Anyway I'm just confused as to why it's displaying different based on the monitor. I do scale but I start at 0.6f * hudScale so the lightmask is fairly large and starts even scaled down.

I really don't understand much about shaders so perhaps someone out there can help me understand why there is this difference of how the shader is displaying between monitors. My primary monitor is displaying it exactly how I like it, but more people have 1920x1080 LCD monitors than one like my 25560x1440 S-IPS LED so I want to to display the for all setups.

• Can you post some screenshots of the output of your shader on these different setups? Or is it that the pixel values are the same (you've verified this with screenshots), and the monitors display them differently? In that case, can you try to take some photos that show the difference? Mar 24 '13 at 16:12
• Edited with a screenshot. It's odd, even the screenshot displays that way so it seems it's not necessarily anything programming side that's doing it. The picture isn't perfect but you can sort of see what I mean anyway. It's nothing that terrible. It just comes across a bit differently.
– Ted
Mar 24 '13 at 20:55
• So to clarify, on the right half of the image, the sharp circular edge visible in the bottom right is the artifact you're trying to get rid of? Mar 24 '13 at 21:21
• Yessir, I'm wondering what the reason is for that sharp circular edge to my lightmask that should be soft. This picture here was just a screenshot that was dragged in-between monitors so it appears it may not be a programming problem as I originally thought. I'm just confused to why it's displaying differently, but it's not something I couldn't live with.
– Ted
Mar 24 '13 at 22:07