Jump to content

  • Log In with Google      Sign In   
  • Create Account

DirectX 11 Custom Model Format


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 RyxiaN   Members   -  Reputation: 137

Like
0Likes
Like

Posted 02 November 2011 - 01:59 PM

The time has come where I need to import models to my game (or application). Since I'm using DirectX 11 there is no built in support for that and the .X file format is old and stuff, I want to create my own model format. I don't think loading my own custom format would be very hard, but I can't find any help on how to export my models to my custom format. I'm using 3ds Max 2010, and I know you can either create a MAXscript or create a plugin with C++, but C++ isn't my main language. C# is. So that would be pretty hard. Does anybody know any good tutorials or guides on how to create your own plugin for 3ds Max? Havn't found anything myself.

Another solution, that would be much better for me, would be creating a program that reads the native 3ds Max format (.max) and then export it. I could use C# for that. But then the question remains: How do I read the native format? Is there any documentation on how the file format is laid out? Any guides?

Thanks in advance!

Sponsor:

#2 iedoc   Members   -  Reputation: 1057

Like
1Likes
Like

Posted 02 November 2011 - 11:48 PM

my suggestion for you, would first be to find out how to load a publicly available format, such as obj or md5 (which are both in ascii format so the can be read by humans).

Otherwise, i wrote a small exporting script in 3ds a few months ago, but i had such a hard time using maxscript since there is almost nothing on the web that teaches someone how to use it (i could only find a couple example scripts). I would avoid creating a script, since that would most likely mean learning a whole new language, just so you can export to your format. The best idea would be to make a converter in the language that you DO know. you can export from 3ds into a format that has everything you need, like the obj format, collada (which has everything a 3d modeler could possibly export) or fbx, then write the converter in the language you know (C# is it?) where it loads in the model from 3ds max, reads it, and spits it out into the format you want.

don't read .max format, just read something like collada or obj, depending on what you need. I wrote a little lesson for loading obj files in direct3d 11, and i'm currently doing one on md5, which supports animation, while obj does not. but after you know how to load a format like obj or md5, you could write your own converter to convert them or another format to the format you want.
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#3 Hodgman   Moderators   -  Reputation: 31799

Like
4Likes
Like

Posted 03 November 2011 - 12:05 AM

My preferred approach is to create your custom format from an intermediate format, such as Collada, via a conversion tool.

e.g. "*.max" -> open in 3DS max -> export to Collada -> "*.dae" -> run conversion tool -> "*.yourEngineModel"

This way you get the benefits of a custom file format, but also don't have to write plugins for art tools. You can use a library like Assimp to help with the conversion tool.

#4 RyxiaN   Members   -  Reputation: 137

Like
0Likes
Like

Posted 03 November 2011 - 10:26 AM

Thanks both of you! I'll try to load the OBJ format first and then export it by myself to my custom format. But I will need animations later, so I guess I'll have to move on to MD5 or something later. But iedoc, is your guide for OBJ avaialble anywhere online? Also, any "parts" of the MD5 one available anywhere?

Another question: If I decide to go with the MD5 format, how do I export models from 3ds Max to MD5? 3ds Max doesn't seam to be able to export to MD5.

Thanks in advance!

#5 iceisfun   Members   -  Reputation: 141

Like
0Likes
Like

Posted 03 November 2011 - 11:39 AM

My preferred approach is to create your custom format from an intermediate format, such as Collada, via a conversion tool.

e.g. "*.max" -> open in 3DS max -> export to Collada -> "*.dae" -> run conversion tool -> "*.yourEngineModel"

This way you get the benefits of a custom file format, but also don't have to write plugins for art tools. You can use a library like Assimp to help with the conversion tool.


This is what our engine does, Export DAE/FBX -> Model compiler -> "*.ourmesh and *.ouranim"

And then we can animate meshes with any of our animation tracks that have the correct structure.

#6 Hodgman   Moderators   -  Reputation: 31799

Like
0Likes
Like

Posted 03 November 2011 - 04:06 PM

Another question: If I decide to go with the MD5 format, how do I export models from 3ds Max to MD5? 3ds Max doesn't seam to be able to export to MD5.

You'd have to find or write an MD5 exporter. N.B. MD5 is an engine specific format for the Doom3 engine (and IIRC Doom3's art was mostly made in Maya), so I wouldn't expect to find any official support for it anywhere.

#7 iedoc   Members   -  Reputation: 1057

Like
0Likes
Like

Posted 03 November 2011 - 09:55 PM

I'm not saying the obj loading lesson i made is the best way to do it, or the best lesson on the net. I was just saying i did happen to write one, which is here:
http://braynzarsoft.mezoka.com/index.php?p=D3D11OBJMODEL

also, the file i used to export to md5 from 3ds max is here:
http://www.katsbits.com/tools/

about the md5 loading lesson, i still haven't finished it. I'll put it into two parts though, first one to just load the model, the second one to do the animations. When i do happen to finish it though (hopefully in the next week, it will be here:
http://braynzarsoft.mezoka.com/index.php?p=DX11Lessons
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#8 RyxiaN   Members   -  Reputation: 137

Like
0Likes
Like

Posted 04 November 2011 - 02:23 AM

Allright, thanks a bunch guys! I'll take look at your obj loader and I will probably be able to load the md5 format myself once I studied the format a bit. Thanks for the exporter too! (:




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS