Tag: direct3d11

如何使用SharpDX Toolkit绘制透明3D对象?

我正在开发一个使用SharpDX和SharpDX Toolkit绘制简单3D形状的应用程序,Geometrics.Desktop样本对入门非常有帮助。 现在我正在努力使一些形状变得透明,并且为了简单起见,我只是试图让那个样本中的茶壶模型显得透明(也许半透明会更精确)。 对于那些不熟悉Geometrics.Desktop示例的人来说,它会在3D中绘制一些简单的原始几何形状。 作为一个示例应用程序,它非常简单,因此它是一个非常好的暂存器,用于试验SharpDX“Toolkit”库的3Dfunction。 我已将此添加到LoadContent方法(在启动时运行一次),以便准备Direct3D进行混合: var blendStateDescription = new BlendStateDescription(); blendStateDescription.AlphaToCoverageEnable = false; blendStateDescription.RenderTarget[0].IsBlendEnabled = true; blendStateDescription.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha; blendStateDescription.RenderTarget[0].DestinationBlend = BlendOption.InverseSourceAlpha; blendStateDescription.RenderTarget[0].BlendOperation = BlendOperation.Add; blendStateDescription.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero; blendStateDescription.RenderTarget[0].DestinationAlphaBlend = BlendOption.Zero; blendStateDescription.RenderTarget[0].AlphaBlendOperation = BlendOperation.Add; blendStateDescription.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All; var blendState = SharpDX.Toolkit.Graphics.BlendState.New(this.GraphicsDevice, blendStateDescription); this.GraphicsDevice.SetBlendState(blendState); 我已经设置了深度模板如下: var depthDisabledStencilDesc = new DepthStencilStateDescription() { IsDepthEnabled = false, DepthWriteMask […]