rifter1818 Posted July 17, 2004 Posted July 17, 2004 This is odd but when i enable lighting everything disapears, however Ambient is set to white? Also i still cant get my engine to use Black as transparant. d3d.Dev.RenderState.Lighting = true; d3d.Dev.RenderState.Ambient = Color.White; d3d.Dev.RenderState.CullMode = Cull.None; d3d.Dev.RenderState.AlphaBlendEnable = true; d3d.Dev.RenderState.AlphaTestEnable = true; d3d.Dev.RenderState.ReferenceAlpha = Color.Black.ToArgb(); d3d.Dev.RenderState.AlphaFunction = Compare.NotEqual; d3d.Dev.RenderState.AlphaSourceBlend = Blend.SourceAlpha; d3d.Dev.RenderState.AlphaDestinationBlend = Blend.InvSourceAlpha; d3d.Dev.RenderState.ColorVertex = true; d3d.Dev.RenderState.AlphaBlendOperation = BlendOperation.Add; Quote
Kavan Posted July 18, 2004 Posted July 18, 2004 I'm guessing here, but I think the problem is in one of the following lines: d3d.Dev.RenderState.ReferenceAlpha = Color.Black.ToArgb(); d3d.Dev.RenderState.AlphaFunction = Compare.NotEqual; d3d.Dev.RenderState.ColorVertex = true; Quote
Drak Posted July 20, 2004 Posted July 20, 2004 (edited) Alernatively your problem may be that you do not have 'normal' data for your object. DirectX then renders everything in black when lighting is turned on. Edited July 20, 2004 by Drak Quote
rifter1818 Posted July 21, 2004 Author Posted July 21, 2004 I think you got it there That sounds about right, Ill have to apply some normals when i get a chance, just the transparancy problem left to go and one more project effectively done! (with many debts owing to the people here). Quote
Drak Posted July 21, 2004 Posted July 21, 2004 Normals are easy, luckily That sounds about right' date=' Ill have to apply some normals when i get a chance, just the transparancy problem left to go and one more project effectively done! (with many debts owing to the people here).[/quote'] If you've got a mesh, you can let DX itself calculate the normals throught the Mesh.ComputeNormals() method. Be aware that if you re-use vertices DX will calculate the normals for those vertices as an average of all the surfaces which leads to 'roundish' results (at least it did for my meshes), which are not always what you want. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.