Вот что я нашел ..... (Marshall Belew @ forums.create.msdn.com/forums/p/16066/553792.aspx#553792) Спас мой день ...
Решение простое: BasicShader имеет свойство DiffuseColor.Я просто добавил новое поле в шейдер Toon, и всякий раз, когда текстуры не было, я подставлял значение цвета.
Я доволен этим решением, потому что теперь мне не нужно писать тонну вершин.декларация / рисование примитивной логики.
Из файла .fx:
// Pixel shader applies a cartoon shading algorithm.
float4 ToonPixelShader(LightingPixelShaderInput input) : COLOR0
{
float4 color = TextureEnabled ? tex2D(Sampler, input.TextureCoordinate) : DiffuseColor;
Замена эффектов (это измененный фрагмент из примера NonPhotoRealistic).
// Scan over all the effects currently on the mesh.
foreach (BasicEffect oldEffect in mesh.Effects)
{
// If we haven't already seen this effect...
if (!effectMapping.ContainsKey(oldEffect))
{
// Make a clone of our replacement effect. We can't just use
// it directly, because the same effect might need to be
// applied several times to different parts of the model using
// a different texture each time, so we need a fresh copy each
// time we want to set a different texture into it.
Effect newEffect = replacementEffect.Clone(
replacementEffect.GraphicsDevice);
// Copy across the texture from the original effect.
newEffect.Parameters["Texture"].SetValue(oldEffect.Texture);
newEffect.Parameters["TextureEnabled"].SetValue(
oldEffect.TextureEnabled);
Vector4 color = new Vector4(oldEffect.DiffuseColor, 1.0f);
newEffect.Parameters["DiffuseColor"].SetValue(color);
effectMapping.Add(oldEffect, newEffect);
}
}