#39981 - ecurtz - Thu Apr 14, 2005 5:22 am
I have a first version of the MD2 conversion tool I've been working on up. It is somewhat inefficient at converting the triangle fans into triangle strips. A production tool should probably re-strip the model instead. It also uses the FIFO display list format, so you'll need the latest ndsLib to rebuild the demo.
A demo (hardware only) with the ndsLib source is available here.
The source, which I hope is cross platform, including binaries for OS X is available here.
The only Read Me documents I included were for the original sources, so no Thank You to any of you is in there. Particularly deserving are DarkFader, Natrium42, and Lynx for enabling me to run code, and Dovoto and Joat for enabling me to write code. [edit] Forgot to thank mike260 for the Metroid and FIFO work he did and mention that it doesn't play animations currently - one frame only. I'm not sure what to do about data structures yet, so I left that out.[/edit]
- eli
#40214 - zazery - Sat Apr 16, 2005 6:31 am
Well I had this demo flashed to my EZF-Advance 128M card and it works wonderfully on the DS. However when I went back to my computer to put a different demo on it, I found I couldn't connect to the computer. The "Nintendo" text of the logo is all messed up and it won't connect to the loader on the computer. The cart works fine with the DS and still displays your demo. My SP still plays commercial carts just fine. I don't have a clue why it's not working, but I think it might have something to do with your demo. Anyone know why this would happen?
Edit: Figured it out, apparently I needed to restart my computer. Great demo by the way.
#40216 - ecurtz - Sat Apr 16, 2005 6:55 am
I didn't "fix" the gba header, which I guess maybe is freaking out your writer software? The DS doesn't read the Nintendo header, so I didn't bother. You could run gbafix or similar on it if you continued to have trouble.
Thanks for the comments. I think in the long run the tools will turn out to be more useful than the demo, which mostly just shows off somebody else's artistic talent.
#40368 - dovoto - Mon Apr 18, 2005 1:16 am
Converted the source to windows with only minor changes required. The updated source plus binaries and example md2 can be found at:
http://www.drunkencoders.com/tools/DS/md2toDSdl.zip
I just blindly converted the code and added an example to display it to ndslib (not yet uploaded). Still need to figure out how to get to the other frames or add support for this if it is not allready included. I will be creating a utilities section on the cvs for converters and such some point in the near future.
_________________
www.drunkencoders.com
#40371 - dovoto - Mon Apr 18, 2005 2:17 am
Okay I added support for multiple frames...outputing a single MD2 in display list format gave me a 4MB+ file. Maybe display list per frame is not the best way to go about it ;)
_________________
www.drunkencoders.com
#40372 - ecurtz - Mon Apr 18, 2005 2:48 am
Thanks for doing the PC fix-ups!
Regarding file size - Yikes. I wonder if there is a bug in there somewhere (not to imply anything about the quality of the code.) The Terminator frame in the demo is only like 9k, so if this model was similar that would mean a 500 frame md2 - do they get that big?!?
Since mike260 mentioned that the Metroid display lists were reading transforms off the stack somehow it is clear that's a better way to go. It unfortunately requires a pretty sophisticated setup for doing our own models with rigging and all rather than just stealing a bunch of Quake resources. I guess I'll take a look at the Halflife model format...
#40375 - FeaRog - Mon Apr 18, 2005 3:00 am
dovoto - thats what I found when dealing with Quake 1 models. The player model, which is a 443 triangle model with 130-odd frames takes up something like 700k with each frame as a separate display list. The technique I used with my model viewer was to use the indexed vertex data in a loop. Obviously not as fast, but a helluva lot easier in memory! I have some conversion functions that will take a pretty generic chunk of mesh data and dump it to a display list, could be handy. I really should clean up my Quake model viewer & converter code for release, as it also will resample any sized RGB texture to a 128*128*16...
It'd be nice if the DS has some sort of indexed vertex array functionality, and I would have thought it would make sense to include from the implementation perspective. We'll have to keep an eye on the disassemblies of new games and see if any have something like this.
#44966 - TheChuckster - Mon Jun 06, 2005 11:41 pm
Very nice work. It was very helpful to me. Thanks for providing it to us for the community.
#44975 - ecurtz - Tue Jun 07, 2005 1:03 am
No problem, glad you found it helpful.
I'm busy (when not totally buried at the job) getting the misfit stuff going. That will feature export for bones, which will be a lot more space efficient than the md2 stuff is. Plenty of opportunity still to help out - either with DS exporter stuff or general coding (as with most open source stuff, misfit still has some "issues".)
Misfit Model 3D
#45997 - iainprice - Fri Jun 17, 2005 8:38 pm
I ghave tried compiling the code for the MD2 convert demo and I can't get textures to work right... the model always shows up black... any ideas?
#46002 - ecurtz - Fri Jun 17, 2005 9:33 pm
There's a separate command line tool for generating the texture from the .pcx file.
Take a look at the data that's generated from that and it looks reasonable (I believe it's the color table, than the pixel array, but you can check the code.) If the texture looks ok it might be a change in ndslib or something small like forgetting to set the texture before submitting your model.
If nothing else works you can mail me your model and I'll take a look at it.
#46008 - connor9 - Sat Jun 18, 2005 12:40 am
I had problems with the md2 to display list converter as well but it was fairly simple to fix. The tool converted the mesh perfectly but I was having texture alignment problems.
The first problem was that I was using 128x128 textures and it seems that the tool is hardcoded for 256x256.
vert_list[index].v = (floatDtoN(*((float*)command)) * 256); command++;
vert_list[index].u = (floatDtoN(*((float*)command)) * 256); command++;
Those change the u,v coords for textures of 256x256. Either have pass in variable or change that to your size.
Also, anywhere the TEXTURE_PACK command is called, such as:
data_list[0] = TEXTURE_PACK(vert_list[i].u,vert_list[i].v);
It's not converting vert_list[i].u,v to the DS fixed point texture format.
Use something like:
data_list[0] = TEXTURE_PACK(floatot16(vert_list[i].u),floatot16(vert_list[i].v));
After doing those I'm getting perfect display lists. I really like that the tool even packs in triangle lists.
Thanks for the tool ecurtz!
#46042 - Ethos - Sat Jun 18, 2005 8:08 pm
I would post up a md2 reader, but I need dovoto to put in the float version of glTexCoord (a float from 0 to 1)
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)
#46049 - dovoto - Sat Jun 18, 2005 10:36 pm
I here that dovoto guy is too lazy for that sort of thing...i have a list of things to add, including fixed gluLookAt. Out of town at the moment but hope to find time in next couple of days to at least incorperate the changes that I have code for.
_________________
www.drunkencoders.com