Advertisement

3D Model Loading Problems

Started by September 27, 2014 07:42 AM
25 comments, last by ryan20fun 10 years, 3 months ago

bd.ByteWidth = sizeof( unsigned int ) * posIndices.size(); // 36 vertices needed for 12 triangles in a triangle list

That could be your problem, You should only hard code values for basic testing or when lazy.
Try changing that to three(assuming that there are only three vertices).

And what do you intend to do with: "posIndices", norIndices, uvIndices?

HTH
As you say it's just for testing.
I use drawIndexed() to draw my vertices. So you mean assimp doesn't export indices for me? If so, I would have to kill myself for struggling for that.................

bd.ByteWidth = sizeof( unsigned int ) * posIndices.size(); // 36 vertices needed for 12 triangles in a triangle list

That could be your problem, You should only hard code values for basic testing or when lazy.
Try changing that to three(assuming that there are only three vertices).

And what do you intend to do with: "posIndices", norIndices, uvIndices?

HTH
As you say it's just for testing.
I use drawIndexed() to draw my vertices. So you mean assimp doesn't export indices for me? If so, I would have to kill myself for struggling for that.................

Assimp does provide/produce indices.

Can you set a breakpoint just after you imported/load the mesh and validate the indices and vertices?

Make sure that the cube has:

  • 36 indices
  • 24 vertices( if there are per vertex normals ) / 8 if there are no normals.

What GPU do you have?, You could then use the tool from the manufacturer to check out the data.

So if you still get invalid results after stepping through the code with the debugger (look at the indices and positions) I will upload the code I am currently using to get the data from Assimp and an explanation of how it is handled.

But it does seam strange that it is not working as the code looks right.

HTH.

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

Advertisement

bd.ByteWidth = sizeof( unsigned int ) * posIndices.size(); // 36 vertices needed for 12 triangles in a triangle list

That could be your problem, You should only hard code values for basic testing or when lazy.
Try changing that to three(assuming that there are only three vertices).
And what do you intend to do with: "posIndices", norIndices, uvIndices?
HTH
As you say it's just for testing.
I use drawIndexed() to draw my vertices. So you mean assimp doesn't export indices for me? If so, I would have to kill myself for struggling for that.................
Assimp does provide/produce indices.

Can you set a breakpoint just after you imported/load the mesh and validate the indices and vertices?
Make sure that the cube has:
  • 36 indices
  • 24 vertices( if there are per vertex normals ) / 8 if there are no normals.
What GPU do you have?, You could then use the tool from the manufacturer to check out the data.

So if you still get invalid results after stepping through the code with the debugger (look at the indices and positions) I will upload the code I am currently using to get the data from Assimp and an explanation of how it is handled.


But it does seam strange that it is not working as the code looks right.

HTH.
I have already checked that. 36 vertices and 36 indices.

What's strange is there's only 8 groups of position info and shouldn't be 36. I think it copies the vertex info and form them as the indices order

My gpu is gt220.Nsight seeems to be a very complex tool for me to handle.

It's a little late right not, But tomorow I will see if I can get a clean copy of my Assimp code up for posting here(Should not be a problem getting it together) smile.png

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

It's a little late right not, But tomorow I will see if I can get a clean copy of my Assimp code up for posting here(Should not be a problem getting it together) :)

thank you :) but if it takes too much time for me then i might consider using a game engine like ogre or irrlicht. I've been working on the models for weeks like an idiot. :(

It's a little late right not, But tomorow I will see if I can get a clean copy of my Assimp code up for posting here(Should not be a problem getting it together) smile.png

thank you smile.png but if it takes too much time for me then i might consider using a game engine like ogre or irrlicht. I've been working on the models for weeks like an idiot. sad.png

Perhaps you should evaluate whether or not to use a engine or not; But you could still do stuff like this on the sidelines.

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

Advertisement

Sorry that this took so long.

I've attached the relevant part of the importation code.

Everything that's needed should be there smile.png

[attachment=24135:code.txt]

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

This topic is closed to new replies.

Advertisement