2012-04-20 10 views
0

SlimDX(DirectX 11)で単純な回転キューブをレンダリングするだけで問題があります。キューブが回転している、これらは私が手画像です:SlimDX(面の穴)を使った不思議なレンダリング

私はこの頂点シェーダ使用

Problem with the rendering

float4x4 WorldViewProj : register(c0); 
    float4 VShader(float4 position : POSITION) : SV_POSITION 
    { 
     return mul(float4(position.xyz, 1.0), WorldViewProj); 
    } 

そして、これは私がWorldViewProjを準備する方法である:の

ProjectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI/4.0), 1f, -1, 20); 
ViewMatrix = Matrix.LookAtLH(new Vector3(0f, 0, ypos), new Vector3(0f, 0, 10), new Vector3(0f, 1f, 0f)); 

Matrix positionMatrix = Matrix.Translation(position); 
Matrix rotationMatrix = Matrix.RotationYawPitchRoll(rotation.X, rotation.Y, rotation.Z); 
Matrix scaleMatrix = Matrix.Scaling(scale); 
Matrix worldMatrix = rotationMatrix * scaleMatrix * positionMatrix; 
worldMatrix = Matrix.Transpose(worldMatrix); 

Matrix WorldViewProj = ViewMatrix * ProjectionMatrix * worldMatrix; 

ファーストを私はこの質問を見ました:Incorrect Clipping and 3D Projection when using SlimDX

そして、おそらく、行列には​​何か問題があります(私は表示も投影も転置せず、世界を転置しません - 反対の場合は何も表示されません)。しかし、私が両方のビュー行列と投影行列を単位行列に設定しても、 "穴"はまだそこにあります。

ご協力いただきありがとうございます。

+0

近所の飛行機でMatrix.PerspectiveFovLH()に-1を指定していませんか?はいの場合、なぜあなたは正の価値を設定していませんか? – Alan

+0

野生の野生の推測:zバッファの解像度が小さすぎますか? –

+0

私は(0.0001fまたは1f)でも - 画像はまったく同じです。 –

答えて

0

問題が見つかりました。インデックスバッファ内の頂点の順序が間違っていました。私に恥を感じています:)ありがとうございました。

関連する問題