Material Alpha


Alpha data also can be supplied in a material. To enable material alpha, set the diffuse material render state so that the runtime uses the material diffuse color components rather than the vertex diffuse color components, as shown in the following C# code.

          [C#]
          
// Enable material alpha. device.RenderState.DiffuseMaterialSource = ColorSource.Material;

The following C# code initializes the material with an alpha value, and sets the material before drawing.

          [C#]
          
Material mtrl = new Material(); Color c = Color.FromArgb(127, 255, 0, 0); mtrl.Diffuse = c; mtrl.Ambient = c; mtrl.Specular = c; mtrl.Emissive = c; device.Material = mtrl;

Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center