我想顯示混合平行六面體容器內部的多個3D對象。 獲得的結果不令人滿意。如何Direct3D Alpha混合
第一個數字似乎是正確的 https://picasaweb.google.com/lh/photo/QabTkrf2zyIMP0UEuZvmTdMTjNZETYmyPJy0liipFm0?feat=directlink
而且 https://picasaweb.google.com/lh/photo/JqnZqeTuomNLqDR5vhizadMTjNZETYmyPJy0liipFm0?feat=directlink
我使用託管的DirectX用C#
初始化第二個是錯誤的:
DxDeviceArea.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI/4, 1.0f, 1.0f, MaxSizeArea * 2);
DxDeviceArea.Transform.View = Matrix.LookAtLH(new Vector3(0, 0, MaxSizeArea/2f), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
DxDeviceArea.RenderState.Lighting = true;
DxDeviceArea.RenderState.CullMode = Cull.CounterClockwise;
DxDeviceArea.RenderState.SourceBlend = Blend.SourceAlpha;
DxDeviceArea.RenderState.DestinationBlend = Blend.InvSourceAlpha;
DxDeviceArea.RenderState.AlphaBlendEnable = true;
DxDeviceArea.RenderState.BlendOperation = BlendOperation.Add;
DxDeviceArea.RenderState.AlphaTestEnable = true;
//Set light
DxDeviceArea.Lights[0].Type = LightType.Directional;
DxDeviceArea.Lights[0].Diffuse = Color.White;
DxDeviceArea.Lights[0].Direction = new Vector3(0, 0, -1);
DxDeviceArea.Lights[0].Enabled = true;
在渲染功能第一步驟是繪製對象 第二個是繪製混合邊框。
之前繪製第二i開關cullmode從逆時針無
DxDeviceArea.RenderState.CullMode = Cull.None;
旋轉
//rotation
DxDeviceArea.Transform.World *= Matrix.RotationY((-PosX/300F)) * Matrix.RotationX(PosY/300F);
我如何才能戰勝顯示問題?
半透明盒子還包含半透明物體嗎? – Ani