#100281 - ikaris - Sun Aug 27, 2006 5:04 am
As promised, I am offering to the GBADev community my Display List Exporter for Maya !
This tool uses the popular 3D software Maya to extract 3D data for use on the DS !
http://www.autodesk.com/maya
It is written in MEL Script, Maya's scripting language.
Here is a screenshot:
[Images not permitted - Click here to view it]
This tool generates a display list in a .h file, already in a u32 variable, ready to be rendered with glCallList() !
It's good for beginners who just want to get some 3D objects onto the DS and start experimenting.
What it does:
- Exports geometry, texture coordinates and vertex color
- Easily scale the object (plus, blocks the export if the object is larger than -8 to +8)
- Allows the manipulation of various settings for the UVs
- Automatically saves everything into a handy u32 variable in a .h file
What it does not (yet !) do:
- Exports polygon normals
- Extracts the texture applied in Maya
If anyone knows the syntax for the polygon normals in FIFO, please tell me ! Once I know, I will be able to add support quite easily. I know that NORMAL_PACK is in there somewhere, but I don't know all of the details.
To use:
Create a 3D object in Maya.
Use the exporter to create the .h file.
Finally, add something like this into your code:
Code: |
#include "your3DObject.h"
glCallList(your3DObject); |
Take a look at the excellent Display List example in the devkitPro install for more information...
C:\devkitPro\examples\nds\Graphics\3D\Misc\Display_List
I am by no means a professional programmer, so please feel free to post your comments / corrections / suggestions !
If you want me to add a sample project, just let me know and I'd be happy to whip up something simple.
So, go ahead and download it ! Give me your feedback ! Thanks !
UPDATE Sept 4 2006
Latest version 0.8:
http://www.vurtx.com/tools/dlDSDisplayListExporter.zip
Last edited by ikaris on Mon Sep 04, 2006 4:50 pm; edited 2 times in total
#100300 - ikaris - Sun Aug 27, 2006 8:26 am
Hey everyone,
as a follow up, I whipped up a simple 3d object viewer to demonstrate a Display List created using the exporter being rendered.
Here's the devkitPro project and source code:
http://www.vurtx.com/ds/DSViewer.zip
And here is the executable in NDS and DS.GBA format:
http://www.vurtx.com/ds/DSViewer.ds.gba
http://www.vurtx.com/ds/DSViewer.nds
Enjoy !
#100420 - Sausage Boy - Sun Aug 27, 2006 8:41 pm
Are you tciny, or have you been working seperatly on the same thing?
It looks wonderful, I hope we'll get more 3d games now!
_________________
"no offense, but this is the gayest game ever"
#100422 - ikaris - Sun Aug 27, 2006 8:50 pm
thanks for the reply ! I hope people enjoy the tools as well and make more 3D games.
who is tciny ? were they writing a Maya exporter too ?
anyway if you have and questions or comments, just ask ! I'd love some feedback.
I added support for Normals this afternoon and ill post an update in a little bit...
also, theres a free (education) version of Maya available to download called Maya PLE... I will post a link of it as well.
thanks again !
#100431 - Sausage Boy - Sun Aug 27, 2006 9:23 pm
I thought it was impossible to run scripts in the free version? Anyways, tciny announced his work in this thread, seems he got busy with life or something though, never heard of him since.
Are you planning to turn this into a proper file format with animation support and so on? Or just an exporter? I'm working on a texture converter, perhaps I could give you my code for use in this, or we could agree on a standard file format for DS textures?
_________________
"no offense, but this is the gayest game ever"
#100434 - ikaris - Sun Aug 27, 2006 9:41 pm
Yes, I would be interested in collaborating. I don't know much about the texture format, 3D geometry is more of my specialty.
I don't know much about animation either, but I'd like to support it one day. For now, I just thought it would be fun to make a Display List exporter to get some simple objects going for beginners such as myself.
OK I've read a bit about tciny's work.
As I said in my first post, I'm not much of a programmer :) The exporter gets the job done, and allows for all the features required for a complex model.
However, it does require Maya and it does creates a .h file... it doesn't create an intermediate format which is then interpreted at compile time.
I could take up the project of converting FBX or COLLADA into a Display List. I don't think it would be that hard, but I only really know MEL Scripting and a bit of C and C++.
I've never written a full Win32 program, but I can look into it... it's by taking up challenges that we learn !
#100436 - ikaris - Sun Aug 27, 2006 9:50 pm
I thought I'd also add a screenshot of the DS Viewer, for those who don't want to have to download the NDS to see what it looks like...
it's nothing special, really... but it gets the job done.
[Images not permitted - Click here to view it]
#100556 - Sausage Boy - Mon Aug 28, 2006 6:34 pm
A Collada converter would be awesome, I've been thinking about that myself. If you decide to do it, you?ll want to make sure to use COLLADA-DOM and not FCollada, since it doesn't run on Linux without some work. I'd also write a command line only converter, so conversion can be automated in Makefiles and portable on many platforms.
Collada does seem like an elegant solution to support as many modeling tools as possible.
_________________
"no offense, but this is the gayest game ever"
#100637 - ikaris - Tue Aug 29, 2006 3:15 am
Hey Sausage Boy,
I'll make sure to check out COLLADA-DOM.
I took a look at the format, and it's not that complex... it has a lot of info that I would probably ignore... I just need the vertex positions, texture coords, normals and vertex colors.
I'm not making any promises about animation though :) I'm not quite there yet in my programming skills... working on it !
#100643 - ikaris - Tue Aug 29, 2006 4:44 am
UPDATE !
I've updated the DS Display List Exporter to version 0.7
New in this release:
- Now exports the Normals on a per vertex basis
- Added a tool to unlock the UVs (in case they are not exporting correctly)
- Various small tweaks and updates
Now the models can be lit with glLight.
I'll post a new DS Viewer sample with working lights soon !
Download it here:
http://www.vurtx.com/tools/dlDSDisplayListExporter.zip
#100681 - josath - Tue Aug 29, 2006 5:49 pm
I can't download any of your files, DNS for www.vurtx.com is not resolving.
#100685 - TJ - Tue Aug 29, 2006 7:02 pm
I'm not having any problems resolving it here.
#100687 - Sausage Boy - Tue Aug 29, 2006 7:09 pm
I'm experiencing the same, but I thought it was just a temporary problem.
_________________
"no offense, but this is the gayest game ever"
#100701 - ikaris - Tue Aug 29, 2006 10:15 pm
Works for me right now, I just tested it.
Let me know if you have any problems, and I'll also host it at an alternate location just in case !
Sorry guys, my webserver is usually very dependable!
#101095 - MelGibson - Sat Sep 02, 2006 12:00 pm
Its the same for me.. I can not reach www.vurtx.com :(
but maybe its my isp ?!
#101100 - hellfire - Sat Sep 02, 2006 1:46 pm
if anyone's interessted, i could spend a couple of minutes into a 3dsmax-plugin exporting to the same file-format.
and if it is possible to get a per-frame/per-object transformation-matrix from mel, it's probably not a big deal to go for a complete scene-exporter - without detours involving collada...
_________________
"The three chief virtues of a programmer are: Laziness, Impatience and Hubris"
#101122 - ikaris - Sat Sep 02, 2006 9:39 pm
To all those having trouble connecting to my website...
I've mirrored the exporter here:
http://www.uploading.com/files/SWJYOT1Q/DSDisplayListExporter.zip.html
Sorry about the hosting, guys... it's really strange !
I hope no one is discouraged to try out the exporter.
Hellfire:
Sounds great ! You can take a look at my source code if you want to see how I did it... I tried to put a lot of comments, but let me know if there's anything that confuses you !
I know a little MaxScript, but not enough to do this exporter in 3ds max.
#101124 - Sausage Boy - Sat Sep 02, 2006 9:50 pm
I honestly don't understand the 3D world's big fascination of exporters. You don't hear people say "yeah, I made a photoshop exporter for the DS without detours involving png". Ok, I seem to remember a plugin for The Gimp that not even the author uses, but other than that, nada. Perhaps it's a relic from the time when 3D modeling programs were so vastly different that it was impossible to create a shared file format?
I don't mean that the Maya exporter is bad, I really hope that people will use it so I get cool games to play. But creating 3 seperate exporters for the same format seems like 3 times as much work as needed, not to mention they'll be written in completely different languages. I can easily see that becomming a nightmare, to keep track of that feature that doesn't work in that program and so on.
_________________
"no offense, but this is the gayest game ever"
#101134 - hellfire - Sat Sep 02, 2006 10:48 pm
Quote: |
I honestly don't understand the 3D world's big fascination of exporters.
You don't hear people say "yeah, I made a photoshop exporter for the DS without detours involving png" |
seems like the community got used to annoying tool-chains :)
to keep your example: the ds is capable of using a compressed texture format. wouldn't it be useful to have a plugin to export such format with preview etc directly from photoshop or gimp?
the situation is more complex with 3d-software, which handles data internally in a much different manner as you actually require it.
sure, you can use external tools to convert your data from one of the few standard-formats - but at the end it makes development just more time-consuming.
_________________
"The three chief virtues of a programmer are: Laziness, Impatience and Hubris"
#101139 - Sausage Boy - Sun Sep 03, 2006 12:06 am
I understand your argument, having exporters is clearly much more convenient for the artist. However, I do think that a few extra mouse-clicks to launch a seperate converter will by far pay up in the end. First of all, you'd need many different exporter for many different programs. I for one at least want a Blender exporter, I have some wierd free tools fetish.
Say we actually had people making exporters for the different programs, everything would be going nice. Now imagine the Blender guy got caught up in real life. A feature is desperately needed from the 3d, an extension to the file format must be made. But the Blender exporter still uses the old version, and no one understand the guy's code, or are willing to update it. The whole situation would lead to incompatible loaders and general pain and confusion.
To me, the effort the artist makes to use an external converter is not nearly the same as the effort it would take to successfully maintain exporters for all the popular 3d modeling programs. But that's just me I suppose, and I really won't complain if you make a 3ds max exporter. :P
_________________
"no offense, but this is the gayest game ever"
#101349 - ikaris - Mon Sep 04, 2006 4:49 pm
LATEST VERSION ! 0.8
New features:
- Optimized vertex normal export (now with no artifacts !)
- Some functions to tweak floating values to work better on the DS
- Warning in case UVs are outside of 0,0 and 1,1
Grab it here:
http://www.vurtx.com/tools/dlDSDisplayListExporter.zip
http://www.vurtx.com/tools.htm
Sausage & Hellfire:
Nothing like a bit of debate to keep this topic going ! :)
I agree with both of your points... I like having an exporter directly in the 3D software, because it is more convenient.
However, if you have something external that's more generic, you could write a script to automate the process of converting.
Both are good :)
#101350 - ikaris - Mon Sep 04, 2006 4:51 pm
New sample project !
Since I added vertex normal support, I updated my sample project to include the ability to toggle a glLight on and off.
Enjoy !
http://www.vurtx.com/ds/DSViewerLights.zip
#101354 - sajiimori - Mon Sep 04, 2006 6:40 pm
Agreed that any external conversion step can and should be automated by the build process. At first, that would make a converter for a generic format seem like the better approach.
It makes sense to be able to preview compressed textures in Photoshop because the artist needs to see what kind of loss is involved, but how does that relate to choosing whether to have a custom exporter or an external converter? Neither approach automatically lets you preview what the model will look like on the DS.
Off the top of my head, the two potential problems with external converters are:
1. The intermediate format may not contain as much information as is available to the exporter through the 3D application's API. This is basically the question of whether COLLADA is broad enough to cover our needs.
2. How does the artist select DS-related conversion settings that don't correspond to any native concept in the 3D application? For instance, you may want a bitfield that allows the artist to specify which of the 4 hardware lights should apply to the model.
#101446 - hellfire - Tue Sep 05, 2006 5:05 pm
Quote: |
exporter [...] lets you preview what the model will look like on the DS. |
that's actually a very good idea! :)
_________________
"The three chief virtues of a programmer are: Laziness, Impatience and Hubris"
#101553 - Sausage Boy - Wed Sep 06, 2006 12:52 pm
Quote: |
2. How does the artist select DS-related conversion settings that don't correspond to any native concept in the 3D application? For instance, you may want a bitfield that allows the artist to specify which of the 4 hardware lights should apply to the model. |
That's a really good question. Perhaps an option in the converter/exporter/whatever (alphabetical order :P)? As for preview, the emulators seem to do a fairly good job emulating the DS's 3D hardware, so perhaps the converter/exporter/whatever could use OpenGL to display what the model almost would look like.
_________________
"no offense, but this is the gayest game ever"
#101587 - ikaris - Wed Sep 06, 2006 7:58 pm
[quote="Sausage BoyAs for preview, the emulators seem to do a fairly good job emulating the DS's 3D hardware[/quote]
They do ? Which one ?
I haven't had much luck... I either get flickering, or a crash altogether... this is with Display Lists, mind you.
Which one / version # are you using ?
#101588 - Sausage Boy - Wed Sep 06, 2006 8:04 pm
No$gba seems to crash if used with textures, but otherwise I've found it decent. Dualis has a problem with NOP's in display lists, but seems to work kinda well. Can't say I've pushed any emulator very hard, but for simple basic stuff I've found Dualis fairly accurate.
_________________
"no offense, but this is the gayest game ever"
#101594 - sajiimori - Wed Sep 06, 2006 8:20 pm
An exporter could have a window that asks the artist about settings before exporting, but that hinders batch processing.
If converter options are used, the artist will need a convenient way to edit the options, i.e. not editing makefiles.
Ideally, I'd like to see these kinds of settings get saved with with the art file and parsed by the converter. There could be a generic GUI-based editor for these settings that works directly on COLLADA files. Edit: I should clarify that this might require some kind of "custom data" section in the COLLADA format; I know nothing about it.
Having a separate editor can be a little inconvenient, so built-in editors can also be made for specific 3D applications. Still, a separate editor doesn't sound too bad.
#101706 - Sausage Boy - Thu Sep 07, 2006 3:38 pm
I imagine an asset directory, and a data directory. The converter is run in configure mode on every file, and saves a little text file with conversion instructions for that file. The Makefile calls the converter, which traverses the asset dir and puts the converted data in a data dir, updating files if they're changed. This could be taken a step further, one could write a configurer for the 3d modelers, which would act as an exporter, but it would just save to Collada and config file. I think that would be easier to manage than exporters for every scripting language.
As far as I can tell, this would create a both programmer and artist friendly environment. For big projects, the asset dir could be shared with some versioning system software, and easily shared and tweaked by all team members, in different modeling programs even. Building would be a breeze.
Configuring could be made extremely simple. Save your art to the asset dir, start the converter and it tells you which assets need config files, so you can easily go through them, with preview and everything.
The problem is to make all this sweetness. :D
_________________
"no offense, but this is the gayest game ever"
#102048 - - PT - Sun Sep 10, 2006 5:36 am
Hi ikaris, really great script, but I'm having trouble using it.
I can compile your DSViewerLights example, but when I run it in Dualis, the torus is missing.
Fiddling with zoom, rotate doesn't bring it into view.
I can get textured objects working in other demos.
I've also updated my drivers (ATi Radeon 9000) and tried with multiple emulators, none of them work.
I modified your code to display in wireframe, incase it was a lighting problem, and the torus IS being drawn.
But it jitters very quickly in one spot and you can't rotate or zoom on it.
[Images not permitted - Click here to view it]
I also get this when I try to load any displayLists (including your torus) into my demos and run with Dualis:
OpenGL Error
GL_INVALID_OPERATION(End)
All I'm doing is including the header and replacing the draw code with:
glCallList(displayList);
Any thoughts?
#102074 - ikaris - Sun Sep 10, 2006 4:21 pm
Hi PT !
Thank you for your comments, I really appreciate it !
I like to know if people have been trying out the scripts, and that they work.
DS Emulators are notorious for not being able to render Display Lists correctly...
if anyone knows how I could modify my code to work better with an emulator, I'd be happy to know, but I think it's just not possible !
Correct me if I'm wrong !
I just work 99% on hardware, and I bust out the emulator on occasion to do some simple 2D work.
#102406 - DiscoStew - Wed Sep 13, 2006 8:21 pm
Heya Ikaris, I'd just like to ask you about a problem I am having with your script.
I'm running Maya Personal Learning Edition 7.0.1 (I'm new to 3D modeling), and I made a model that I wanted to try out on the DS, so I got your script, and tried exporting, but it says this in the Script Editor...
// Warning: line 191: fopen: unable to open file "C:\displayList.h" for mode "w". //
// Error: Path does not exist or file is read-only. //
Any thoughts? Obvious the path exists, but I also don't have any files called displayList.h either that could mess it up.
_________________
DS - It's all about DiscoStew
#102417 - DiscoStew - Wed Sep 13, 2006 11:02 pm
Nvm, just checked the Maya site, and in the Learning edition, fopen is not available =(
_________________
DS - It's all about DiscoStew
#102428 - ikaris - Thu Sep 14, 2006 12:49 am
oh dear...
yes i was not aware that Maya PLE does not support that...
I guess it makes sense because they dont want you to be able to get files out.
However, try make sure that displayList.h is not read only...
and maybe try changing the name of the file, like dispayList2.h
Hope this helps !
#102467 - DiscoStew - Thu Sep 14, 2006 7:30 am
Heh, I've read about people getting around this with their own stuff through printing to the output window, and doing a copy/paste to a file, but I don't find that appropriete, nor even feasible when dealing with output that can end up being 100KBytes+.
_________________
DS - It's all about DiscoStew
#102496 - ikaris - Thu Sep 14, 2006 4:19 pm
DiscoStew wrote: |
Heh, I've read about people getting around this with their own stuff through printing to the output window, and doing a copy/paste to a file, but I don't find that appropriete, nor even feasible when dealing with output that can end up being 100KBytes+. |
I would be more than happy to add this open to my exporter....
its really not hard to do... at the end of the process, I end up with a string which I can either write to a text file, or to the Maya History window.
What do you think ?
Just in case ?
#102517 - DiscoStew - Thu Sep 14, 2006 9:38 pm
If you are capable of doing it.
I'm not even sure if this would be considered an illegal attempt at getting around fopen, but could you even output so much data that way and not have it cut off?
All I wanted to use Maya for right now is make low-poly textured models for use with the DS, nothing like making CG videos or of the like.
_________________
DS - It's all about DiscoStew
#102525 - tepples - Thu Sep 14, 2006 10:19 pm
Then might you want to write your own modeler?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#102553 - DiscoStew - Fri Sep 15, 2006 5:18 am
If I was capable of actually making a modeler, I'd do that, but I am not sophisticated enough to be able to do that.....or at least not yet.
I saw this method (ikaris's way) of getting 3D onto the DS, and just thought I'd give a shot at it, since this is the first time I ever dealt with 3D in programming, and a while since I touched a 3D modeling program.
Mainly for kicks, but if I actually get somewhere in testing things out, I may try out a larger idea of mine that I've had for a while.
_________________
DS - It's all about DiscoStew
#102666 - tepples - Fri Sep 15, 2006 11:43 pm
Path to writing a modeler: - Display a 5-poly triangular prism with just OpenGL calls and hardcoded vertices.
- Put the vertices in an array and display them from there.
- Build a display list out of the vertices and display that.
- Add features such as vertex normals and textures.
- Make an editor that can move the position, normal, and texture coordinate of the point. This editor is called a "modeler" and could even run right on the DS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#102678 - sajiimori - Sat Sep 16, 2006 12:58 am
Or you could use Blender.
#102954 - DiscoStew - Mon Sep 18, 2006 5:12 am
Well, I see how the display lists are formed, and I hand-made a simple 6-sides box, using 12 triangles formed out of 3 vertices each, all having points of 0.5 or -0.5 on each axis, and assigning an RGB15 color of (15,15,15) per vertice.
Tried it on Dualis, and the box only showed up for a frame or so before disappearing. I thought I did something wrong for it to do that, since your first non-lit donut shows up on it, but I tried Ideas, and it actually showed it in all it's glory, hehe, although it didn't seem to do any Z-buffering.
I'm hoping sometime soon I can get the hardware needed to test it out on the actual DS hardware, but until then, I'll just study a bit on the libraries and registers of the hardware and tinker with what is available.
Thx.
_________________
DS - It's all about DiscoStew
#102989 - tepples - Mon Sep 18, 2006 1:50 pm
Have you tried drawing it, waiting for vertical blank, and drawing it again?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#102994 - Lick - Mon Sep 18, 2006 2:47 pm
tepples wrote: |
Path to writing a modeler: - Display a 5-poly triangular prism with just OpenGL calls and hardcoded vertices.
- Put the vertices in an array and display them from there.
- Build a display list out of the vertices and display that.
- Add features such as vertex normals and textures.
- Make an editor that can move the position, normal, and texture coordinate of the point. This editor is called a "modeler" and could even run right on the DS.
|
What I call, easier said than done.. =) Hope it was a sarcastic joke.
_________________
http://licklick.wordpress.com
#102999 - DiscoStew - Mon Sep 18, 2006 3:05 pm
tepples wrote: |
Have you tried drawing it, waiting for vertical blank, and drawing it again? |
Yes, I have. I'm actually using ikaris's own project code because I merely wanted to get an object displayed before I get into the more complicated parts of dealing with 3D.
Well, I've never used OpenGL before (the DS uses a subset of OpenGL, right?), but it doesn't seem too complicated. I was messing around with ikaris's donut, editing a triangle here and there just to see how things would change on it. However, when I deleted a triangle from it (and made sure to adjust the command count), the entire donut does the same thing like my own cube in Dualis, displays for a frame and disappears afterwards. Not even the lighted donut with normals shows up on it, but I'm assuming that is more of an emulator problem. No problems with Ideas though, except for it being slower and no Z-buffer.
I guess in order to truely see if it is working, I'll need to get it running on hardware.
_________________
DS - It's all about DiscoStew
#106562 - dj-ceejay - Fri Oct 20, 2006 5:37 pm
What format does the header with the display list need to be in?
I have a Blender->Collada->Header file program setup already with an OpenGL preview. I want to use it for NDS dev too.
I've written it to use in OpenGL ES games. Currently it outputs one big array with vertex positions, normals, and texture coordinates. The ES program then sets up array pointers and calls glDrawArrays.
Thanks.
_________________
Fruit Machine Games:
http://www.fmsoftware.info/
#172811 - cmberryau - Fri Mar 05, 2010 2:00 am
Does anyone have their hands on this mel script? I would really (really!) like to get my hands on it if possible!
If anyone can post a current link it would be awesome + greatly appreciated :)
Edit: I'll most likely be making my own exporter soon anyhow, I'll post it up when I do.