#42211 - bluescrn - Sat May 07, 2005 11:16 pm
Wasn't sure whether to release these yet, as they might have given me a little advantage in the compo... but here they are anyway (includes src). Not really sure if they're any better than others that are already out there, but it's another option....
They're both win32 command-line tools, run them with no params for usage info.
The texture convertor takes a bitmap (anything DevIL can load) and outputs raw 1:5:5:5 texture data. Pure magenta should be transparent (untested).
The mesh convertor takes a .x file as input, and outputs a DS display list. No hierarchy, animation, or materials support, but it supports UVs and either normals or vertex colours (looks like you can't use both?) - it takes a single mesh (which is assumed to have the same texture all over it), and outputs a raw display list that can be called with glCallList().
It only uses triangles, no quads yet - that might be quite a big optimization for the future. I've got no plans to add animation support, but might wrap the display lists up in a node hierarchy, and may consider multiple materials support.
Simplest way to test a model is in the ndslib textured_cube sample. Just add glCallList((uint32*)my_mesh); at the point where it draws the cube. (You still need lights, material, and glPolyFmt() set up before calling the list).
Last edited by bluescrn on Sat May 07, 2005 11:23 pm; edited 1 time in total
#42212 - bluescrn - Sat May 07, 2005 11:19 pm
..and as iDeaS doesn't support display lists yet, this code will render the output from ModelConv in an emu-friendly way. (Yep, it's really that simple!) Swap GFX_NORMAL for GFX_COLOR if you're using models with vertex colours.
Code: |
void glCallListEmu(u32 *pList)
{
int nNumVerts=(*pList - 4)/5;
pList+=3;
GFX_BEGIN = GL_TRIANGLE;
for(int n=0;n<nNumVerts;n++)
{
pList++;
GFX_TEX_COORD = *pList++;
GFX_NORMAL = *pList++;
GFX_VERTEX16 = *pList++;
GFX_VERTEX16 = *pList++;
}
GFX_END = 0;
}
|
(edit: This will only work for ModelConv output, not arbitrary display lists!)
#62821 - psimon - Tue Dec 06, 2005 7:05 am
Quote: |
The mesh convertor takes a .x file as input, and outputs a DS display list. No hierarchy, animation, or materials support, but it supports UVs and either normals or vertex colours (looks like you can't use both?) - it takes a single mesh (which is assumed to have the same texture all over it), and outputs a raw display list that can be called with glCallList(). |
When you say that the mesh converter takes a .x file and outputs a DS display list, what exactly do you mean by this? What is the form of a DS display list? I am familiar with object files that have vertices:
v -3.593235 0.000000 -2.016101
and polys/faces:
f 55/2/17 56/4/18 58/12/19
and normals:
uv 1 0 0
and I can export x files from maya.... but I am a bit lost on the DS display list.
Thanks for the workaround for iDeaS... do you know if they plan on adding it? I assume display lists work fine on hardware. Going to try tomorrow!!! getting my wireless usb key....
cheers
Simon.
#64217 - LunarCrisis - Tue Dec 20, 2005 8:12 am
A DS display list is simply the instructions for drawing the model pre-formatted specifically for the DS's hardware, so that they can all be done with one function call.
_________________
If a tree falls in the forest and no one is there to hear it, why the heck do you care?
#64358 - Xgame - Wed Dec 21, 2005 6:15 pm
Hi, you' ve made a great job!
i wont to put it in Yeti3d for use model; can you help me?
#129448 - bmnb1234 - Tue May 22, 2007 10:23 pm
I not not how usefull this is but I have the source code for the GP32 version that suports 3d files.
Yeti modified sources
http://www.geocities.com/rtb7/files/gp32/adic2k4_src.zip
using Mirko SDK and devkitarm_r17
The java tools (MD2 transformation and Texture set editor)
Here is the java file the tool that you will need to convert it tool from md2 to the 3d file format that this of yeti3d
3D tool : http://www.geocities.com/rtb7/files/gp32/3d_tools.zip
to export MD2 to my yeti anim format.
It also uses a 128
texture
so here is the tool
Texture tool : http://www.geocities.com/rtb7/files/gp32/yeti_tex.zip
(Java tool to generate compatible .RAW and .PAL files from jpg/gif/png images)
Hope you can find something usefull here.
Jason
#129496 - a128 - Wed May 23, 2007 8:12 am
Can't download the Dsutils.zip file
#136919 - ChrisKnott - Mon Aug 06, 2007 2:46 pm
I think bluescrn's site is down, does anyone know what happened there are a few things I want to get from there...?
#142779 - Noda - Sat Oct 13, 2007 3:50 am
bump! I'm greatly interested into the mesh converter, does anyone have a copy of dsutil.zip?
thanks!
EDIT: found it on birslip's site: http://birslip.pizz.biz/temp/dsutils.zip
#142784 - Peter - Sat Oct 13, 2007 8:44 am
In ModelConv.cpp:
Code: |
if ((px<-8 || py<-8 || px<-8) || (px>8 || py>8 || px>8))
{
printf("Warning: vertex %d of face %d is out of range! Scale down!\n",v,nFace);
}
|
You probably also want to test for pz rather than four times px.
BTW according to GBATek the vertex16 command has 16bits for one coordinate:
Quote: |
Bit 0-15 X-Coordinate (signed, with 12bit fractional part)
Bit 16-31 Y-Coordinate (signed, with 12bit fractional part)
|
I interpret this as 1bit for sign, 3bits decimal part and 12 bits fraction.
floattov16 in libnds is defined as:
Code: |
#define floattov16(n) ((v16)((n) * (1 << 12)))
|
When your coordinate is 8 units (which is valid in your if-equation above) the result is:
Code: |
32768 = floattov16(8) = 8*4096
|
But 32768 is just the 15th bit set. That maps to the most sinificant bit in the vertex16 command for a coordinate, which means -0?
In short, you should probably test "if(px >= 8 ..." or multiply by 4095.9f instead:
Code: |
32767.2f = 8 * 4095.9f // to fixed point v16
32767 = (int)32767.2f // remove fraction
7.997 = 32767/4096.0 // fixed point value represets 7.997
|
The same applies to the normals, but there is already a workaround in libnds (videogl.h):
Code: |
#define floattov10(n) ((n>.998) ? 0x1FF : ((v10)((n)*(1<<9))))
|
_________________
Kind Regards,
Peter
#142797 - Noda - Sat Oct 13, 2007 4:34 pm
Ouch! It may be related to these errors, but the model I converted using this program (a simple sphere mesh) give me lots of "invalid gx command" on no$gba, and the model doesn't show on a real DS :/
Does anyone has a working <whatever_mesh_format> to nds display list format which converts normals and UVs? (the one from the author of AmplituDS works great but doesn't convert normals and UVs, and isn't very user-friendly as the conversion needs to be done on NDS...)
thanks
#142805 - Peter - Sat Oct 13, 2007 5:58 pm
Noda wrote: |
Does anyone has a working <whatever_mesh_format> to nds display list format which converts normals and UVs? |
Maybe this? DS/libnds: How to create display lists (.h or .bin)?
_________________
Kind Regards,
Peter
#142821 - Noda - Sun Oct 14, 2007 1:19 am
I already saw that, but unfortunately the Ogre3D exporter of milkshape3D doesnt't export the .xml, only the .mesh file, and the ogre2n3D converter adds a header to the display lists :/