0

I'm trying to upload a 3d model using assimp. There is some strange thing going on with the depth. When I use the left-handed projection/view matrix the model looks like this. (The floor and parts of the roof of houses disappear). enter image description here

When I use right-handed projection/view matrix, the model looks like this. (The wall disappears). enter image description here I checked that the depth buffer is enabled, but for some reason, such a strange thing happens anyway. Does anyone have any idea what the problem might be? By the way, I tested this model by using assim and opengl and in opengl the model looks good.

I tested the model using the code from their github without changing anything: SimpleTexturedDirectx11

2
  • This looks like it could be a problem with face culling and vertex winding order of the model. Does it work if you turn off face culling? Commented Jan 7, 2023 at 22:26
  • @AspectOfTheNoob Thanks so much, that was it, I turned off face culling and it works perfectly. Commented Jan 7, 2023 at 22:40

1 Answer 1

1

Seems that the orientation of all your faces in the scene are not in sync. So some of the normals of youe faces are showing outside, some are showing inside. The culling algorithmn is using the normals to idendify which faces must get culled.

So when you have a mixup of clockwise and counter-clockwise oriented faces in your scene you will see only parts. The rest will get culled.

You can fix this by using the flag aiProcess_FixInfacingNormals :

Assimp::Importer importer;
const aiScene* pScene = importer.ReadFile(filename,
        aiProcess_Triangulate |
        aiProcess_ConvertToLeftHanded | aiProcess_FixInfacingNormals);

Let me know if you still see the issue even if you have used this flag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.