Stannum

SOASE 3dsmax importer and exporter tool - Updated for Rebellion

SOASE 3dsmax importer and exporter tool - Updated for Rebellion

We don't need no stinkin' subtitle

New (beta) exporter!

-Support for Rebellion and maybe older expansions.

-Exports to the BIN format. Imports both BIN and TXT models.

-Much, much more improved mesh processing.

-'Tangent map problems' fix. This was an error with vertex normals that weren't being flipped when the model was.

TODO:

-Add model flipping on export so modeling in max is more natural.

-Import points too, so far its just importing the mesh.

-Stuff?


New version:
http://janvanderweg.com/SOASE/SOASE_Rebellion.zip

Installation:

Extract contents of the zip, except the example model, to: ../3dsmax/scripts/

Like with the old tool, run 'SinsOfASolarEmpire_Rebellion.ms' from the utilities tab and it should appear in the dropdown box.

Model setup:

Mesh as normal. Multi material works by applying max materials to the faces you want them on.
I haven't put in any y axis = up correction stuff so ships should be pointing upwards. (check the example file)
Instead of dummies for points you'll have to apply a skin modifier and use bones. See below for more info.

Material setup:

The new model format requires 5 textures per material:
    Diffuse map  
    Data (specular, self illumination) map
    Normal map
    Displacement map
    Teamcolor map

From what I've seen so far, the last two maps (displacement and teamcolor) aren't used so you can leave them blank. The tool uses the material map name, not the assigned bitmap for export. Here's a table to see which 3dsmax map is used for what:

        SOASE material map                                         3dsmax material map
        DiffuseTextureFileName                                    diffusemap
        SelfIlluminationTextureFileName                     specularmap
        NormalTextureFileName                                   bumpmap
        DisplacementTextureFileName                        displacementmap
        TeamColorTextureFileName                              filtermap

Point setup:

Instead of dummy objects the script now uses bones. Create the bones with the correct orientation and place them where you want. Name them as required by the game. Apply a skin modifier to the ship object and add all the bones to it.

A word on normal maps:

Since the gamemesh processor takes smoothing groups into account when generating vertex normals you can use smoothing groups. If you're using smoothing groups make sure the utility you're using to bake normals also supports them.

What is GameMesh?:

GameMesh is a max object preprocessor that calculates pretty much anything about models. It supports overly complex model setups, multiple materials, bone hierarchies for animated models, etc. It even takes smoothing groups into account!

 

 

 

 

 

 

OLD STUFF:

 

Not sure if many of you use 3dsmax but I started writing a maxscript tool that will export/import BIN/TXT soase .mesh files

Should work with most max versions since this is a maxscript tool, not a compiled one.

Current version: 2.0a

Download link:
http://janvanderweg.com/SOASE/SOASE_Maxtoolv2.0a.zip

WHATS NEW:

Lots!....
I rewrote the mesh splitting algorithm into a semi-modular meshsplitting maxscript file, splitmesh.ms
It should be a lot faster now and it supports more features such as:
-Smoothing group support
-Multitexturing support
-Much faster (I think)

Readme:
http://janvanderweg.com/SOASE/index.html

OLD INFO, still might be usefull:

Obligatory pic:
http://janvanderweg.com/SOASE/soase_pic.jpg

Installation:
Unzip the contents of the zip into your 3dsmax\scripts\ directory.

To run the script:
-Goto the utilities tab (hammer icon on the right)
-In the utilities rollout click on MAXscript
-Click on run script
-Find the SINS_Tool.mzp file and run it
-In the utility dropdown box select SOASE Maxtool
-Click on import/export

Note:
Soase uses an Y-up system. This means:
Max y = above -y = down
Max z = forward -z = back
Max x = left -x = right

Adding points:
-Use dummy objects for points, rotate them so they face in the direction you want.
-Link them to the main object. If you don't link them they will not be exported.

Materials:
-Diffuse texture uses the diffuse slot (really)
-Data texture uses the specularlevel slot
-Normal texture uses the bump slot
-Set the glossiness with the glossiness controller in the specular highlights area

Add a bitmap to each slot but don't point to an image file. Instead change the slot name to the filename:



Your final texture should look like this:

381,878 views 202 replies
Reply #176 Top

Ohhhhh thanks Both of you! :] Myfist, that's an excellent tutorial, wonder why I couldn't find it before? It's super useful though. I'll try my hand at it that way and let you know how it works out. (I'm hesitant to email this to you for the simple reason that it's merely a tiny part of a massive mod I'm working on... :P)

Reply #177 Top

As it turns out, the whole problem was the 2.0 version of the script. I switched to the 1.1 and it works almost perfectly. :]

Reply #178 Top

I'm not sure if it was mentioned here, but i need help with exporting 3DS files to Mesh files with the SoaSE importer/exporter, it comes up with the following message: --Unknown property: "diffuseMap" in #Multi/Sub-Object:multi_Group_001(Double Sided:dbl_Group_001, Double Sided:dbl_Group_002, Double Sided:dbl_Group_003, Double Sided:dbl_Group_004)

can anyone help me?

Reply #179 Top

Bump for new (beta) version with rebellion export support. Read the OP for more info.

+2 Loading…
Reply #180 Top

Quoting Stannum, reply 180
Bump for new (beta) version with rebellion export support. Read the OP for more info.

 

Best bump ever!!  Thank you very much for the new version.  I realy hope i can forget about XSI from now on.

Reply #181 Top

A most excellent tool.  :grin: k1

Reply #182 Top

Spoke a little to soon. I'm getting an error when trying to run the script.

 

--Syntax eror : at bad, expected <factor>

--In line :

 

I use MAX8

Reply #183 Top

Quoting Stannum, reply 180
Bump for new (beta) version with rebellion export support. Read the OP for more info.

 

Awesome! I would absolutely love to finally ditch XSI, so all the more power to you for working on an improved max exporter.

Reply #185 Top

Outstanding!

+1 Loading…
Reply #188 Top

Forum is eating my replies?

 

I might be using script functions that aren't supported in 3dsmax 8. Could you post whats being printed into the listener in full? You can open the listener from the maxscript menu or by right clicking on the red and white boxes in the lower left.

 

Edit: Forum kept eating my replies. No idea what was going on.

 

Reply #189 Top

The mesege from listener :

 

-- Error occurred during fileIn in <File:C:\Program Files (x86)\Autodesk\3dsMax8\Scripts\GameMesh\gmMain.mse>
-- Error occurred during fileIn in <File:C:\Program Files (x86)\Autodesk\3dsMax8\Scripts\SinsOfASolarEmpire_Rebellion.ms>
>> MAXScript FileIn Exception: -- Syntax error: at bad, expected <factor>
--  In line:  <<

Reply #190 Top

Mmmmm time to fire up my Max 10 again :)

Reply #191 Top

"No nodes added to GameMesh processor "

 

Mesh will not export.  Materials applied, bones added to skin modifier and applied to mesh.  What's wrong?

 

Edit:  Oh, right.  Should probably mention,  I'm using 3ds max 2010.

 

Edit 2:  Ok, It stopped with that error, but now I get an "unknown property count in undefined" and it does not export.

Reply #192 Top

Is there anyone?

I'm having problem with 3ds max 2010 64bit:

- After added bones as mesh point and linked them to editable mesh, I received error message "No bones added as points" while exporting to mesh file.

- I imported game mesh file (ie capitalship_techcarrier.mesh), only ship object displayed, there is not any points, then I exported them without changing anything, i got same error.

Edit:

- I solved this exporting problem, i have to link the bones to skin.

- The importing problem still being there.

- Other problem appeared while exporting mesh: property count is undefined, and it shown in script (Soae/Soae_ExportBin.ms):

        append scalarvalues (dot nm cup )
        append scalarvalues (dot nm cdown )
        append scalarvalues (dot nm cleft )
        append scalarvalues (dot nm cright )
        append scalarvalues (dot nm cfront )
        append scalarvalues (dot nm cback )
        value = 0
        highest = 0
        for j = 1 to a.count do
        (
            if a[j] > value do
            (
                value = a[j]
                highest = j
            )
        )

        append carray[highest] i

I think that is programming mistake, a FOR loop finds the highest index, , there is a function SOASEREBELLION_FindHighestInArray to do that:

        append scalarvalues (dot nm cup )
        append scalarvalues (dot nm cdown )
        append scalarvalues (dot nm cleft )
        append scalarvalues (dot nm cright )
        append scalarvalues (dot nm cfront )
        append scalarvalues (dot nm cback )
        highest = SOASEREBELLION_FindHighestInArray scalarvalues
        append carray[highest] i

I exported mess successfully, but i havenot tested it yet and i don't know how it work, need script author to correct this script.

Reply #193 Top

Is there any one who uses 3ds max to make models for rebellion?

Reply #194 Top

I'm getting the same problem of "--Unknown property: "count" in undefined" for Max 2010 64bit, same code as above mainly.

struct SOASEREBELLION_Vertex
(
    position,
    normal,
    tangent,
    bitangent,
    uv1,
    uv2
)
fn SOASEREBELLION_FindHighestInArray a=
(
    value = 0
    highest = 0
    for i = 1 to a.count do
    (
        if a[i] > value do
        (
            value = a[i]
            highest = i
        )
    )
    return highest
)
fn SOASEREBELLION_WriteString bstream string=
(
    --write string length
    WriteLong bstream string.count #unsigned
    for i = 1 to string.count do
    (
        WriteByte bstream ( bit.CharAsInt string[i])
        WriteByte bstream 0 #unsigned
    )
)
fn SOASEREBELLION_ExportBINMesh gs file=
(
    format "\t*************\nExporting soase rebellion model:\n%\n\t*************\n" file
    --- check if gamemesh is multi surface.
    if gs.isAnimated == false do
    (
        messagebox "No bones added as points."
        return false
    )
    
    -- Collect header data
    m_HeaderBoundingRadius = gs.Bounds.BRadius
    m_HeaderMax = gs.Bounds.BMax
    m_HeaderMin = gs.Bounds.BMin
    m_HeaderNumMaterials = gs.numSurfaces
    
    bstream = fopen file "wb"
--WRITE HEADER
    WriteByte bstream 66 -- 'B'
    WriteByte bstream 73 -- 'I'
    WriteByte bstream 78 -- 'N'
    WriteByte bstream 10 -- Version? always 10
    WriteLong bstream 0 #unsigned -- maxDiffuseMipLevel -- always 0
    WriteByte bstream 1      -- Valid tangents boolean flag
--WRITE BOUNDS
    WriteFloat bstream m_HeaderBoundingRadius
    WriteFloat bstream m_HeaderMax[1]
    WriteFloat bstream m_HeaderMax[2]
    WriteFloat bstream m_HeaderMax[3]
    WriteFloat bstream m_HeaderMin[1]
    WriteFloat bstream m_HeaderMin[2]
    WriteFloat bstream m_HeaderMin[3]
-- WRITE MATERIALS
    WriteLong bstream gs.numSurfaces #unsigned
    for i = 1 to gs.numSurfaces do
    (
        mat = gs.Surfaces[i].material
        /*
        DiffuseTextureFileName                    diffusemap
        SelfIlluminationTextureFileName            specularmap
        NormalTextureFileName                        bumpmap
        DisplacementTextureFileName                displacementmap
        TeamColorTextureFileName                    filtermap
        Diffuse                                        = 1,1,1,1
        Ambient                                        = 1,1,1,1
        Specular                                        = 1,1,1,1
        Emissive                                        = 1,1,1,1
        Glossiness                                    = 1,1,1,1
        */
        if mat.diffusemap != undefined then SOASEREBELLION_WriteString bstream mat.diffusemap.name else SOASEREBELLION_WriteString bstream ""
        if mat.specularmap != undefined then SOASEREBELLION_WriteString bstream mat.specularmap.name else SOASEREBELLION_WriteString bstream ""
        if mat.bumpmap != undefined then SOASEREBELLION_WriteString bstream mat.bumpmap.name else SOASEREBELLION_WriteString bstream ""
        if mat.displacementmap != undefined then SOASEREBELLION_WriteString bstream mat.displacementmap.name else SOASEREBELLION_WriteString bstream ""
        if mat.filtermap != undefined then SOASEREBELLION_WriteString bstream mat.filtermap.name else SOASEREBELLION_WriteString bstream ""
        for i = 1 to 16 do WriteFloat bstream 1 -- assume all material values are [1,1,1,1]
        WriteFloat bstream mat.glossiness
    )
--WRITE POINTS
    format "WRITING POINTS...\n"
    numPoints = gs.Hierarchy.bones.count
    WriteLong bstream numPoints #unsigned
    for i = 1 to numPoints do
    (
        node = gs.hierarchy.bones[i]
        -- point name
        SOASEREBELLION_WriteString bstream node.name
        -- point position
        WriteFloat bstream node.position[1]
        WriteFloat bstream node.position[2]
        WriteFloat bstream node.position[3]
        -- transform matrix
        row = (normalize node.transform.row1)
        for i = 1 to 3 do WriteFloat bstream row[i]
        row = (normalize node.transform.row2)
        for i = 1 to 3 do WriteFloat bstream row[i]
        row = (normalize node.transform.row3)
        for i = 1 to 3 do WriteFloat bstream row[i]
    )
--WRITE VERTS
    format "WRITING VERTS...\n"
    srVerts=#()
    -- reference vectors for cached verts
    cup = [0,0,1]
    cdown = [0,0,-1]
    cleft = [-1,0,0]
    cright = [1,0,0]
    cfront = [0,1,0]
    cback = [0,-1,0]
    carray = #( #(), #(), #(), #(), #(), #() )
    ------------------------------------------------------
    for s = 1 to gs.numSurfaces do
    (
        SF = gs.Surfaces[s]
        for v = 1 to SF.numverts do
        (
            srvert = SOASEREBELLION_Vertex()
            gmvert = SF.Vertex[v]
            
            srvert.position = gmvert.position
            srvert.normal = gmvert.normal
            srvert.tangent = gmvert.tangent
            srvert.bitangent = gmvert.bitangent
            srvert.uv1 = gmvert.uvw
            srvert.uv2 = gmvert.uvw
            append srVerts srvert
        )
    )
    WriteLong bstream srVerts.count #unsigned
    for i = 1 to srVerts.count do
    (
        --position
        WriteFloat bstream srVerts[i].Position[1]
        WriteFloat bstream srVerts[i].Position[2]
        WriteFloat bstream srVerts[i].Position[3]
        --normal
        WriteFloat bstream srVerts[i].Normal[1]
        WriteFloat bstream srVerts[i].Normal[2]
        WriteFloat bstream srVerts[i].Normal[3]
        --tangent
        WriteFloat bstream srVerts[i].Tangent[1]
        WriteFloat bstream srVerts[i].Tangent[2]
        WriteFloat bstream srVerts[i].Tangent[3]
        --bitangent. Write zeroes since game engine computes bitangent with xproduct
        WriteFloat bstream 0
        WriteFloat bstream 0
        WriteFloat bstream 0
        WriteLong bstream 0 #unsigned
        --uv1
        WriteFloat bstream srVerts[i].uv1[1]
        WriteFloat bstream ( 1 - srVerts[i].uv1[2] )
        --uv2
        WriteFloat bstream srVerts[i].uv2[1]
        WriteFloat bstream ( 1 - srVerts[i].uv2[2] )
        
        -- calculate which cached vertlist the vert goes into.
        --Find out which direction the vert normal fits best to, dot product nearst one
        scalarvalues=#()
        nm = srVerts[i].normal
        append scalarvalues (dot nm cup )
        append scalarvalues (dot nm cdown )
        append scalarvalues (dot nm cleft )
        append scalarvalues (dot nm cright )
        append scalarvalues (dot nm cfront )
        append scalarvalues (dot nm cback )
        value = 0
        highest = 0
        for j = 1 to a.count do
        (
            if a[j] > value do
            (
                value = a[j]
                highest = j
            )
        )
        append carray[highest] i
    )
--WRITE TRIS
    format "WRITING TRIS...\n"
    numTris = 0
    offsets=#(0)
    offset = 0
    for s = 1 to gs.numSurfaces do
    (
        SF = gs.Surfaces[s]
        numTris += SF.numTris
        offset += SF.numVerts
        append offsets offset
    )
    WriteLong bstream numTris #unsigned
    for s = 1 to gs.numSurfaces do
    (
        SF = gs.Surfaces[s]
        for i = 1 to SF.numTris do
        (
            WriteLong bstream ((SF.Tris[i][1] as integer) - 1 + offsets[s]) #unsigned
            WriteLong bstream ((SF.Tris[i][2] as integer) - 1 + offsets[s]) #unsigned
            WriteLong bstream ((SF.Tris[i][3] as integer) - 1 + offsets[s]) #unsigned
            WriteLong bstream s #unsigned
        )
    )
--WRITE CACHEDVERTS
    format "CACHED VERTS...\n"
    for i = 1 to 6 do
    (
        WriteLong bstream carray[i].count
        for j = 1 to carray[i].count do
        (
            WriteLong bstream carray[i][j] #unsigned
        )
    )
--END
    
    fclose bstream
)


 

 

Reply #195 Top

Hi, I tried to use SOASE rebellion export plugin for 3ds max, I set the textures right but when the exporting is done It says " Unknown property: "count" in undefined. Please help.

Reply #196 Top

My apologies for bumping a year-old thread, I should know better but I'm desperate.

 

I'm using 3DSMax 2012 and whenever I try to import a ship I get the error "Multiple Materials not yet supported". I thought multiple materials WAS supported?

 

If someone could help me, that would be much appreciated. Again, I'm sorry for bumping an old thread.

Reply #197 Top

I am just assuming, but it is possible that the version of max you are using is too "new". This plugin was first made in 2008. Not long after Sins was released. I use 3dsmax version 2010, and i have no issues with the plugin. However i just used the plugin to import sins meshes to export them into other programs. Like the NanoFX Evolved model viewer.

Version 2012 may have changed something to cause the problem you are having, and disable some of the plugins functions. The plugin does not state what version of max it was made on. Nor does it say which version/s it is compatible with.

Autodesk has changed a lot of things about 3dsmax over the years. I tried version 2015, but got rid of it almost immediately. First thing i noticed is that the textures are now "connected" just like how its done in Softimage/XSI. Many things about 2015 remind me of Softimage/XSI (no surprise since Autodesk owns Softimage as well). However the deal breaker for me was they removed one of the BEST (IMO) features of 3dsmax. Lock Zoom, and Pan for background images. Locking the zoom, and pan allows you to model from a blueprint, or single view from a 5 view orthographic image. AFAIK no other modeling program could do that. It was very disappointing.

Anyways try using an older version of max (if you can get one), and see if it works for you.

 

Reply #198 Top

Didn't work. I still get the "multiple materials not supported" error, even when using 3DSMax 2010. Only certain ships are causing this though. Also, I'm using meshes from a mod, not from the actual game. Is that a problem?

Reply #199 Top

I would learn XSI free mod tool. 

I have imported many models, I dont think that script can actually handle multiple UV maps, so if you import one that uses multiple materials, you will need to remap the UVs to the 2nd UV you create.

Reply #200 Top

Well, I used an older version of the Max importer in 3DSMax 2010 and it got past the "multiple materials" error, but now I get "Unable to convert: undefined to type: Integer". I tried to do some research into by google searching but I couldn't find one definitive answer. 

 

I've also tried to use XSI, myfist0, but it crashes whenever I try to open it. 

 

I seem to be surrounded by errors.