Reidar Lange
Member
- Joined
- Oct 29, 2004
- Messages
- 16
In the render method I use this:
Then I set the material color to argb(0,255,255,255) for one of the rendered meshes. I trun off alpha blending for all except one.
The question is: When I set the alpha channel to 0, I would expect the transparent mesh to dissapear completely. Why does it not ?
Code:
device.RenderState.Lighting = true;
device.RenderState.Ambient = Color.FromArgb(100,100,100);
device.RenderState.ZBufferEnable = true;
device.RenderState.CullMode = Cull.CounterClockwise;
device.RenderState.ShadeMode = ShadeMode.Gouraud;
device.RenderState.FillMode = FillMode.Solid;
device.RenderState.AlphaBlendEnable = true;
device.RenderState.AlphaSourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
device.TextureState[0].ColorOperation = TextureOperation.Modulate;
device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
device.TextureState[0].AlphaArgument1 = TextureArgument.Diffuse;
device.TextureState[0].AlphaArgument2 = TextureArgument.TextureColor;
device.TextureState[0].AlphaOperation = TextureOperation.BlendFactorAlpha;
device.Lights[0].Type = LightType.Directional;
device.Lights[0].Diffuse = Color.FromArgb(0,200,200,200);
device.Lights[0].Specular = Color.White;
device.Lights[0].Direction = new Vector3((float)Math.Cos((float)
device.Lights[0].Commit();//let d3d know about the light
device.Lights[0].Enabled = true;
Then I set the material color to argb(0,255,255,255) for one of the rendered meshes. I trun off alpha blending for all except one.
The question is: When I set the alpha channel to 0, I would expect the transparent mesh to dissapear completely. Why does it not ?