Advertisement

3d models (maya)

Started by May 31, 2005 11:41 AM
33 comments, last by iedoc 19 years, 8 months ago
but not every 3d package can export that format...
dude, thanks nefthy, but my only problem is i don't know how to export them so i can count the triangle stuff, and i don't really know how to load it up, but that will help, cause i get it alot better now. and if i experiment enough, i will get it. and, i know this is a newby question, but is there like a step by step or really in depth tutorial on how to export models from any modeling program and then load it up in c++ and opengl.

[Edited by - iedoc on June 10, 2005 8:44:58 PM]
Advertisement
this just SUCKS. i can't find anything good on exporting models from maya, then loading them in c++ and opengl. can anybody please help me?
In what formats can maya export?
You should never let your fears become the boundaries of your dreams.
I don't know how you kann export the in maya (haven't ever used maya), but any 3d package I have seen can do it. It should be somthing like File -> Export -> wavefront .obj

For testing your code you can find one here

As for loading it...

#include <stdio.h>char* line = NULL;unsigned int vertexc, normalc, texturec, facec; /* we use this to count the vertexes etc. */size_t len = 0; /* the size of line */size_t read = 0; /* how many chars read */File* f = fopen(filename);if (f == NULL) {  /* couldn't open the file */  return; /* probably want to report it to) */}/* firstpass */while ((read = getline(&line, &len, fp)) != -1) {  if (line[0] == 'v') {    if (line[1] == ' ') { /* line starts with v => vertex */      vertexc++;    } else if (line[1] == 't' { /* vt => texture */      texturec++;    } else if (line[1] == 'n' { /* vn => vertex normal */      normalc++;    }  } else if (line[0] == 'f' && line[1] == ' ') {    facec++;  }}rewind(f); /* go to start of file again *//* now you know how many vertexes, etc you have. Allocate your data structures that will hold your model and just do the same thing again this time yousing sscanf with an apropriate format string to read the data (i.e. "v %f %f %f" for a vertex). I leave this as an excercise *//* second pass ... */fclose(f); /* close the file */


You may want to also take a look here (don't let the linux in the header scare you, the function are the same):
sscanf
fopen
fclose

A complete .obj loading program can be found in the glut source code under demos smooth or something. But you should try writing your own.
Quote:
Original post by iedoc
this just SUCKS. i can't find anything good on exporting models from maya, then loading them in c++ and opengl. can anybody please help me?


yeah, my website is pretty much dedicated to explaining how to do it.

http://www.robthebloke.org

Check out the openGL pages for a few examples, and the Maya API->Maya exporter factfile for some more indepth info.

I'm not sure what 3D package FBX isn't available for, i know that maya, xsi, max, cinema4d, milkshape, houdini support it? It's prolly the best around at the moment for support (unlike the dotXSI where plugins exist for all the packages, but usually in some crippled state).

If you need anything more than what the obj files gives you, then it's definately the one to use....
Advertisement
Quote:
Original post by iedoc
dude, thanks nefthy, but my only problem is i don't know how to export them so i can count the triangle stuff, and i don't really know how to load it up, but that will help, cause i get it alot better now. and if i experiment enough, i will get it. and, i know this is a newby question, but is there like a step by step or really in depth tutorial on how to export models from any modeling program and then load it up in c++ and opengl.


make sure you have loaded the obj/fbx plugins for maya, window->settings/preferences->plugin manager

The rtg format is also available with maya, although it pretty much has the same amount of data as a 3DS file, (ie anims, materials etc), the format is not the nicest around.
thanks robthebloke, i downloaded some plugins, but couldn't figure out how to use them, that should help alot. and that is a nice site you got there. thanks a ton guys for replying.
FINALY if figured out how to export .obj files from maya, thanks so much, but now ill have to find a way to load them up in c++, i think i can get this to work now.

Sorry for bugging you guys, but i cant find a tutorial on how to load obj files in c++ opengl, not that yours is bad robthebloke, but i can't understand them very well when there in the c++ source code, but thanks anyways, i still like your site and i can still learn from your tutorials, but i cant learn very well how to load obj files without cut and paste, please help. i don't think it should be that complicated since its pretty much only points in the file, but i could be wrong. i hate sounding like a newb.

[Edited by - iedoc on June 11, 2005 6:31:22 PM]
nefthy, i just read your source code and got it very well, thanks a lot. but now i have the stupid problem of puting it on the screen, how do i do that?

i know this is going to sound like a dumb question, but ive been trying to load obj for a long time, ive experimented and searched for a long time, but, what is the easiest way of learning how to do this, i just can't find a good tutorial. is there a book that might be helpfull?

[Edited by - iedoc on June 11, 2005 10:29:12 PM]

This topic is closed to new replies.

Advertisement