Archived

This topic is now archived and is closed to further replies.

3DStudio MAX exporter

This topic is 5098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If you mean a .max/.gmax exporter, then you are in bad luck, those formats are propietary on the whole meaning of the word, there are no specs available, 3ds Max seems to be the only app capable of using them, on top of that, jugding by the way Max handles things (using a transformation stack, which you would have to hack), I doubt it is an easy, even posible task, otherwhise, there would be lots of exporter/importers available.

If you mean .3ds files, there is a tutorial on loading those in www.gametutorials.com, look under OpenGL tutorials, or do a search for the .3ds file spec. on google.

Aeon Games

Share this post


Link to post
Share on other sites

I''m curently trying to do exactly the same thing, try these sites:-

www.cyberloonies.com

sparks.discreet.com

There is a max sdk which has a plugin wizard for creating exporters in Vissual C++

Good luck if you find out a good way/path to do this could you email me. Because I am a novice and haveing loads of problems doing this.

Share this post


Link to post
Share on other sites
The best place to start are the 3ds max SDK docs, plus it helps if you can play with max a lot to get a feel how it handles various components. If you have specific questions on some of the subtleties (after checking the docs & the above websites) you can probably get good answers here.

Share this post


Link to post
Share on other sites
not hard. i'm writing one together with my engine and i use it to export objects into my own format. just use the wizard and add the export code. the main difficulty is that max sdk documentation is really messy and its hard to find what you really need.

sorry i wrote a really wrong reply with lots of useful info, but then i pressed backspace and everything was gone if you need info on something just ask

[edited by - Arcibald Wearlot on November 10, 2003 12:30:01 PM]

Share this post


Link to post
Share on other sites
Of interest might be the new IGame interfaces which promise to take away all the ugly code of MAX SDK. The IGame interface has been created for the sole purpose of data export. I am currently looking at a few possibilities.

1) Use the IGame interface.
2) Use the Max SDK plugin wizard.
3) Use Microsofts .x exporter to do the exporting and then make a converter to convert/extract the info i need.

Of the options, 3 seems to be the easiest since .x is just a text file and Microsoft has done all the work of writing a plugin for you(You can be sure it will be updated supporting newer features of MAX). But i cant seem to get the .X plugin to compile currently.

Share this post


Link to post
Share on other sites
the new IGameInterface is nothing else than wrapped some of the most game relevant stuff together,in one interface... this doesn''t make it easier.



DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
I''d recommend doing your exporter in Maxscript instead of using the SDK. The documentation for Max''s SDK is pretty painful.

Having said that, if you''re hell-bent on doing an exporter with the SDK you should check out the TechDocs section at http://sparks.discreet.com They have a tutorial on doing a basic exporter plugin.

-John

Share this post


Link to post
Share on other sites

I''m also a newbie who is trying to do this for my University final year project. I think that the MAX SDK is best for me and what I want to achevie.

.............Arcibald Wearlot..................

What you have done is exactly what I want to do. I have tryed useing the MAX SDK wizzard but I get a build error something like "can not find build.obj". Do you know where in Vissual studio I have gone wrong? And do you have any other advice for geting through the MAX SDK documentation?

Share this post


Link to post
Share on other sites
quote:
Original post by caios
I''m also a newbie who is trying to do this for my University final year project. I think that the MAX SDK is best for me and what I want to achevie.

.............Arcibald Wearlot..................

What you have done is exactly what I want to do. I have tryed useing the MAX SDK wizzard but I get a build error something like "can not find build.obj". Do you know where in Vissual studio I have gone wrong? And do you have any other advice for geting through the MAX SDK documentation?



I''m just curious, but why is it that you think the SDK is the best for what you want to achieve?

I certainly don''t mean to downplay the SDK...you can certainly do some cool things with it. However, for an exporter, you can do pretty much anything you need to do with Maxscript and it''ll be a whole lot easier. On top of that, if you do find that there''s something missing in Maxscript for your exporter you can write a plugin, using the SDK, to provide new functions and classes to Maxscipt.

FWIW, I''ve written exporters for Max for commercial game development both with Maxscript and with the Max SDK and honestly, I think Maxscript is the way to go. If you were doing a Material plugin, then I''d urge you to go the other way and use the SDK. But for an exporter, Maxscript is perfect.

Just tryin'' to save you some time and hassle

-John

Share this post


Link to post
Share on other sites

Cheers John, its great to here from somebody who has made one for commercial use. The thing is that I worked at a developer last year as a member of the art team, texture artist, 3D artist. This being my final year at Uni I fancied a challenge! So because of using a model viewer while on placement last year to test how things I was producing would look in game. I thought I would try and produce my own. I know that while at work the viewer that I was using was essentially an extension of the game graphics engine.

It will work like this:-

1). Export model from 3D studio max, file extension, format of my choice which will support texture mapping but animation not essential.

2). This model could then be opened in a model viewer also wrote by me. Then this model viewer should eventually have MIP mapping, alpha blending, etc.

So that’s the aim!!! Lots for a relative novice programmer, eh?!!!!!

Firstly my uni tutor would like me to use as little pre written functions. So Direct X is out. I also wanted it to be as platform independent as possible. So the model viewer will be written in opengl.
As for the max exporter I suppose I want to take the route that isn''t necessarily the easiest. But the one that is usually used in industry and the one that would be most beneficial to my learning.

The overall aim of this is to be a stepping stone to move from 3d artist to game programmer. But if not it will mean I will know a lot more about the problems that the programmers can encounter with 3d art work that I produce. I certainly didn''t understand a lot of what the programmers and experienced artists where discussing while fixing graphical bugs on the game towards the end of the dev cycle.

This is a very long post but now you all know the exact aim of what I am trying to do you may find it easier to advice me. Thanks, all impute is much appreciated!!

Caios (geting there!)




Share this post


Link to post
Share on other sites
Hi Caios,

That sounds great man! It''s definitely good to know more about both the art and programming side no matter which side you choose to go to in the end

With what you''ve told me, I''d encourage you even more to go the Maxscript route. Learning Maxscript can help you do a lot of things with the program that would be difficult otherwise. After you''ve learned a bit of it, you can whip up little tools to automate all kinds of tasks with very little effort. Doing the same things with the SDK usually takes quite a bit more effort.

As far as how things in the industry work, the people with experience have learned that there''s always more to do than you have time for. So, you always have to choose your battles. In your specific case, I''d recommend using Maxscript for the exporter, which should save you some time, and then spend that extra time on your viewer. That''s what the pros would do

The basic rule of thumb I use with writing tools for Max is this. If it it''s a tool that can be done in Maxscript, then I use that. If it''s a tool that has special needs(eg. Speed concerns, or access to things Maxscript can''t do) then I write a plugin with the SDK to expose new commands to Maxscript which perform the tricky bits for me, and then use Maxscript along with my new Maxscript commands to do it. If it''s core component(New Material type, New Node type, etc) then I do it all on the SDK side. This is because these tend to be much more demanding of performance, and this is one area where Maxscripts abilities start to really fall short.

So, just to recap, I applaud your enthusiasm to learn and to not necessarily take the easy way out. However, I recommend you channel that energy into the areas that are worth the extra effort. Your viewer could be a lot cooler with extra effort. Writing an exporter with the SDK instead of Maxscript just means that your extra effort will allow you to get the exact same data out of Max half a second faster

-John

Share this post


Link to post
Share on other sites
quote:
Original post by Teknofreek
Hi Caios,

That sounds great man! It''s definitely good to know more about both the art and programming side no matter which side you choose to go to in the end

With what you''ve told me, I''d encourage you even more to go the Maxscript route. Learning Maxscript can help you do a lot of things with the program that would be difficult otherwise. After you''ve learned a bit of it, you can whip up little tools to automate all kinds of tasks with very little effort. Doing the same things with the SDK usually takes quite a bit more effort.

As far as how things in the industry work, the people with experience have learned that there''s always more to do than you have time for. So, you always have to choose your battles. In your specific case, I''d recommend using Maxscript for the exporter, which should save you some time, and then spend that extra time on your viewer. That''s what the pros would do

The basic rule of thumb I use with writing tools for Max is this. If it it''s a tool that can be done in Maxscript, then I use that. If it''s a tool that has special needs(eg. Speed concerns, or access to things Maxscript can''t do) then I write a plugin with the SDK to expose new commands to Maxscript which perform the tricky bits for me, and then use Maxscript along with my new Maxscript commands to do it. If it''s core component(New Material type, New Node type, etc) then I do it all on the SDK side. This is because these tend to be much more demanding of performance, and this is one area where Maxscripts abilities start to really fall short.

So, just to recap, I applaud your enthusiasm to learn and to not necessarily take the easy way out. However, I recommend you channel that energy into the areas that are worth the extra effort. Your viewer could be a lot cooler with extra effort. Writing an exporter with the SDK instead of Maxscript just means that your extra effort will allow you to get the exact same data out of Max half a second faster

-John




Hey John,

Since you have experience with MaxScript, could you tell me if it is possible to export these properties to a text file using MaxScript. I have looked through some MaxSDK exporter source codes and they are definitely going to take quite some time to understand. So i would rather save some time instead of learning the large and ugly interface of MAXSDK.
Mesh(Duh), Lights and it''s properties,Texture Coordinates, Indexed vertices, Normals(If possible),Material Properties(Alpha, Specularity), Bones, Bone Weights,(Translation,Rotation and Scale values for bone objects at keyframes) while using skin/physique modifier.

Share this post


Link to post
Share on other sites

Cheers for the advice John. What you say defenitly makes a lot of sence. I may even quote you in my project note book! LOL.

If you where makeing a model exporter that produced a new model format for your model viewer only. What file type would it be close to/based on .3ds, .ase, text file?

I reckon that this thread may go on untill I finish this part of the project in a few mounths.


Share this post


Link to post
Share on other sites
You should base it on a few things

1) What you need and only what you need
2) Make sure it contains as much preprocessed data as possible which might be useful in your app.
3) Organise it in a way you feel you can understand and import easily into your app.

There is no point in basing it on an existing format if you want to make your own format. If you felt that an existing format suited your needs, you shouldnt be even reinventing the wheel.

Text files are very easy to debug and understand. They are also modifiable with text editors. It is unlikely someone will go through the trouble to write a loader for your format to steal the model.

Binary files are usually smaller and should load faster. However the loading difference is a matter of milliseconds with today's PCs and might not be worth the additional headache they bring to you when debugging. Many new games like Unreal/DOOM3 will use text files if im not mistaken.

[edited by - GamerSg on November 12, 2003 8:03:31 AM]

Share this post


Link to post
Share on other sites

Thats great. Sounds like the way I should be thinking about it! But I carnt right a program that loads other file formats yet. Let alone design my own format. So I think that I''m starting to get ahead of myself a bit now!!!

My first step should be to program a model viewer that can open an excisting model format to give me a better under standing of how this works? Then start on the MaxScript exporter?

Here we go then. I think I may know anough to get started on this now. Brilliant!!



Share this post


Link to post
Share on other sites
If you are using text files, i suggest using fstream.

#include <fstream>
using namespace std;

int a;
int b;
ifstream fin;//ifstream for input ofstream for output
fin.open("text.txt")
fin>>a;//reads in value into a
fin>>b;//reads in value into b
fin.close();


if your file was formatted like this,
10 20

a =10
b =20




Share this post


Link to post
Share on other sites
quote:
Original post by GamerSg
Hey John,

Since you have experience with MaxScript, could you tell me if it is possible to export these properties to a text file using MaxScript. I have looked through some MaxSDK exporter source codes and they are definitely going to take quite some time to understand. So i would rather save some time instead of learning the large and ugly interface of MAXSDK. Mesh(Duh), Lights and it''s properties,Texture Coordinates, Indexed vertices, Normals(If possible),Material Properties(Alpha, Specularity), Bones, Bone Weights,(Translation,Rotation and Scale values for bone objects at keyframes) while using skin/physique modifier.



Sure, you can do all of that with Maxscript! Just check out the Maxscript help file. The search tab in there will be your new best friend

Just to get you going, here''s a ridiculously simple example of how to export some scene information to a file:


XPortFile = createFile "C:\\Test.txt"

for obj in objects do
(
format "Object: %\n" obj.name to:XPortFile

if ( classof obj == Editable_Mesh ) then
(
format "NumVerts: %\n" obj.verts.count to:XPortFile

if ( obj.material != undefined ) then
(
format "Material_Specular: %\n" obj.material.specular to:XPortFile
)
)
else if ( classof obj == OmniLight ) then
(
format "OmniLight: %\n" obj.name to:XPortFile
format "Position: %\n" obj.position to:XPortFile
)

format "\n" to:XPortFile
)

close XPortFile



Also, one thing to be aware of when working with Max is the way that it handles it''s geometry. It''s a bit different from the way most real-time 3D engines do. In particular, most 3D engines define a vertex format and make everything up from that. In contrast, Max tends to access most geometry information by faces(triangles).

For example, in Max a vertex doesn''t have an associated texture coordinate. Instead, each face of the mesh has 3 vertex indexes, which only store position. Each mesh will also have somewhere between 0 to 99 corresponding "mapfaces". Each mapface will have 3 "mapvert" indices. And in turn, the mapvert contains the actual texture coordinate.

All of this isn''t a really big deal once you come to grips with it. However, it does mean that there''ll be a bit more legwork on your part to get vertex information that''s ready for something like D3D.

Good luck!

-John

Share this post


Link to post
Share on other sites
quote:
Original post by caios
Cheers for the advice John. What you say defenitly makes a lot of sence. I may even quote you in my project note book! LOL.

If you where makeing a model exporter that produced a new model format for your model viewer only. What file type would it be close to/based on .3ds, .ase, text file?

I reckon that this thread may go on untill I finish this part of the project in a few mounths.



Hehe, that''s cool. Feel free to quote away!

As for the file format, GamerSg has the right idea. All you have to do is figure out what information you need. Then, figure out the best way to organize it for loading. Then just output the data that way.

I''d also agree that text files are the best way to go, especially when you''re just getting started. It makes it much, much easier to debug. If you were creating a shipping game then you MIGHT want to change it to a binary format before shipping, but for most of the development process you tend to work with text files of some sort because of the value of being easy to debug.

-John

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Flexporter. Need I say more?

(go google)


I''ll probably get flamed for saying this. Oh well.

I''ve used flexporter in the past for hobby projects, and while it worked for most problems, it was incredibly difficult to extend beyond what the original author intended. When I had to write a max exporter for a commercial project here at work I started with flexporter for the prototype phase but within a week of the artist working with it we turned up all kinds of things that were either not supported or didn''t work. Following the mailing list recently the programmer himself has identified that he doesn''t have the time to maintain the project anymore. If you are working on a large scale project that requires max exporting, and possibly custom material plugins or anything fancy invest the time in writing your own exporter. It''s not as difficult as you might think. There is a great tutorial on the sparks website called ''How to write an exporter'' with sample code. It''s a great place to start. And with the addition of the IGameExport interface that discreet has put together things may seem easier (although I havn''t looked at it).

The sparks SDK forum is free to join and has a large archive so there really is a lot of information available to everyone trying to go through this process. (except skeletal animation with the Skin Modifier which I can''t seem to get rid of one strange problem in, so if anyone has done this with ISkin and Max5.1 let me know).

Best of luck; sounds like a good project.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes, Flexporter IS the way to go. You can write your own plugin for Flexporter (the author says plugins of plugin).

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Yes, Flexporter IS the way to go. You can write your own plugin for Flexporter (the author says plugins of plugin).


Flexporter may be a good starting point, but I maintain that it becomes limiting very quickly. The skin exporter for use with the ISkin interface doesn''t work properly and from the mailing list it seems like there is no plan to fix it. With Max 6.0 being released and wide spread usage starting to ramp up I have yet to hear of any planned support. Also, Character Studio 4.1 has been out for a long time and there is no support for the new bones in the 4.1 biped, which causes flexporter to crash, not fail gracefully.

Share this post


Link to post
Share on other sites
I haven''t had too much time to try out this, but it seems to me that MAXScript is the easiest solution for writing an exporter. I haven''t had time to try myself, but I wonder if anyone have tried to export IK solvers from 3ds Max with maxscript?


-Zenthar

Share this post


Link to post
Share on other sites
Zenthar,

What exactly do you mean by exporting IK solvers? You could export the IK End Effector objects with no problem. And I''m pretty sure you could export their properties too. But I''m not sure what that do for you. You''d have to make sure you''re calculating the IK solution the same way Max is.

However, I believe the IK solvers are plugins now. So, if you want to do IK in your game, you could write your own IK solver plugin. This would allow the artist to work with it in Max the same way it''d work in your game. At that point, yes, you could export the IK nodes, along with their properties and re-create it exactly in your game.

All of the games I''ve worked on though just bake the animtion of the objects being exported. In other words, it doesn''t matter how complex the animation setup is in Max(eg. Multiple constraints, IK, procedural animation, blended layers of animation, etc). Instead, the exporter just samples the transform of the objects every nth frame to create new keyframes of it''s own. This has the up-side of letting the animators do whatever they want and keeping the output simple and generic.

Hmmm...not sure if that answered your question or not

-John

Share this post


Link to post
Share on other sites