I have a problem just with rendering a simple rotating cube with SlimDX (DirectX 11). Cube is rotating and these are the images i get:
I use this vertex shader:
float4x4 WorldViewProj : register(c0);
float4 VShader(float4 position : POSITION) : SV_POSITION
{
return mul(float4(position.xyz, 1.0), WorldViewProj);
}
And this is how i prepare 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;
First of all i saw this question: Incorrect Clipping and 3D Projection when using SlimDX
And, probably, there's something wrong with matrices (since i don't transpose neither view nor projection but transpose world - in opposite case nothing is rendered). But even if i set both view and projection matrices to identity matrix the "hole" is still there.
Please help and thanks in advance!
The problem is found. It was just a wrong order of vertices in an index buffer. Shame on me:) Thanks everybody for your help!