深さの問題に関する XNA 4.0 の大きな頭痛の種:
私はすでに同様の問題に対する多くの答えを見つけましたが、誰も私のために働きません...
デバイスは次のように設定されています。
xnaPanel1.Device.BlendState = BlendState.Opaque;
xnaPanel1.Device.DepthStencilState = DepthStencilState.Default;
xnaPanel1.Device.PresentationParameters.DepthStencilFormat = DepthFormat.Depth24Stencil8;
[...]
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 4.0f / 3.0f, 0.1f, 1000f);
残忍な問題解決者として、私はほとんどの DepthStencilFormat と DepthStencilState の可能性を試しました...誰も私が望むようには機能しません。
射影行列に関して、私は多くのnearclipとfarclipの値も試しました。(立方体の幅: 10f) ですが、正しい結果が得られません。
これをさまざまなテクスチャでテストしましたが、すべて不透明です。
BasicEffect ではなく、テクスチャ + 法線マップを使用したエフェクトを使用していますが、それが原因でしょうか?
CubeEffect.fx
[...]
sampler2D colorMap = sampler_state
{
Texture = <colorMapTexture>;
MagFilter = Linear;
MinFilter = Anisotropic;
MipFilter = Linear;
MaxAnisotropy = 16;
};
sampler2D normalMap = sampler_state
{
Texture = <normalMapTexture>;
MagFilter = Linear;
MinFilter = Anisotropic;
MipFilter = Linear;
MaxAnisotropy = 16;
};
[...]
編集: BasicEffect で試しましたが、問題は同じです...
だから...助けてくれてありがとう;)