Reidar Lange Posted November 4, 2004 Posted November 4, 2004 In the render method I use this: 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 ?transparent.bmp Quote
ThePentiumGuy Posted November 5, 2004 Posted November 5, 2004 Wow... nice work. Sorry, I really dont know the answer to your question... but... if you want the mesh to disappear why not just not render it :P? -The Pentium Guy Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Reidar Lange Posted November 5, 2004 Author Posted November 5, 2004 (edited) The simplest soulution is often the best. Very good point :) You are quite right, but what if I want the mesh to be even more transparent than what you see on the snapshot, but not completely gone ? I have tried to fiddle with different alpha settings, but this is the best I could come up with. Edited November 5, 2004 by Reidar Lange Quote
Loffen Posted November 6, 2004 Posted November 6, 2004 (edited) Not sure here (yes, i am a DX n00b. Just trying to find some logic in DX). I always thought that SourceBlend and DestinationBlend were linked, and AlphaSourceBlend and AlphaDestinationBlend were linked. But i see you use: device.RenderState.AlphaSourceBlend = Blend.SourceAlpha; device.RenderState.DestinationBlend = Blend.InvSourceAlpha; Really not sure here, just something that popped up in my head while reading... -- Loffen Edited November 6, 2004 by Loffen Quote Erutangis a si tahw
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.