Home Articles Tutorials Resources About

Grayscale rendering in MDX (Fixed function)


By Rim van Wersch, January 9 2006




// set up texture states 
if (grayscale) 
{ 
 ? ?device.TextureState[0].ColorOperation = TextureOperation.DotProduct3; 
 ? ?device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; 
 ? ?device.TextureState[0].ColorArgument2 = TextureArgument.TFactor; 
 ? ?// this will make out DotProduct3 operation output the luminance as the final color, see discussion for details
 ? ?device.RenderState.TextureFactor = ( 0xFF << 24 ) | ( (255-76) << 16) | ( (255-150) << 8) |(255- 29); 
} 
// render as normal        





Further reading


  • ?
?
MDX info is an initiative by vector4. All content is copyright ? 2005-2006 by its respective authors | About MDX info | Terms of Use |
Coming soon!