在另一个顶部绘制3D模型

我正尝试在Monogame / XNA中用Blender绘制一个3D模型,这是我在绘制其中的两个之后得到的结果

1

我怎样才能使颜色不加起来,但一个涵盖另一个? 这是我的绘图代码:

protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); Vector3 modelPosition = new Vector3(-2500, 1500.0f, 0.0f); Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 5000.0f); float aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width / (float)graphics.GraphicsDevice.Viewport.Height; Vector3 scale = new Vector3(1f, 1, 1); Matrix[] transforms = new Matrix[Brick.Bones.Count]; Brick.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in Brick.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = transforms[mesh.ParentBone.Index]*Matrix.CreateScale(scale)* Matrix.CreateRotationY(modelRotation)*Matrix.CreateTranslation(modelPosition); effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); } mesh.Draw(); } base.Draw(gameTime); } 

渲染对象时,需要将blendState设置为alpha混合。 你可以这样做:

 GraphicsDevice.BlendState = BlendState.AlphaBlend; 

这段代码应该在绘制网格之前进行。