SADX - Model exporter coming!

Started by Fiamonder, April 05, 2010, 01:58:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fiamonder


I have some exciting news for people who are interested in SADX hacking. Dude (CorvidDude on Youtube), creator of Sonic RDX, is making a model exporter for SADX! He needs to add texture coordinate support, and he needs to fix the data totals.

He has to put all the data sets together, here's what he has done so far:

- vertex data
- vertex normals
- triangle strips

And here's a list what he still has to do:

- material editor
- attach struct editor/compiler
- seg struct editor/compiler
- add uv support to strip exporter

For now, he fixed the poly_total counter, he needs to fix the parser, so that it can properly handle the texture coordinates, and integrate OBJ2VT into the main program. once texture coordinates are added, completely custom levels and character models will be very easy to implement!

First try at making a sig, It's decent.


shadowDOESrock

those are the biggest news in the history of gamming ever.
XD

Cool.

- material editor

What do you mean?
Like, Snow gets to Ice Cream?

Fiamonder

Quote from: DarkKyoushu on April 05, 2010, 02:58:04 AM
- material editor

What do you mean?
Like, Snow gets to Ice Cream?

Well, not sure if I can explain it that good, but it has something to do with the Materials Struct. It consists of 20 bytes per unit, and it's probably something to do with how the character looks like, qua textures, PVR's, etc. The struct works like this, not that you'll understand anything of this:

    Byte Blue_Diffuse; // This is the amount of blue light to add to the diffuse (texture) channel
    Byte Green_Diffuse; // This is the amount of green light to add to the diffuse (texture) channel
    Byte Red_Diffuse; // This is the amount of red light to add to the diffuse (texture) channel
    Byte Alpha_Diffuse; // This is the transparency for the texture channel
    Byte Blue_Specular; // This is the gloss or specularity, blue channel
    Btye Green_Specular; // This is the specularity, red channel
    Byte Red_specular; // This is the specularity, green chanel
    Byte Alpha_specular; // This is the transparency for the specularity
    Float unknown; // seems to act like a float most of the time
    Byte TexID; // this is the pvr to load... not a gbix - I think the gbix is interpreted somewhere in the pvm caching function
    Byte SomethingImportant; // crashes when put to FF
    Byte unknown2[3]; //
    Byte unknown3; // seems to be Ax (x being a variable)
    Byte Spheremap; // first bit - U clamping, second bit - V clamping. Set to 21 to get normal uvs, set to 66 for screen mapping
    Byte EndOfStruct; // always 94

First try at making a sig, It's decent.


Tanassy

fiaman... you rule. and tell dude he rules too :D

seriously though.


ENDragoon

great, now that we almost have this, will we be able to create our FC's using this program, or do we need and external program like 3DSmax?
Given enough time, any man may master the physical. With enough knowledge, any man may become wise. It is the true warrior who can master both, and surpass the result. -Tien T'ai-

jkid101094

These looks pretty neat. :3
Kirby as Big anyone? 8D


Quote from: DracoDraco:  Saber was my bitch LONG before you heard about her.  I introduced you to FSN, loser.  D<
Oh, and still...
ILU JKIDDD

Says you. She likes me more. D<
And ILU2. o3o
IaFNSW.

ENDragoon

#6
Quote from: jkid101094 on April 07, 2010, 06:54:45 PM
Kirby as Big anyone? 8D
YES!!!!, dat would be AWESOME!!!!! +1
Given enough time, any man may master the physical. With enough knowledge, any man may become wise. It is the true warrior who can master both, and surpass the result. -Tien T'ai-

Sonic Jackson


shadowDOESrock

Quote from: jkid101094 on April 07, 2010, 06:54:45 PM
These looks pretty neat. :3
Kirby as Big anyone? 8D

Kirby as Amy anyone?


Since Kirby uses a Hammer too.

Fiamonder

Quote from: ENJACKAL on April 07, 2010, 06:44:57 PM
great, now that we almost have this, will we be able to create our FC's using this program, or do we need and external program like 3DSmax?

Well, that doesn't really matter, all you got to have is a custom (or from another game) model to import in SADX.

First try at making a sig, It's decent.


Jazz Nova

Quote from: Fiamonder10 on April 08, 2010, 02:43:20 AM
Well, that doesn't really matter, all you got to have is a custom (or from another game) model to import in SADX.
so where do you make the custom model?
with what program?
Thanks, firestar and kirbysoul, respectively

Fiamonder

Quote from: Jazz Nova on April 10, 2010, 02:05:00 AM
so where do you make the custom model?
with what program?

Any program where you can make 3D models.

First try at making a sig, It's decent.


Jazz Nova

Quote from: Fiamonder10 on April 10, 2010, 03:14:23 AM
Any program where you can make 3D models.
can you create models in said program?
Thanks, firestar and kirbysoul, respectively

rockout909

is said model exporter finished yet

Fiamonder

Yeah, yeah, the model exporter was finished a while ago, here's the download and tutorial copied off the original website X-hax:



download


You need 3DS Max to use the exporter.

How to use the exporter

If you are exporting a single mesh model:

1. open 3dsmax, load your scene with the model in question. Select the model piece you want to export and make sure the pivot point is centered to the model. In the toolbar on the right hand side of the screen, go to the "utilities" tab and click the MaxScript button. Then press "Run script" and locate the exporter script. The rollout should show up. Check all of the boxes, pick the export directory and press "Export Data"

2. Now that you have your split model data you can start putting them together. Open Hex workshop and Notepad. You'll need to grab a material struct, either premade from sonic.exe/chrmodels or construct it yourself. Paste the material struct into a new file in Hex Workshop. Save the file as "Model.nj"

3. Go to the end of "Model.nj" and write down the address in notepad as "Mesh 1; poly". Open out.ply and paste it at the end of the material data and write the new file end address as "Mesh1; uv". Open out.uv and paste its contents into model.nj.

4. Write down the new end address in your log file as "meshes". Go back to model.nj in hex workshop and insert 0x1c bytes. The first byte is the material ID, which will need to be 00, but increments with each mesh we add. The second byte will need to be 0x00 also, this means the model is using trilists. The next 2 bytes are a short int for how many polygons are in the mesh. Get this number from 3dsmax by selecing the model, going into triangle mode and doing "Select All". Max will report the number of tris in the sidebar on the right. The next 4 bytes are the pointer to the poly data, which we wrote down in step 3. Skip ahead 0xc bytes. The next 4 bytes will be a pointer to the UV data, which we also wrote down in step 3. The next 4 bytes are padding and then we should be at the end of the file.

5. Go to the end of the file, write down the address as "vertex data". Open out.vt and paste the data at the end of model.nj

6. Go to the end of the file, write down the address as "vertex normals". Open out.vn and paste the data at the end of model.nj You've now added all of the model data. Only one last thing to process.

7. Insert 0x2c bytes. This will be our ATTACH data. The first 4 bytes are the pointer to the vertex data (step 5). The second 4 are pointer to the normal data (step 6). The next 4 are the number of verticies in the model (retrieved the same was as the poly total was). The next 4 is the pointer to the mesh data (step 4). The next 4 is the pointer to the material data (should be 0 in this case). The next 2 bytes are the mesh count, then the next 2 are the material count (both 1 in this tutorial). The next 0xc bytes are the relative coordinates for the center of the model in floats (should also be 0 because we centered the pivot in step 1), and the next float is the radius of the model, and the last 4 bytes are padding. Save Model.nj and make a backup of it.

8. Run sadxmdl_porter.exe. Tell it the name of the nj file you made earlier, then give it the address you plan on putting the model in sonic.exe. The program is verbose sometimes, this is normal. It will also generate an out.log. This is useful for debugging but you shouldn't need it unless something went wrong.

9. congrats, model.nj is now ready to be put in sonic.exe. You'll still need to give it a seg, and a COL if you're using it for levels but the model data is done.

That's the tutorial, credits and kudos to Dude for making the exporter.

Good luck with shitting in your pants because I'm pretty sure that everyone except me understands this. :)

First try at making a sig, It's decent.