By the way, here's what I have for my color toon shader:
And the script:
Code:
material mat_rgb
{
effect = "
sampler2D g_samSrcColor;
float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
int Color_all;
Color = tex2D( g_samSrcColor, Tex.xy);
Color_all = ((Color.r + Color.g + Color.b)/3)/.167;
if(Color.r > Color.b && Color.g > Color.b)
{
Color.b = 3*((Color_all*.167)+ .084)-Color.r-Color.g;
}
if(Color.b > Color.r && Color.g > Color.r)
{
Color.r = 3*((Color_all*.167)+ .084)-Color.b-Color.g;
}
if(Color.r > Color.g && Color.b > Color.g)
{
Color.g = 3*((Color_all*.167)+ .084)-Color.r-Color.b;
}
if(Color.r == Color.b && Color.r == Color.g)
{
Color.rgb = Color_all * .167;
}
return Color;
}
technique PostProcess
{
pass p1
{
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}
";
}
As you can see it works just fine on most of the different colored balls, but the yellow and orange aren't working for some reason, and the purple is having some weird issues. I just can't seem to figure out what the problem is, but I think I'm getting close.