3d model format with normals

honkFactory
Unregistered
 
Post: #1
Howdy
Is there a 3d model format that also contains info like normals and possibly colors at each vertex? I am perticularily interested in normals. I know how to calulate normals in several ways but I am worried about the orientation of normals, especially when the model that you are working with has many folds or holes. Do some model formats list vertices for a polygon in such a way as to define the orientation of a normal relative to the surface (say something like a right hand rule)? What do you think is the best model format and do you know of someplace where I can find info on it?
Also I was wondering if anyone know of a good model editor. Maybe a lite version of a full feature animation program.
Thanks
A.W.
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #2
I think 3D packages generate normals on the fly, usually. Look up algorithms like PHONG shading, there should be some info on how to re-create vertex normals with some standard method.

- D.G
Quote this message in a reply
honkFactory
Unregistered
 
Post: #3
I should have pointed out that I want to import the models into openGL (maybe that was already understood because this is posted in the openGL forum.) My concern is that when one generate normals, one wants the normals to point away from the interior of the surface. Now lets say that you have a triangle on a surface defined by 3 vertices, A,B and C. The normal to the surface N = ABxAC. But N will either point into the interior of the model or away from the interior of the model. If the only info you have is the 3 vertices it is impossible to say which, unless the vertices of the polygon always are listed with the same orientation, say counter-clockwise with respect to proper normal orientation (a right hand rule). Does anybody know if certain model format have this feature included? It would make it easy to generate normals on the fly in openGL.
A.W.
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #4
I guess all formats which do not explicitly store normals do it that way. Since in OpenGL, it is also the seqence of the points that determines which if the face is front or back.

- D.G
Quote this message in a reply
tod_baudais
Unregistered
 
Post: #5
3ds has a flag that tells you if you have to reverse the normals when importing a triangle. So if you designed you model in the editor with all of the normals in the right direction, they will be imported in the right direction.

Now so I am completely redundant, here is a bit of my 3DS loader (Weird types included)

Code:
BAS_uint    IMPORT_3ds::Parse_Tri_Face(BAS_Input_File &in, BAS_uint owner_chunk_size)
{
    BAS_uint size_read = 0;
    BAS_ushort    num_faces, info;
    
    size_read += Read(in,num_faces);
    
    for (BAS_uint i = 0; i < num_faces; ++i) {
        size_read += Read(in,v1);
        size_read += Read(in,v2);
        size_read += Read(in,v3);
                
        size_read += Read(in,info);
        
[b]
        // Test for inverting normal
        if (!(info & 0x0007))
            std::swap(v2, v3);

[/b]
        // Add the face here
    }
    return size_read;    
}

Then the correct normal is (v2-v1)x(v3-v1).


Tod.
Quote this message in a reply
honkFactory
Unregistered
 
Post: #6
Cool. What do you make your 3ds models with? Where can I find out specs on the 3ds format?
Thanks
A W
Quote this message in a reply
tod_baudais
Unregistered
 
Post: #7
The guys I'm working with use Cinema 4D but any program should do. Try this site for more info: http://www.wotsit.org/
Quote this message in a reply
furballphat
Unregistered
 
Post: #8
obj is another one which supports normals and also materials for colours. It is a very easy format to implement.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Model Format Suggestions? TythosEternal 4 3,241 Apr 19, 2009 11:40 PM
Last Post: Frank C.
  3d model with MD5 format green_ghost 2 3,985 Jun 21, 2008 07:40 PM
Last Post: green_ghost
  Normals Nick 20 8,220 Mar 25, 2005 09:31 AM
Last Post: tigakub
  Normals? Quicksilver 3 2,847 Jan 13, 2003 05:31 PM
Last Post: henryj
  Which 3D model format is used on Mac? Mars_999 7 5,981 May 8, 2002 06:54 AM
Last Post: Nimrod