질감이있는 모델을 표시하는 데 문제가 있습니다. 모든 것이 완벽하게 작동하지만, 루프를 사용하여 텍스처를 반복하여 화면에서 바닥 20 X 20을 나타냅니다. 내 텍스처가 올바르게 반복됩니다. 그러나 왜 모든 텍스처가 깜박임을 발생시키는 지 이해할 수 없습니다 ... 나는 이미지가 서로 겹쳐있는 것을 발견했습니다. 루프가 올바르게 코딩되었는지 확인했습니다.내 xna 프로젝트에서 내 이미지가 왜 깜박입니까?
페이지의 스크린 샷 :
내 코드 (루프 기능 생성 접지) :
//Function draw - ground land
private void draw_groundLand(Vector3 position_model_origin)
{
//example generation mode 4x4 cubes
int[,,] MatriceWorldCube = new int[1,2,2];
MatriceWorldCube[0, 0, 0] = 1;
MatriceWorldCube[0, 0, 1] = 1;
MatriceWorldCube[0, 1, 0] = 2;
MatriceWorldCube[0, 1, 1] = 1;
int height = MatriceWorldCube.GetLength(0);
int width = MatriceWorldCube.GetLength(1);
int length = MatriceWorldCube.GetLength(2);
Vector3 pos_reference = position_model_origin;
for (int thickness = 0; thickness < height; thickness ++)
{
for (int column = 0; column < width; column ++)
{
for (int line = 0; line < length ; line ++)
{
// Copy any parent transforms.
Matrix[] transforms = new Matrix[model_ground_land1.Bones.Count];
model_ground_land1.CopyAbsoluteBoneTransformsTo(transforms);
// Draw the model. A model can have multiple meshes, so loop.
foreach (ModelMesh mesh in model_ground_land1.Meshes)
{
// This is where the mesh orientation is set, as well
// as our camera and projection.
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(cubeGroundLand1_modelRotation) * Matrix.CreateTranslation(position_model_origin);
effect.View = View;
effect.Projection = Projection;
}
// Draw the mesh, using the effects set above.
mesh.Draw();
}
position_model_origin.X = (float)(line +1);
}
position_model_origin.X = pos_reference.X;
position_model_origin.Z = (float)(column +1);
}
position_model_origin.Z = pos_reference.Z;
position_model_origin.Y = (float)(thickness+1);
}
position_model_origin.Y = pos_reference.Y;
position_model_origin = pos_reference;
}
당신의 도움에 미리 감사드립니다. 인내심을 잃어 버린다. (주말 내내^^)
[z-fighting] (http://en.wikipedia.org/wiki/Z-fighting)와 유사합니다. – CodeCaster
감사합니다.이 문제를 알지 못했습니다. 방금 "XNA"를 시작했습니다. 이것을 피하기 위해 무엇을 권하고 싶습니까? Z- 파이팅을 어떻게 설정 하시겠습니까? 대단히 감사합니다. –
링크에서 : _ "Z- 파이팅은 더 높은 해상도의 깊이 버퍼를 사용하거나, 일부 시나리오에서 z 버퍼링을 사용하거나, 단순히 다각형을 멀리 떨어지게하여 줄일 수 있습니다."_ 같은 장소에 너무 많은 다각형이있는 것 같습니다. – CodeCaster