Differents parts of model get rendered on different video cards

Hey
I am building an open gl app that is supposed to load and show 3D models. I have a bit of an issue however.
Half of the models I load are missing some parts of them and the more primitive ones (cubes, pyramids…etc) are loading correctly.

Anways, while trying to solve the previous issue, I noticed something even worse. When I ran my app using my Intel HD Graphics GPU I got a different result from when I ran it using my nVidia GPU. I also tested it on 2 different machines and got same results.

Intel HD Graphics GPU : https://postimg.org/image/5e7fhf2dn/
Nvidia GPU : https://postimg.org/image/mha7cxj2j/

I want to note that on BOTH GPU’s I am still missing parts of the model (you can see the hands on the model are missing on both pictures)
But the nvidia gpu is also missing the bottom half of the model.

I am completely stuck with the issue and would appreciate any help possible. I can also post the source if someone needs it.
PS: Here are the wireframe versions of both renders
Intel: https://postimg.org/image/5fhdau47f/
Nvidia: https://postimg.org/image/ywx2xn4f5/

PS2: The renders are taken on the same machine, with EXACTLY the same source code, only difference being the GPU I run my .exe file with.

Hard to tell like this.

You might:

  • Exceed some OpenGL maximum values (ie GL_MAX_ELEMENTS_VERTICES, GL_MAX_ELEMENTS_INDICES, GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB or any others)
  • Do something not fully GL compliant (nvidia cards are known to accept that)
  • Run into some errors leading to undefined behaviors and thus having GL behaves differently due to this

Give as much details as possible.

[QUOTE=Vorpcho;1285993]I want to note that on BOTH GPU’s I am still missing parts of the model … But the nvidia gpu is also missing the bottom half …
I am completely stuck with the issue and would appreciate any help possible. I can also post the source if someone needs it.[/quote]

Posting some source might spark more ideas from folks reading your post.

That said, I don’t think you’re stuck. Try changing things. For instance, scale back what you’re doing until one of the problems goes away, or start simple and add to it until you start seeing problems. Then look carefully at the most recent change you made to see exactly what it’s doing.

Are the models you’re loading which do not render correctly skinned models? Are you trying to render them with skinning or without skinning (i.e. in the bind pose)?

It seems a bit suspicious to me that in the screenshots you posted, the parts that are missing are so anatomically-related (hands, lower-abdomen). I wonder if the presence of joint indices and weights may have something to do with it. Alternatively, are the vertices in the hands and the lower half of the model stored somehow separately or differently from those in the upper part of the model?

I guess that’s fair. Here is a link to the github repo : Ionic-3D-Model-Viewer/Ionic/Ionic-core/src at master · HristoHentov/Ionic-3D-Model-Viewer · GitHub
My “main” code is Under Application/Ionic.cpp.

The main code associated with model loading is in the Mesh.cpp and Model.cpp classes in the Graphics folder.

As far as for joints/weights and any kind of skinning. The model is quite simple. (I wanted to start with a simple model and go on after that).
Additionally, I also thought that missing anatomy-related parts was suspicious. However, I am also missing the visor on the helmet and in the case where I have the legs, part of the right leg is missing (really random part around the calf).

Anyways, I might also give the reconstructing a try if NOTHING else works, but for now I am avoiding it since I want to have this finished in a certain timeframe.
Since you guys asked for more details, here is some I can think of:
--------------------------------

[ul]
[li]I really am not sure what details would help diagnose my issue, so I will just list everything I can think of:
[/li][li]I use ASSIMP as a model loading library and I load models with triangles only and always generate normals for them.
[/li][li]I load the vertex positions, vertex normals and texture coordinates into buffers that I bind to a VAO.
[/li][li]I also load vertex indices into an element array object and link that to the VAO as well.
[/li][li]I am targeting OpenGL 3.3 (#version 330 with my shaders).
[/li][li]I tried putting most of my code in the main function to make sure I haven’t screwed something with all the classes that I use to wrap Shaders/Buffers/ModelData etc… Results were same.
[/li][li]I tried setting various glfw window hints related to open gl. No luck as well
[/li][li]I have tested my app on Intel HD Graphics 4000, GTX 560, GTX 980 and
[/li][/ul]

Here is a link to the source of my project : https://github.com/HristoHentov/Ionic-3D-Model-Viewer/tree/master/Ionic/Ionic-core/src

My “main” code is under Application/Ionic.cpp
I load models via assimp into a “Model” object (Graphics/Model.cpp) and every model can have multiple meshes (Graphics/Mesh.cpp)

I do all my buffer binding in the Mesh.cpp file.
I just want to mention that I recently tried loading a very simple scene (a couple of spheres created in Blender) and what I discovered is that I would get 2/3 or maybe 5/7 spheres actually rendering, so I can imagine
my program is not reading separate meshes from an obj correctly. However, this still does not answer the question why different GPU’s render different parts. How can I check if I am going over some OpenGL limits…
Is there any opengl debug/log functions that I can call?

Also, it should be evident from the code, but to save some time…

[ul]
[li]I load an object and store the data in a vector<Vertex> where Vertex is a struct that contains position,normal and uv coordinates for the given vertex. I also store Texture information and Indicies.
[/li][li]I fill buffer objects with information for the vertex Positions,Normals and UVs
[/li][li]I also store an EBO for the indices
[/li][li]I draw using glDrawElements(), calling it once for every mesh in my scene (So if I have a model that has 3 seprate parts (meshes) I call glDrawElements 3 times)
[/li][li]I tried running my app on Intel HD Graphics 4000, 5000 and nvidia gtx 560, nvidia gtx 980
[/li][/ul]

PS: I have a couple of classes (Buffer.cpp, VertexArray.cpp and IndexBuffer.cpp that have OpenGL buffer functionality, which I am currently not using so you can ignore them)

Here is a link to the github repo : https://github.com/HristoHentov/Ionic-3D-Model-Viewer/tree/master/Ionic/Ionic-core/src

My main code is under Application/Ionic.cpp
I do all my buffer generation in Model.cpp and Mesh.cpp.

*Buffer.cpp, VertexArray.cpp, IndexArray.cpp and their respective .h files are planned for further development and currently not used anywhere. You can ignore them.

I tried loading a scene with 6 separate spheres (each sphere was its own object, but they were exported into 1 .obj file), and my app loaded 4 of them.
Could it be that I somehow have not instructed open gl to load more than X amount of separate objects? (I will also look over my model loading procedure, although i am 99% sure it works correctly)

Well, at first read, nothing look bad.

You’ll have to put debug information to ensure how many faces (and many other relevant information) you are rendering in both situation. You can even debug and check it.
Consider also my previous post.

[QUOTE=Vorpcho;1286007]I just want to mention that I recently tried loading a very simple scene (a couple of spheres created in Blender) and what I discovered is that I would get 2/3 or maybe 5/7 spheres actually rendering, so I can imagine
my program is not reading separate meshes from an obj correctly. [/QUOTE]

Sounds like a good line to chase. For instance, only load and render mesh 1 of each model. Then try mesh 2. Repeat until you have one you know exists but it is not loading and rendering properly. Deep dive on that.

However, this still does not answer the question why different GPU’s render different parts.

Good point. So there may be yet another (or at least a different) problem.

How can I check if I am going over some OpenGL limits…

From what I’ve seen of your models, you’re not going anywhere near OpenGL limits, particularly with the modern GPUs you’re using.

You can dump the max number of vertices and indices per mesh that you’re using though if you want to be sure.

Is there any opengl debug/log functions that I can call?

Call glGetError() to make sure you’re not triggering any GL errors.

There’s also the ARB_debug_output extension, which can provide some useful performance tips (and sometimes point out errors in your code) on some drivers. NVidia’s GL drivers for instance. Just create a debug context, register a debug callback, and print out all the messages that get sent to the callback. It may point out something useful in your case, but I wouldn’t bet on it.

Try ignoring the textures and texture coordinates in your model, and just render all your faces with a solid color (no texture, no normal, no shading). Things like that – just disable or throw out functionality until you see an important change.