Jump to content
  • Advertisement
Sign in to follow this  
MadLW

3D Model Loading Problems

This topic is 1325 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys

 

I've written an obj loader that could load the 3dmax obj. I tried to draw a cube but all the things aren't what I've been expecting. There was something displayed but the cube looked  awkward and all the vertices are messed up. I don't think it's a cube anyway:(

 

I know there's something called vertex winding stuff. But I just can't fix this. I tried to load an obj file exported by blender. But it's still very messy.

 

I wonder if there's any software could export the exact same thing that is compatible with direct3d standard. It's very difficult to work with something wrong.

Share this post


Link to post
Share on other sites
Advertisement

Why don’t you show a picture of how it looks in your program and how it looks in Blender?

There is no Direct3D 11 standard format; you have to make everything yourself.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

It is typical to see corrupted geometry when programming object importers / exporters. Winding order is the simplest of the problems to solve. Typically invalid output is result of triangles indexing wrong vertices.

 

Cheers!

Share this post


Link to post
Share on other sites

Why don’t you show a picture of how it looks in your program and how it looks in Blender?

There is no Direct3D 11 standard format; you have to make everything yourself.

 

 

L. Spiro

I use 3dmax for this

iDoUAfs.jpg

 

Here's how it looks in my program

hTBgoiB.jpg

Share this post


Link to post
Share on other sites

It is typical to see corrupted geometry when programming object importers / exporters. Winding order is the simplest of the problems to solve. Typically invalid output is result of triangles indexing wrong vertices.

 

Cheers!

I know that. But how could a professional 3d software give wrong indices or vertices? 

By the way, vs2012 model view failed to load the obj exported by max. But it worked well with blender's.

Share this post


Link to post
Share on other sites

 

It is typical to see corrupted geometry when programming object importers / exporters. Winding order is the simplest of the problems to solve. Typically invalid output is result of triangles indexing wrong vertices.

 

Cheers!

I know that. But how could a professional 3d software give wrong indices or vertices? 

By the way, vs2012 model view failed to load the obj exported by max. But it worked well with blender's.

 

The 3D CAD tool 99 times out of 100 produces valid file(albit with there own tweak on some formats like DAE, wavefront object )

The problem most likely exists in your parser code, It is also posible that the CAD tool has produced a edge case with the file.

 

I would recomend that you use a tool like Assimp to do the heavy lifting for you and you just process the data from it.

It's what i do, And it saves me from the hassle of different 3D formats as it handles a nice variety of them.

 

Hope that helps smile.png

Share this post


Link to post
Share on other sites

kauna: "It is typical to see corrupted geometry when programming object importers / exporters.."

 

how could a professional 3d software give wrong indices or vertices?

 

Unlikely. I think kauna was referring to your importer. You should be checking the vertex/index array that you generate after you read in the obj file.

 

My guess at what was intended by kauna's comment is for you to check your data after reading in the obj file (which is the way to go at this point):

 

1. Do the triangles as indexed form a cube?

2. Assuming your app culls counter-clockwise, are the triangle vertices as indexed in clockwise winding order? I.e., when viewed from outside the cube, does each set of triangle vertices appear in clockwise order, relative to the center of each triangle?

3. If you're using a simple vertex array without indexing, does each set of 3 vertices in series in the vertex buffer form a triangle in clockwise winding order?

Edited by Buckeye

Share this post


Link to post
Share on other sites

It is typical to see corrupted geometry when programming object importers / exporters. Winding order is the simplest of the problems to solve. Typically invalid output is result of triangles indexing wrong vertices.
 
Cheers!

I know that. But how could a professional 3d software give wrong indices or vertices? 
By the way, vs2012 model view failed to load the obj exported by max. But it worked well with blender's.
The 3D CAD tool 99 times out of 100 produces valid file(albit with there own tweak on some formats like DAE, wavefront object )
The problem most likely exists in your parser code, It is also posible that the CAD tool has produced a edge case with the file.
 
I would recomend that you use a tool like Assimp to do the heavy lifting for you and you just process the data from it.
It's what i do, And it saves me from the hassle of different 3D formats as it handles a nice variety of them.
 
Hope that helps :)
i don't know much about assimp.but i think i will have to go there some day. Is there any tutorial about assimp with d3d? If not , gl is fine

Share this post


Link to post
Share on other sites

The most likely problem is that you are not handling indices properly.
 
#1: Have you accounted for the fact that indices are 1-based and not 0-based?
#2: Have you accounted for the fact that there are 2 mapping modes for indices?  http://en.wikipedia.org/wiki/Wavefront_.obj_file#Relative_and_absolute_indices
 
 
L. Spiro

what's mapping mode? For th first question i did thought about it

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!