PDA

View Full Version : Optimum 3D modelling graphics format (Questions)



NeighborhoodCroak
03-01-2012, 07:36 PM
I'm looking to developing an application with OpenGL (yet I have no experience).
From my understanding OpenGL cannot directly read and open files such as .3ds, .x, .obj but with the programming language (C++ in my case) you pass the required data (vertices) to the API for it to render the model.
Should I use .x [to my knowledge it holds u,v data, vertex data, and holds animation data(maybe?) ]format? (I do modelling with Blender).
From reading the openGL specifications (3.3) I notice there is a lack of "animation functions". My assumption is that to render animation the CPU (or GPU with OpenCL) updates the primitives animation frame (resulting in new vertex data) and is sent to the GL to render the new scene.
I am using Linux Ubuntu 11.10

Alfonse Reinheart
03-01-2012, 10:25 PM
OpenGL is a rendering library, just like Direct3D (any "animation functions" are part of D3DX, which is a separate, layered library on top of D3D). You give it meshes, it renders meshes. How you animate them is up to you.

NeighborhoodCroak
03-02-2012, 07:14 AM
So what graphics format I use does not matter as long as I am able to feed the GL vertices to render?

ravage
03-02-2012, 11:06 AM
Yes, it does not matter which one you use. Some support the mesh + animation data (.3ds .dae[collada], .x, etc) while some just have mesh data (.obj, .ply, etc). You could go as far as to make your own mesh format if you want.

Use the assimp library (http://assimp.sourceforge.net). It helps with loading the data from file and supports many formats. It works great.

Dark Photon
03-03-2012, 07:23 PM
Yes, it does not matter which one you use. Some support the mesh + animation data (.3ds .dae[collada], .x, etc) while some just have mesh data (.obj, .ply, etc). You could go as far as to make your own mesh format if you want.

Use the assimp library (http://assimp.sourceforge.net). It helps with loading the data from file and supports many formats. It works great.

Another aspect to think about. Some formats don't support storing pre-optimized indexed triangles, which is probably the most efficient rendering format for general meshes. If you don't want to have to "reoptimize" your meshes on load every time, that's a factor to consider.

Also, some formats may not be general enough to support storing all the per-vertex attributes you might need, with the types you want. So you'll want to look into that to ensure that they do.

You also may want to store multiple LODs of each mesh with metadata about how to switch between them, or metadata about material states, textures, or shaders to use when rendering with them. You can manage that as a layer above the raw mesh file, or you can encapsulate some/all of that in more of a scene graph/list file.

Just depends on what you need. Custom format gives you all the flexibility you want, but you end up writing your own export/import tool. So initially would look into the formats that assimp (or similar lib, like lib3ds/etc.) supports. Otherwise you end up writing your export/import tool to a standard format anyway, and the standard format loses some of its appeal.