This tutorial is written for users of 3DSmax6/7/8, but once you've got your model in 3DSmax it applies to all versions.
Because this tutorial describes using grnreader, it is recommended to read the GR2 Decode Documentation before continuing.
There's a separate part for weapons in the next post. If you want to edit or create a new weapon mesh, then go to that post.
It contains for instance a description of special settings for exporting a weapon as a GR2 file.
Tools to use
- grnreader98 v1.4.0.3 debug (download it here (link));
- a version of 3DSmax which can properly import SMD files, preferrably 3DSmax6/7/8;
- a granny2 export plugin for 3DSmax (I'm not gonna advertise any link about this plugin in this post);
- an SMD import plugin or script for 3DSmax - I strongly advise using Cannonfodder's SMD plugins (link) for 3DSmax 6/7/8;
- GrannyViewer by RAD Game Tools (link)
At the end of this page (link), there's a Tools section with links to exporters.
Step 1 - Extracting Stuff from a GR2 Model File
Extract a GR2 file from eg. graphics05.zip and put it in a separate directory.
This separate directory is probably going to hold quite a few files, so name it after the model.
Copy grnreader98.exe and your version of granny2.dll into this directory (for instance version 2.7.0.28 of Sacred 2 (US v2.43)).
Open a command prompt, navigate to your new directory and type:
> grnreader98 <your_model.GR2> -a -t
Note 1: <your_model.GR2> is the name of the GR2 model file you extracted.
Note 2: this command line is the current working command line for grnreader98 v1.3.0.4. It may change in the near future.
The output of grnreader98 is an SMD file, which is a text-only file, so it can be opened in any text editor.
Sometimes you want to open such an SMD file to edit something, so it is useful to learn it's format.
Two main types of SMD files exist:
- the socalled SMD reference file;
- the socalled SMD sequence file.
Only the SMD reference file is important for our purposes.
An SMD sequence file holds animation data. This type of SMD file is not used in this tutorial.
An SMD reference file contains a mesh, a skeleton (with one or more bones), a 'skin', and texture information.
The 'skin' is not a skin of flesh & blood, it merely represents the coupling (or 'binding') between the bones and the vertices of the mesh.
A model's skin is also referred to as 'the vertex weights'.
Step 2 - Importing the SMD into 3DSmax
Using Cannonfodder's SMD import plugin for 3DSmax is largely described in my Archangel Manual (link), which also includes images.
Step 3 - Checking your Model's Type
Sofar we've seen two types of models with Sacred 2:
a.) static models like weapons;
b.) dynamic (or animated) models.
To check whether your model belongs to the 'static type', open your SMD file in a text editor.
Here's an example of what you might see in the 'triangles' section:
n_brassknuckle06_00 0.057934 -0.630990 0.000168 1.000000 0.000000 -0.000000 0.461213 -0.441767 1 0 1.000000 0 0.057934 2.362213 0.000169 1.000000 0.000000 -0.000000 0.237679 -0.441413 1 0 1.000000 0 0.057933 0.277408 -0.518283 1.000000 0.000000 -0.000000 0.393373 -0.624539 1 0 1.000000
If all your triangles have the last three parameters equal to "1 0 1.000000", then you can be sure you are looking at a static-type model.
If you are editing or creating such a static model, then go to the next post in this thread (**).
<Edit (April 10, 2011): Taken out the part where it says to delete the 'Skin' modifier..>
Step 4 - Editing the Sub-Material(s)
Open your GR2 file in GrannyViewer and click the 'Material List' tab.
Usually you will see only one material.
Note down the name of the material(s).
At this point you might want to check whether the material name(s) exists in the file surface.txt.
This file is located in the directory: <your Sacred 2 directory>\scripts\client
The name(s) of the material(s) will be applied to the sub-materials of your multi-material in 3DSmax.
To do so, open the Material Editor in 3DSmax and pick the multi-material from the imported SMD mesh as described in the Archangel Manual.
Sofar it seems that the order of appearance of the sub-materials is equal to their list sequence in GrannyViewer,
so you can easily apply the material list you noted down:
- click on the button of each sub-material;
- change the sub-material's name;
- remove it's texture.
To remove a (diffuse) texture, right-click the button of the texture and select the pop-up menu option <Clear>.
When you clear a texture, you will see that the color of your model changes to a darker grey.
This is all you have to do before exporting the model as GR2.
Step 5 - Changing the Model
There's several ways to alter an imported model, or to create a completely new one.
The latter is beyond the scope of this tutorial.
One thing is important when changing an imported model, and that is trying to prevent Skin corruption.
If you have a new mesh part for your model, make sure it's type is a socalled "Editable Mesh", without a 'Skin' modifier.
This new mesh part must also be connected to the model's skeleton, therefor:
- select the main part of your model's mesh and go to the Modifier tab in the sidepanel;
- right-click the 'Skin' modifier and select <Copy> from the pop-up menu;
- select your new mesh part, right-click in the list of modifiers and select <Paste Instanced> from the pop-up menu.
Last thing to do would be to attach the new mesh part to the main mesh, but I'm not sure whether this is really necessary.
In any case I don't recommended to edit the Skin's Environment.
Comment by Dimitrius154:
"I strongly recommend uniting all meshes of the modified model into one editable mesh (you won't loose material bindings) before applying the Skin modifier.
I found Skin corruption when more than one mesh was present within a model.
No Skin corruption appeared for the same model, when all meshes were united into one.
Unification of meshes is done by <Compound Objects -> Boolean -> Union>, and then converting the resulting structure into an Editable Mesh.
I should note that the new unified mesh may need to be repositioned a bit, 'cause its root coordinates may differ from the root coordinates of the original primary mesh.
Not sure about how Skin instance would behave for totally new meshes, but the general rule is: the larger the surface - the worse the distortion."
New meshes may look partially torn after copying and pasting the Skin (as 'Instance'), because this manual operation doesn't always apply vertex weights properly.
This can however be fixed easily by editing the Skin 'Envelope' for particular bones. Note that you must be very careful when going into this mode, otherwise you might cause more damage to your model.
For appendages (rigid armor, head included) all vertex weights for the main bone should be equal, and preferably equal to one (1.000).
(This should be tailored as you see fit).
If distortion spikes show up in-game, then one or more vertices have an improperly high weight for the secondary bone (in most cases this weight should be set to 0).
Pesmontis (edit - Jan. 9, 2012):
In case a model still shows distorted in-game, or in case the game crashes with your new GR2 file, I recommend the following:
- in 3DSmax, export the model as an SMD reference file (select <Export> and use Cannonfodder's plugin);
- using a text editor, delete the node(s) which actually represent a mesh - this node / these nodes are usually the last one(s) in the node list. Also delete them from the "time 0" skeleton list;
- the SMD exporter will probably have put "null.bmp" for the material name, so replace "null.bmp" with the name of the material (without the extension). In case the model uses more than one material, then apply bitmaps with distinguished names before exporting as SMD;
- reset 3DSmax and re-import the edited SMD file;
- check your materials and re-export as GR2.
<Step 5 is 'To Be Expanded' **>
Step 6 - Exporting the Model
The export settings described below do NOT apply to weapons or other 'static' models.
Go to the next post in this thread if you want to export a weapon as a GR2 file (**).
Select only your mesh(es) and click the menu option <File><Export Selected>.
In the "Select File to Export" window, select "Granny Run-time (*.GR2)" from the "Save as type" drop down list.
Type an appropriate name for your model in the "File name" textbox.
Click the button <Save>.
The "Granny Exporter Settings" window will appear with lots of export options.
The recommended exporter settings are:
= Uncheck the first three checkboxes with the 'Animations' settings;
= Uncheck the first two checkboxes with the 'File' settings;
= Uncheck the second AND the third checkbox with the 'Materials' settings,
so you only need a tick in the checkbox "Include reference in export";
= Select the following options with the 'Meshes' settings:
- enable the first three checkboxes;
- tick the checkbox with the setting 'Truncate vertex indices to 16bit';
- set the slider called 'Coords per vetex' to two (2). It's default is one (1);
- tick the checkbox 'Include tangent vectors';
- tick the checkbox 'Include binormal vectors';
- tick the checkbox 'Include per-bone triangle arrays';
- tick the checkbox 'Include topology information'.
= In the 'Models' settings,
- uncheck the third checkbox ('Include art tool specific data'), and
- uncheck the fourth checkbox ('Move to Origin');
= In the 'Textures' settings uncheck the first three checkboxes.
At the moment it's not recommended to include (a) texture(s) in your export.
Step 7 - Testing
Open your new GR2 file in GrannyViewer and check whether all materials are present and named correctly.
Create the appropriate directories in the 'pak' folder of your Sacred 2 installation and copy your new GR2 file there.
In case you want to use a file name for your new GR2 file, which differs from the original GR2 file name,
then you have to change the file name in the file 'itemtype.txt' in the directory: <your Sacred 2 directory>\scripts\shared
Start Sacred 2 and check the looks of your model in-game.
If you see a glowing white blob wielding a weapon (a 'GWBWW' ;-) then somit went wrong and you have to go back to 3DSmax to check your sub-material names.
Good luck & happy modding :-)
Edited by Pesmontis, 09 January 2012 - 05:04 AM.






















