3D models Loader

Started by
9 comments, last by zacaj 12 years, 9 months ago
Hi everybody im getting on the video game programming stuff and Im making a, IDK if to call it this way but is a Game Engine.

And i have some basic stuff like collision detection and 2D textures loaders, But i would like to be able to load a 3D model created on blender also I would like to be able to animate some escenes or player movements

But the problem is IDK how cause its not the same as rendering a image file is something diferent.

I have seen some formats and looked about them and seems like COLLADA would be a good one even thouhg I would like some explanation on how to import this model to my programm

THX... please be kind
Advertisement
I recently wanted to use animated 3d models in my game and I decided to go with the MD5 (doom3) model format. One of the reasons I decided to use this format is because it was designed for games (unlike collada or 3ds). There are a few good resources for loading this format: MD5 Tutorial MD5 Info

MD5 exporter for blender
Your best bet is probably Assimp, it allows you to load popular formats like COLLADA, 3DS, OBJ, and a lot more. Check this post for a implementation of Assimp and DirectX 10 (you have to add the flag aiProcess_FlipUVs to the readFile() function for it to work properly with DirectX)

If you want to load FBX objects google FBX SD.

When you are more familiar with formats and importers, you should create your own format and a converter to convert other formats to you format, because some popular formats carry lots of information that you probably dont need which makes the import slower.
Thank you Guys and Tiago Costa that sounds good but im using OpenGL.
Assimp can be used with openGL, its fairly simple. Have you successfully rendered any programmatically generated 3d objects (cube?)?

Assimp can be used with openGL, its fairly simple. Have you successfully rendered any programmatically generated 3d objects (cube?)?


I mean it can be drawn but I would like to be able to do it also by importing a blender model to my program, lets say some day ill create a soldier, I would be a hell to draw him with Vertex functions.

No I havent been able to do so even though I would like to have the freedom to distribute the game, thats why I avoided pre maked loaders.

Im new on this section but I would like to Understand this or make a Loader Cause this is the function for the 2D textures:

using namespace std;

GLuint loadTexture( const string &fileName )
{
SDL_Surface *image = IMG_Load( fileName.c_str() );

SDL_DisplayFormatAlpha(image);

unsigned object(0);

glGenTextures(1, &object);

glBindTexture(GL_TEXTURE_2D, object);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image -> w, image -> h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image -> pixels);

//Free surface
SDL_FreeSurface(image);

return object;
}


I know I have to Draw an object and the Wrap it with the texture, but for the 3D models stuff im kind off lost.
Seems that its easier to do this on obj format I would give it a spin to see what i could learn
OBJ is actually fairly annoying to load. Assimp is BSD licenced, so you can use it in anything basically. I asked about the cube because youre gonna have problems loading a model and rendering it if you dont know how to render basic things when loading isnt a concern. I wasnt suggesting you type in a soldier point by point ;)
hehe. I think Im going to fast,

With md5 the problem was that i think, but Im not sure U need to create an armature, bones etc, I think its too advanced.

One of the Formats I was testing and was failly simple was the smd.

hmm i could try to render a 3D texture then huh?

zacaj

I thought Assimp was just a viewer of Collada files. does it provide libraries that allow you to use it to load DEA into your own program?
J-GREEN

Greenpanoply

This topic is closed to new replies.

Advertisement