Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
float4 color1, color2, color3, color4;
sampler textureSampler;
float4 MainPS(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR
{
float4 spriteColor = tex2D(textureSampler,coords);
if(spriteColor.r < 0.1)
return color1;
if(spriteColor.r < 0.3)
return color2;
if(spriteColor.r < 0.5)
return color3;
return color4;
}
technique SpriteDrawing
{
pass P0
{
PixelShader = compile ps_4_0_level_9_1 MainPS();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment