Sign in to follow this  

3D models Loader

This topic is 2344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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: [url="http://tfc.duke.free.fr/coding/md5-specs-en.html"]MD5 Tutorial[/url] [url="http://www.modwiki.net/wiki/MD5_%28file_format%29"]MD5 Info[/url]

[url="http://www.katsbits.com/smforum/index.php?topic=178.0"]MD5 exporter for blender[/url]

Share this post


Link to post
Share on other sites
Your best bet is probably [url="http://assimp.sourceforge.net/"]Assimp[/url], it allows you to load popular formats like COLLADA, 3DS, OBJ, and a lot more. [url="http://www.gamedev.net/topic/569270-directx-10assimp-textures-coordinates-are-incorrect/"]Check this post[/url] 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.

Share this post


Link to post
Share on other sites
Assimp can be used with openGL, its fairly simple. Have you successfully rendered any programmatically generated 3d objects (cube?)?

Share this post


Link to post
Share on other sites
[quote name='zacaj' timestamp='1310517700' post='4834576']
Assimp can be used with openGL, its fairly simple. Have you successfully rendered any programmatically generated 3d objects (cube?)?
[/quote]

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:

[code]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;
}[/code]

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.

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

[b] [url="../../user/144973-zacaj/"]zacaj[/url][/b]

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?

Share this post


Link to post
Share on other sites
Theres a separate view that shows off what it can do, but it can load lots of formats, without any specific graphics library, for you to render manually
[url="http://assimp.sourceforge.net/main_features_formats.html"]http://assimp.sourceforge.net/main_features_formats.html[/url]

Share this post


Link to post
Share on other sites

This topic is 2344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this