Assimp loading model

Started by
13 comments, last by kolarz3 10 years, 9 months ago
  1. Your problem is at aiMesh *mesh = scene->mMeshes[0];, you're loading only one mesh, if you have multiple materials it'll be split up, that's why you might be missing vertices.
  2. Your loop assumes all faces have 3 indices, if you didn't specify flags to remove points, remove lines and triangulate surfaces then it might result in the mess you're receiving.
  3. numIndi=mesh->mNumFaces;, looks like you forgot to multiply by 3.
Advertisement

Can you somone tell me why blender dupicate several timer one vertex. Model that have 18 000 vertex blender save(x. format) with 52 000 vertex ?

Assume you have a simple cube. In the most basic case that means 8 vertices and 6 faces. If you want to render it using either OpenGL or Direct3D using canonical lighting you will usually need to create a mesh with 24 vertices and 12 faces. You could also end up with 36 vertices and 12 faces (more vertices but we don't need an index buffer - might actually be a good idea for such a simple mesh).

Depending on the file format you chose any of these numbers up there could be stored in the file. None of them are wrong for our little cube.

Without knowing anything about the mesh you have, how you generated normals (and similar vertex attributes like texture coordinates) for it and which file format you chose there is really not much more than "looks about okay" anyone can say.

That said, I strongly suggest you stick to simple meshes while learning. There is no big difference in getting a 10000 vertices bullet or a 8 vertices cube to load and render correctly. But it makes a huge difference when you can just look at values in the debugger and immediately see whether they are sensible or not.

Again i try to load model. This is my result :

e1x.png

This should be cube. I write to txt. file indi and vert and they look good.


0. 0 3 2
1. 2 1 0
2. 4 7 6
3. 6 5 4
4. 8 11 10
5. 10 9 8
6. 12 15 14
7. 14 13 12
8. 16 19 18
9. 18 17 16
10. 20 23 22
11. 22 21 20

0. -1 1 1
1. -1 -1 1
2. 1 -1 1
3. 1 1 1
4. 0.999999 -1 -1
5. -1 -1 -1
6. -1 1 -1
7. 1 0.999999 -1
8. 1 -1 1
9. 0.999999 -1 -1
10. 1 0.999999 -1
11. 1 1 1
12. -1 -1 1
13. -1 -1 -1
14. 0.999999 -1 -1
15. 1 -1 1
16. -1 1 1
17. -1 1 -1
18. -1 -1 -1
19. -1 -1 1
20. -1 1 -1
21. -1 1 1
22. 1 1 1
23. 1 0.999999 -1

I find answer. I have problem because i have diffrent definition of Vertex structure

This topic is closed to new replies.

Advertisement