Thread: 3d model file format for use in OGL: should faces share vertices or not?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    125

    3d model file format for use in OGL: should faces share vertices or not?

    So I'm dabbling in game design for a bit, and am trying to get some 3d models onto the screen without using any deprecated OpenGL features. Obviously that means no fixed functionality, so no glTexCoord or glVertex; everything's in vertex buffer objects now.
    This however causes a new problem; as far as I can tell when rendering from a VBO you only pass a single index buffer object that refers to one VBO or a single set of equally sized (same amount of indices) VBOs.
    Now, with fixed functionality I could have a set of 3d vertices, a set of texture vertices and a set of triangles that each consisted of 3 indices to 3d vertices and 3 indices for texture vertices (for each UV layer). This way, you generally end up with less 3d and texture vertices than faces.
    With VBOs however since apparently you can pass only one index for each vertex, each vertex that has different texture coordinates (on any layer) now has to be a unique vertex. If you have more than one UV layer, that's going to be practically every vertex. So, I guess I could just make 3 whole new vertices for each triangle. (i.e. the index buffer object would look like [0,1,2,3,4,5,6,7,8,9,10...], just passing each vertex in order)
    This seems like a waste of memory space though; for a regular sized model (say, 10000 triangles) that would mean 30000 vertices; at 12 floating point numbers per vertex that would mean a single model would take up over 1MB of video memory!
    So my question is basically, is there any alternative to just making a whole new vertex for every point on a triangle that has one property (be it any texture coordinate or even normal direction) different from all other vertices? (at which point each triangle might as well have their own vertices since there will be very few shared vertices anyway, especially when working with disjointed lightmaps) Maybe some way to pass more than one index when rendering from VBOs?
    Or, a bit more generally, what is a good format to store a model in video memory?
    Thanks!
    Last edited by Boksha; 07-11-2011 at 04:16 PM.
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Format for exporting a 3ds Max model to use with DX
    By alanb in forum Game Programming
    Replies: 2
    Last Post: 09-15-2009, 01:03 PM
  2. 3d Model file format
    By glo in forum Game Programming
    Replies: 4
    Last Post: 09-15-2008, 04:33 PM
  3. MD2 Model Format Issues
    By Thunderco in forum Game Programming
    Replies: 6
    Last Post: 04-17-2004, 06:37 PM
  4. model format and editor
    By Hershlag in forum Game Programming
    Replies: 3
    Last Post: 07-30-2002, 08:26 AM
  5. winding vertices
    By confuted in forum Game Programming
    Replies: 0
    Last Post: 07-21-2002, 09:54 PM