.obj files? What are those? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: .obj files? What are those? (/thread-5453.html)
Pages: 1 2
.obj files? What are those? - trebek - Jun 6, 2005 09:30 AM
Could someone please explain to me what .obj files are? I'm very new to 3D programming, (as in, VERY), but I've used my degree in Google to find out the following, (I think ):
.obj files? What are those? - willThimbleby - Jun 6, 2005 09:57 AM
.obj files are a simple text based 3d file format. They tend to hold vectors, faces and objects. The format is popular because it is well supported as an export option on most 3d graphic programs, and it is extremely easy to understand.
Here is a quick overview of the format: http://www.royriggs.com/obj.html
To use in your own project, you need to use some loading/parsing code to open and render the files. Several people on this forum have written their own (like me). Here is a fairly good one: http://www.idevgames.com/forum/showthread.php?t=2470&highlight=obj+loader
.obj files? What are those? - trebek - Jun 6, 2005 11:10 AM
Hm... the download link is not working. "File not found", it says. I could easily find another, but if you could point me to a different one that would be nice.
*thinking* ... Aha!
Two more questions I came up with: Are there any freeware 3D modellers that export in .obj format? I know there are a few semi-expensive ones, but I'm not sure if there are any freeware programs.
And: How do you access the object once it's loaded into my OpenGL Xcode projects? What methods are used? I know how to move cubes and other objects I create through OpenGL, but is it the same with .obj files?
Thank you very much.
.obj files? What are those? - Fenris - Jun 6, 2005 11:15 AM
Well, no. If you know how to do cubes in OpenGL, you're probably familiar with glVertex3f. All the .obj files get you is the info on what values to pass to glVertex3f. OpenGL does not do any file handling at all for you.
.obj files? What are those? - aegidian - Jun 6, 2005 12:19 PM
trebek Wrote:Two more questions I came up with: Are there any freeware 3D modellers that export in .obj format? I know there are a few semi-expensive ones, but I'm not sure if there are any freeware programs.
Wings 3D is probably the free-est and best.
.obj files? What are those? - trebek - Jun 6, 2005 03:33 PM
I love it! I tried Blender once, but it didn't seem to be able to export much and I couldn't understand it at all. (Well, maybe a little but. ) Wings3D is awesome! I made this really cool model in this really short time. *recovering from shock...*
Um, anything else I need... *plays around with Wings3D for a while, then Xcode, then the page reccomended by willThimbleby, then realizes*...
Oh! Does anyone have the correct link for that Obj parser thingy? I looked at the explaination of the obj format and it confused me quite a bit. I know it's a little lazy, but I really don't want to try and write my own parser, as I'm having enough trouble writing simpler things.
Also, (aren't I great at coming up with questions? ), I heard that it is very difficult to animate obj models. Not that I know much about animating other things, but does anyone know what this is about and what it means?
Thank you all so much. (Mostly for putting up with me...)
.obj files? What are those? - Nick - Jun 6, 2005 08:29 PM
I would actually recommend you look at Karl Berg's .obj loader. It's what I used to base my early implementation on. I still have to fully look through his code. You can find it at http://www.sfu.ca/~kberg/Code/sourcecode.html. Hope that helps a bit.
.obj files? What are those? - Fenris - Jun 7, 2005 12:59 AM
Animating OBJ models... yes, that's impossible, actually. Here's the deal: when you have an OBJ model loaded, you can animate its movement, rotation, scaling, color, texturing and whatnot, just like you would a square or triangle. If you want to distort the actual model, you have to distort your actual vertices loaded. There is no program that can export an animation with .obj, since that's not in the spec. So, before you jump off the obj train, let me explain what you need to do:
If you just want moving static objects, glTranslatef and glRotatef them. If you want moving machinery (cars, robots, non-soft stuff) make several obj models and combine them like legoes. Finally, if you want skeletal animation and stuff, you need to figure it out yourself. But, once you're adept enough to do combined OBJ model animation, that shouldn't be too hard. (Oh, and welcome to the boards, by the way)
.obj files? What are those? - TomorrowPlusX - Jun 7, 2005 04:25 AM
I use ODE for rigid body dynamics, using the matrices ODE returns to position my OBJ models. Now, that said, that's great for vehicles but if you want squishy, more natural models, you'll have to look somewhere else.
There's an open source skeletal animation system, called Animadead ( http://animadead.sourceforge.net/ ) -- this would be a good counter to OBJ models + rigid body dynamics.
.obj files? What are those? - johnb003 - Jun 30, 2005 10:24 AM
I know this is a bit late to reply, had a few problems with activating my account.
Anyway, I just wanted add my comment on obj and Animadead. First of all, you might be getting started on the wrong foot; It may be better to start with a modeling program unless you already have a collection of models in a certain format. But looking at the format you want to use can sometimes be unnecessary. Like others have mentioned obj files don't help much for animation, and as TomorrowPlusX mentioned you might want to use a library like Animadead to do animation.
Animadead has it's own format you don't even need to know how it works. Animadead exports models from the modeling package to it's own format, and then you just use the library in your application, tell it what files you want it to load and start playing with the animations.
Here's a little inside info on Animadead too... It's at a good stable version now, but there is a LOT of work going into it right now. There should be a new release very soon and even 3.0 possibly by the end of the summer.
.obj files? What are those? - Duane - Jun 30, 2005 11:12 AM
.obj files are alot harder to parse then any other model format. I'd go with the .mod files, myself.
.obj files? What are those? - TomorrowPlusX - Jun 30, 2005 11:35 AM
Nayr Wrote:.obj files are alot harder to parse then any other model format. I'd go with the .mod files, myself.
While I don't support the fancy stuff like curves and whatnot, my OBJ loader, which does support triangles & quads, and texture coordinates, was written in about 3 hours, with less than 500 lines of code -- & 1.5 of those three hours was spent testing my parser. OBJ parsing is easy.
.obj files? What are those? - Duane - Jun 30, 2005 12:02 PM
oh. I thought he was making a full .obj loader.
.obj files? What are those? - Nick - Jun 30, 2005 12:10 PM
Nayr Wrote:oh. I thought he was making a full .obj loader.What do you mean a full one? All a .obj file is is normals, texture coordinates, vertices, and faces. If he can load tris and quads and texture the models, what else is left?
.obj files? What are those? - LongJumper - Jun 30, 2005 12:52 PM
.obj files are the EASIEST to parse, they're just text telling you what to do. Try .3ds or something, dealing with all those chunks...