View Full Version : 3ds file with 'wrong' faces

Hi,

When reading 3ds files and calculating face normals based on the assumption that outside is when the vertices are in CCW order, it turns out lots of models I've downloaded from the net contain 'incorrect' faces.

Is there some way to correct these faces (programmatically) so all normals point in the right direction?

I've tried scanning the face list for identical vertex-sequences in different faces and when found reversing the vertex order for one of them, but that is not enough :-(

Thanks for any info or pointers to a solution

Jean-Marc.

Of course all models also contain lots of CORRECT faces, so I'm looking for a way to find and change ONLY the incorrect faces, not ALL faces...

Jean-Marc

Gavin

10-16-2001, 12:23 AM

But how will you know which face is correct and which is incorrect? Could do... find the cofg of the model and then check that all normals a re facing away from this, but this could have obvious problems with concave shapes. Oh well i'll be buggered if I know.

Originally posted by Gavin:

But how will you know which face is correct and which is incorrect?

I know, that is not trivial. I'm assuming the model consists of 'nice' surfaces. If that is the case, I'll be content if I get all normals consitently pointing one way.

Once I get that, I'll start thinking about detecting what is 'inside' and what is 'outside'.

Thanks anyway.

Jean-Marc.

harsman

10-16-2001, 03:08 AM

There is a method for generating consistent face normals in Zed3d, which you can get here: http://www.math.mcgill.ca/~loisel/zed3d095.zip

Originally posted by harsman:

There is a method for generating consistent face normals in Zed3d, which you can get here: http://www.math.mcgill.ca/~loisel/zed3d095.zip

Thanks harsman. The book looks good to me, even though it has a lot of math to dig through. I'll certainly give it a shot, but hopefully there are some shortcuts for triangle faces instead of regular polygons...

Jean-Marc.

harsman

10-16-2001, 05:07 AM

You don't actually have to go through the entire document you know http://www.opengl.org/discussion_boards/ubb/wink.gif The generating normals for polyhedra part is on page 94 in the word version, although it's part of a larger section that starts on page 91.

Ok I think I found something. Duh! It was in the documents all the time.

The face entries in the 3ds also have a flag word which I ignored until now. The flag word contains three bits that indicate visibility of the directed edges CA, BC and AB. From this I think I can deduce the CW or CCW orientation and calculate the correct normal.

Thanks for the other replies.

Jean-Marc

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.