PDA

View Full Version : Please enlighten me about 3D modeling and OpenGL



Nrtesn Nyarlahotep
03-17-2008, 04:54 PM
Hi!

I've some questions about 3D modeling programs. I'm doing a project in C++ with OpenGL in computer graphics that will in the end be a first-person adventure game. It will contain animated models, portals, colision handling and some shader-effects if there is time.

I know next to nothing about 3D modeling and the first time I programmed with OpenGL was some month ago so I'm very new to all this. In one of the labs in the course I worked with and loaded .obj-files and displayed them in a C++ program. The process of drawing nice and big models seemed too tedious so I figured I would find a 3D model program that could export to .obj-files. I figured if I want to make for example a model of a person I would make the differnt parts in Desktop Maya, export them as .obj-files and perform all the animation work in C++ using OpenGL. I've got Desktop Maya and can export to .obj-files and all that I thought.

I would like to know some more about 3D modeling programs and OpenGL, like if someone have made any extensive project and what experiences that can be shared. For example if you want to make animated models in a 3D program and use them in C++? Is there a good way? I'm mainly thinking about minor face-animation. It won't be hard changing shape of the model in Desktop Maya but mimicing it in C++ will be. I should probably give up that thought if I don't want to do everything in Desktop Maya, right?

I realise I could probably make the entire game in Desktop Maya, but that won't be fun and in the end I'll be limited to that program. Maybe there are some other 3D model programs that I haven't heard of that works better?

I would really be thankful for any information I could get. It's very hard to google for something when you've no idea of the key words :)

RGHP
03-17-2008, 09:54 PM
*.Obj may be easy to load but consumes too much memory. 3ds is more lightwighted since is binary, not text based. There is a good library called lib3ds to loading this files. I'post before about how to use it.

http://www.opengl.org/discussion_boards/...true#Post232484 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Board=2&Number=232484&Searchpage=1&Main=46235&Words=lib3ds&topic=0&Search=true#Post232484)

This files can be created with Blender. http://www.blender.org
3ds also supports kineatics but, I'm not working with animation yet so I don't know how to load it, althoght is supported by lib3ds too.

The best approach you can take is to create your own file format. Also take care that obj or lib3ds are just 'quick' file formats. There is an standard named Collada that is an XMLfile format for assets(content) sharing between applications. The model works like this:

Maya ---->(maya files)
Blender--> (.blend files) -----> _______ ---> Maya
3dStudio-> (3dstudio files) -----> COLLADA ---> Your app
... ...
your app->( .myformat files)

Loading collada files is very complicated, COLLADA spec i very large, but powerfull! :D. You can use COLLADA DOM library(cross platform, hard lib) or FCollada(just for winbugs, very easy lib I've heard), both free!. Of course the best you can do is, again, export them to your own file format and then use your files in your application.

Your file don't have to be so complicated. For instance, just store the number of vertex and faces and next all the data, then load this in your app. This way you can laod them even from Java apps.

In a few hors I will post some example. Also I'll share some examples really basics with all thsi stuff

Bye!

Enjoy computer graphics! Make art!



http://www.raul-art.blogspot.com

Nrtesn Nyarlahotep
03-18-2008, 06:30 PM
Thanks, that was exacly the kind of reply I was hoping for :)

I've done some reading into .3ds-files and tried out Blender and it looks cool. I'm still interested in hearing more from anyone about your experiences with 3D modeling and programming. I'm sorry I can't be more precise than that, but I would just like to learn how your projects have been, what methods you've used and so on :)

HenriH
03-19-2008, 02:28 AM
I agree on Mr. RGHP's comment on making your own file format. In your custom format you can put whatever data you may need and preprocess them. This simplifies your application as the data is readily available in useful format; all you need is to read them in. I have done this on my apps and recommend it.

ZbuffeR
03-19-2008, 03:48 AM
I found the obj format quite fine for starting purposes :
+ simple to read and write
+ very common, almost all 3D packages can import and export it
+ it has texture coordinates
- no vertex color
- no advanced materials

Seth Hoffert
03-19-2008, 06:25 AM
It's trivial to extend the Maya OBJ plugin, as well - I've added in support for tangents, binormals, vertex colors, etc. :)

RGHP
03-22-2008, 08:29 AM
Hello!

Sorry for the long wait, I was enjoying this holidays :D. Well, this are some examples about a simple file to store a mesh, and also a file to store Images. There are many programs, including one that opens the mesh and images(a cubemap) and makes Environment Mapping. They all are Netbeans IDE projects so better download the IDE(it's cool). Here they are:

http://www.4shared.com/file/41558055/2343b1dd/Foro1.html
http://www.4shared.com/file/41558054/5444814b/Foro2.html

And this is where you can download Netbeans. Download the full version. Some of the projects are Java and others C++:

http://www.netbeans.org


This projects are tested only on Linux, but the Java ones should work in windows too. The C++ projects can work in Windows but you need to refactore the makefiles, they are generated to build with MinGW platform, but there are not versions of some libs for this compiler. Libraries that you will need to recompile are FreeImage, lib3ds and the CgToolkit.

Bye, enjoy!


http://www.raul-art.blogspot.com

RGHP
03-22-2008, 08:37 AM
You'll need SDL too!

Nrtesn Nyarlahotep
04-16-2008, 01:59 PM
I feel it is time I post about my own experiences now that my project have reached this critical point. I can now load, display and animate models with texture-coordinates, normals, vertices and specific material-settings using lib3ds. I saw no need to get the camera, light etc. though I'm sure it wouldn't be a big problem :)

First thing it's a waste of time getting lib3ds if you don't know what a 3ds-file looks like in detail as that library have very few comments and there are only two examples available, namly player.c and 3dsplay.c. However those two examples, 3dsplay.c being a newer version with comments (!) shows how to load just about everything in a 3ds-file. If you know about the structure of a 3ds-file and enough C they shouldn't be too hard to understand.

I can't compare this to making your own file-format as I haven't done the latter. Though I was stuck on the animation part for a while and when I could only load vertices, normals and texture-coordinates I was thikning like I should just have made my own format. Then I got animations to work and started to love the binary form with nodes and meshes :)

I've played around with Autodesk 3DS Max and I really enjoy the tutorial-movies that're included, but I guess Blender and any free alternative is just as good.

If I had more time, or would do this again I would probably read up on the Collada format. I came across some notes about it and it seems interesting. If there is anything to say there weren't alot of help for the lib3ds in form of tutorials. Then again I've no idea what the Collada-libraries can give in that area :)

The only tutorial I found for lib3ds was this, which was really good:

http://www.donkerdump.nl/NewsMessage.php?id=113

I use that way to store my static models in VBOs, it's just as good to work with the precise collision handling. Then I draw my animated objects with a player.c-like function and the colision handling won't have to be so precise, like in any game :)