Sins of a Solar Empire : Real-Time Strategy. Unrivalled Scale.
© 2003-2013 Ironclad Games Corporation Vancouver, BC. All rights reserved.
© 2006-2013 Stardock Entertainment

SOASE 3dsmax importer and exporter tool - Updated for Rebellion

We don't need no stinkin' subtitle

By on February 8, 2008 10:44:48 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Stannum

Join Date 02/2006
+2

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:

195 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
September 28, 2010 5:18:09 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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... )

Reason for Karma (Optional)
Successfully updated karma reason!
October 1, 2010 7:18:42 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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. :]

Reason for Karma (Optional)
Successfully updated karma reason!
May 5, 2012 4:15:56 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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?

Reason for Karma (Optional)
Successfully updated karma reason!
June 27, 2012 6:46:38 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
June 28, 2012 1:44:22 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Stannum,
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.

Reason for Karma (Optional)
Successfully updated karma reason!
June 28, 2012 1:53:05 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

A most excellent tool. 

Reason for Karma (Optional)
Successfully updated karma reason!
June 28, 2012 5:01:53 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
June 29, 2012 9:12:52 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Stannum,
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.

Reason for Karma (Optional)
Successfully updated karma reason!
June 29, 2012 11:39:45 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

I added this to the links on the Modder's-Get-An-Answer and Idiot's Guide to Modding threads.  Great job.

Reason for Karma (Optional)
Successfully updated karma reason!
June 30, 2012 12:35:20 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Outstanding!

Reason for Karma (Optional)
Successfully updated karma reason!
July 1, 2012 10:40:21 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums
Warb
Reason for Karma (Optional)
Successfully updated karma reason!
July 1, 2012 1:24:06 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Stannum,
Warb

??? I expected a slightly longer reply  

Reason for Karma (Optional)
Successfully updated karma reason!
July 1, 2012 1:33:23 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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.

 

Reason for Karma (Optional)
Successfully updated karma reason!
July 2, 2012 11:44:27 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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:  <<

Reason for Karma (Optional)
Successfully updated karma reason!
July 8, 2012 2:41:58 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Mmmmm time to fire up my Max 10 again

Reason for Karma (Optional)
Successfully updated karma reason!
July 17, 2012 7:23:28 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

"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.

Reason for Karma (Optional)
Successfully updated karma reason!
August 13, 2012 11:56:36 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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.

Reason for Karma (Optional)
Successfully updated karma reason!
August 17, 2012 9:48:36 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
August 18, 2012 4:28:58 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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
)


 

 

Reason for Karma (Optional)
Successfully updated karma reason!
March 4, 2013 11:39:59 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

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.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108434  walnut1   Server Load Time: 00:00:00.0002297   Page Render Time: