0

ブレンダーから xna にアルファ ブレンディングを使用してテクスチャ モデルをロードする際に問題が発生しています。

ブレンダーでは、テクスチャに正しいアルファ値があることがわかっていますが、モデルをゲームに描画するたびに、透明になるはずだった余分なスペースが代わりに黒く塗りつぶされます

これは私の描画方法がどのように見えるかです。

public void draw()
    {

        Matrix posTranslated = Matrix.CreateTranslation(position); 
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();


                effect.View = view;
                effect.Projection = proj;
                effect.World = modelTransforms[mesh.ParentBone.Index] * posTranslated;
            }

            mesh.Draw();

        }
    }

グラフィックス デバイスへの影響や変更を見逃していませんか? 私は何日も探していましたが、この問題についてはまだほとんど運がありません。助けてくださいTT

4

1 に答える 1

2

これらのプロパティを設定しましたか?

graphicsDevice.RenderState.AlphaBlendEnable = true;
graphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
graphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;

XNA 4.0を使用している場合は、古いRenderStateの代わりにブレンド状態を設定する必要があります。

BlendState blendState = new BlendState()
{
    AlphaSourceBlend = Blend.SourceAlpha,
    AlphaDestinationBlend = Blend.InverseSourceAlpha, 
    ColorDestinationBlend = Blend.InverseSourceAlpha, // Required for Reach profile
};
GraphicsDevice.BlendState = blendState;
于 2012-06-14T07:48:58.460 に答える