Teen Programmers Unite  
 

 

Return to forum top

3D File API

Posted by DragonWolf [send private reply] at February 04, 2003, 05:31:22 AM

Curiously, what do 3d programmers use for loading in 3d Objects/Movies? I personally can't afford the licence fees for 3ds Max or Maya (I want to load these files since my mates use these, I'm happy to use any freeware exporters as well)

I've got my hands on the latest file specifications released by discreet and I've made a start on a library for loading/saving different 3d file formats.

Posted by CodeRed [send private reply] at February 04, 2003, 08:18:35 AM

Write your own and develope your own file format, I did it it's not that difficult

Posted by DragonWolf [send private reply] at February 04, 2003, 09:54:06 AM

I'm not gonna make a Maya/3ds max clone ^^

Like I have time for that.. lol

Posted by CodeRed [send private reply] at February 04, 2003, 01:30:12 PM

Does it really need to be that fancy?

Posted by CViper [send private reply] at February 04, 2003, 02:28:42 PM

I've got a '.3ds' fileloader; if you want it, I'll send it to you. It can only read .3ds files, havn't implemented writing yet. You can output stuff to some internal format though (and obviously read those files again).

Currently, there aren't any docs, but if you need help with it, just ask me. Also, keyframe animation isn't currently implemented (there is some other stuff that hasn't made it yet either)

[Edit: fixed some stuff]

Posted by Hardlaugh_ [send private reply] at February 05, 2003, 02:15:13 AM

DragonWolf!

With Direct3D, it's an easy and straight-forward task to load a mesh from an .X file. A program to convert .3DS to .X is supplied in the DirectX SDK.

Posted by DragonWolf [send private reply] at February 05, 2003, 03:45:44 AM

Hardlaugh, I thought there was ^^ Is there a similar program for .ma / .mb files to .x files?

CViper: Discreet recently published the .3ds file format specification (2.0-4.0) Which is what I've been working from.

Posted by gian [send private reply] at February 05, 2003, 04:14:22 AM

I created a very simple 3D file format for my programming class project this year. It does everything I need it to do and then some. It's not hard to come up with a very simple file format that obeys basic common sense.

Posted by DragonWolf [send private reply] at February 05, 2003, 05:17:02 AM

I realise it is easy to make a 3d file format.

But I want to be able to load files from multiple types of 3d editor..

Such as Maya, Bryce, 3ds max, g max, Lightwave, etc (For now just Maya, 3ds Max and G Max)

Once its in my program, I will use it for doing additional modelling and processes on it then I will turn it into my own format since it will be storing additional information such as BSP trees)

Posted by DragonWolf [send private reply] at February 05, 2003, 05:38:57 AM

Hmmm.. Actually there is a DirectX .X file plugin for all those editors.. Thanks Hardlaugh..

hehe.. Being stupid as always.

Posted by CViper [send private reply] at February 05, 2003, 11:06:18 AM

hehe, I used the descriptions on wotsit.org and some other pages. The only reason I didn't implement all the stuff, because that chunk-stuff they are using is a hell to implement. And right now I didn't really need it either.

Posted by DragonWolf [send private reply] at February 06, 2003, 05:29:43 AM

in C++ or Java the chunk method is good. Since you can load them pretty much directly into an Tree of Chunks.

Posted by CViper [send private reply] at February 06, 2003, 09:31:40 AM

Yeah, thought about doing that, but the problem is that my scene-graph represents meshes abit differently (especially after triangle-stripping etc). Whatever.

Posted by DragonWolf [send private reply] at February 06, 2003, 10:23:36 AM

I'd load it in as chunks. Then convert from the chunks (or take from the chunks) what I need.

Makes for code reuse ^^

Posted by CViper [send private reply] at February 06, 2003, 11:28:43 AM

I take what I need directly. No need to waste memory on the rest :D

Ok, my code wouldn't win a prize for nice design. It works though, and once I'm finished with the stuff (it's a project for school), I can worry about nice code. We've got no teacher that would bother looking att 15k+ lines of code anyway. And on top of that, noone knows about 3d-programming.

Posted by DragonWolf [send private reply] at February 07, 2003, 04:24:27 AM

Depends on what your loading.

In my case, it would be a series of small (ish) models. I would load one into memory, take what I need, then remove it from memory, then repeat for the next model. My first program is to load in all the models, do any processing on them, then memory dump them to a file.

My main program will then just read the file back into memory.

If your using a large model then extracting directly is probably the better choice ^^

Posted by CViper [send private reply] at February 07, 2003, 06:06:39 AM

I'm not really loading any "large" models either, afterall they are supposed to be drawn real-time.

Got an interal fileformat that works the same way - just read the stuff into memory. But it's nice to be able to play with different models during developement, and after designing a really nice resource-loading interface I saw no reason to disallow loading of .3ds files at runtime.

Got that nice ReadResource() function, with which you can read anything: images, 3d-models, .ini-files, sounds (not quite finished yet), ... [assuming you have the codec for it :D]

Posted by DragonWolf [send private reply] at February 07, 2003, 05:13:54 PM

nice

I've been wanting to make a Movie (DivX) player that will read in text files (JIS/ASCII/etc format) then use it to put subtitles across the bottom. So that you are gaurenteed READABLE subs.

Watching Crouching Tiger, Hidden Dragon with white blurred subs (with most scenes having a white background) makes it impossible.

Posted by CodeRed [send private reply] at February 08, 2003, 12:30:29 AM

And how would you solve the white text on white background problem? you could determine whether the area behind the text is more black or more white and change the text color to the opposite i guess, had you thought about that?

Posted by gian [send private reply] at February 08, 2003, 06:23:07 AM

Usually doing something like white text with a black outline or vice-versa does the trick.

Posted by CViper [send private reply] at February 08, 2003, 08:41:02 AM

Hehe, and they talk only chinese/japanese the whole movie - that's the only thing I remember from it ;)

Swedish TV actually uses a rectangular black background and white text on it. Sure, it takes some space, but it's really easy to read the text. But gians idea with the outline is still better :)

Posted by DragonWolf [send private reply] at February 10, 2003, 05:19:45 AM

CodeRed: I was gonna let the end-user choose the colour/style. Either a background, outlined text, plain text, etc..

I'd also allow an offset in the subtitles, since some recordings start earlier/later than others.

It also allows for several different language translations, while downloading only 1 version of the movie. Something similar could be done for dubbing, but I don't think it would work as well.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.