Importing and Exporting GR2 Models
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 v220.127.116.11 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 18.104.22.168 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 v22.214.171.124. 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:
0 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 :-)
> ".. after being edited in 3dsmax.."
You can't simply edit a skinned model in 3DSmax. If you want to edit a mesh, first make a clone (<Edit><Clone>, select radio button 'copy'). Then remove the skin modifier from the clone or simply collaps the skin modifier. Then edit, and then copy the skin modifier from the original mesh. Thereafter you need to check then copied skin, to see whether bone weights aren't applied to mesh parts that are close together (for instance right leg / left leg).
Oh, and btw. the seams between the mesh parts can be smoothed with the "Edit Normals" modifier. You need to select two meshes with a seam in between, and then simply add the Edit Normals modifier.
Then, for each shared vertex, select the normals attached to that point and select <Average>. You'll see that the seam is partially smoothed away. Note that you have to be very precise on selecting the normals..
If you want to import multiple SMD files into 3DSmax, I recommend turning off the option "Always Deform" for each mesh you've already loaded. It can be found under the Modifier tab, section "Advanced Parameters". After you've loaded all separate meshes, simply turn on the option "Always Deform" for all loaded meshes.
> ".. only imported the skeleton.."
This is probably due to your FBX import settings.
Otherwise this can also be seen when loading SMD files that have something like "null.bmp" defined for a mesh's texture file. You can always edit SMD files with a proper text editor.
And now for something not completely different: a miniset called 'Genesis Siderea', originally meant to update an existing set.
Image 01: prototype in DeepExploration
Although.. mm.. it's actually completely different from the Sopor Aethernis set, as you'll soon discover :-)
The models for the boots, the pelvis and the torso were altered, and the model for the wings is new (derived from the 'envoy-of-death-wings02'). I also thought that the helmet model of Endijian's Artifacts would fit this set better, just because it's kind of futuristic apparel, and the helmet is the ultimate stargazer headpiece ;-) It would have been nice to create a complete set, but I never got to alter the legs, arms and shoulders, because these parts are already very nice and fitting. The textures are largely based on an image of a star-forming region: http://www.spacetelescope.org/images/heic0702a/ This is also why the set is themed with star formation, and why it's called 'Genesis Siderea'. It's going to be part of the new version of the CM Items Mod.
Big thanks (again) to Silver_fox for reviewing the bonuses. Both Flix and Silver_fox have encouraged me to make this set even better, for instance by testing the altered running animation. And Flix, thanks for the screenshots of the bonuses :-) The models of this set have actually undergone a wide range of very technical changes in order to make them fit precisely together. These technical edits include the mesh normals and the normal maps, and the way the meshes are affected by the bones. Also, the textures include a few miniature decals that can only be seen up-close. Vessel of Chaos This casque serves two purposes: (1) it's good for stargazing, (2) it's good for containment of awe, the direct result of (too much) stargazing. It also looks like a fighter pilot's helmet, and for that reason I added her squadron insignia: the well-known tiger constellation. Image 02: Seraphim with one of the new buyable shields
Image 03: Seraphim with the new throw-potion 'Molotov Cocktail'
Dawn of Scheherazade 'Dawn' is of course meant as the re-appearence of (day)light. The name of Scheherazade refers to the 'star' of the stories from "One Thousand and One Nights". She is a legendary Persian queen and she tells those stories for a reason. At dawn, she always stops storytelling with a cliffhanger, forcing the King to keep her alive for another day. So in fact this chestpiece is meant for survival in the first place, even though it looks like an arabian dancing top. In the diffuse texture map, the pendant has received a small 'galaxy' decal.
Image 04: Seraphim with the new unique staff 'To Mega Therion'
Image 05: Seraphim with the new unigue staff 'Shaman's Totem' Cradle of Light A region in space where new stars are formed: the origin of light and joy. The normal map texture has received an explicit lycra pattern.
Image 06: Seraphim with the new unique 'Delior's Holy Staff' Fusion Igniters These are the hands that have the (spell) power to light a star. The textures of these gloves have been made quite light colored, so that the effect of the original normal map is much more enhanced.
Dark Matter Conduits These boots draw in dark matter as they move the Seraphim from place to place. They'll get dirty, that's for sure, and not only with dust.. Technically, these boots have caused me headaches, because of the legs inside. I've tried hard to keep the boots slender, but the animations kept spoiling things. In the normal texture map, the folds at the knees have been erased, and on the inside of the boots, the diffuse texture map has received three decals to create more 'depth'. Star Meadows The eye catcher of the set has been textured with a 'volume texture' to increase the depth of the star field. The thickness of the wings is almost entirely created this way. The volume texure was created by color separation of the original image.
Image 07: new wings top view
Image 08: new wings side view
As an extra, the running animation of the Seraphim was changed slightly, in order to avoid clipping when she carries the new double laser sword:
Image 09: the 'new' way of carrying a two-handed sword Set bonuses:
Image 10: I guess this is actually what she's best at..
Image 11: Seraphim with the new 'Sylvanwood Longbow'
> ".. enemies added in the sector files don't obey.."
I'm guessing that they also won't re-spawn if the player doesn't leave the region.
> ".. More jewelry slots!.."
I'm very curious about this, is this also possible for other heroes?
Oups, missed this.. nice write-up Flix!
Wauwie! Thanks Gogo!
Yeah, I also re-read that post, and I thought I used to put quite some effort in things like this. But then at the time it was all quite new to me.
We're currently investigating a new tool for getting models in 3DSmax, and it might well be that creating new clothing / armor sets becomes easier.
It's going to be superb again, congratulations Flix!
> ".. what can you NOT change!.."
Yeah, all these new possibilities.. atm. I'm having difficulties keeping up!
This mod is becoming extremely serious..
No, but there's a new project, the Diablo 2 Fallen mod ( http://darkmatters.org/forums/index.php?/topic/22121-dev-diablo-2-fallen-mod-for-sacred-2/ ).
It goes on top of the latest CMpatch and improves many things.
> ".. how much stuff is gradually getting unlocked.."
It's true that we've uncovered quite a few new things lately. Also w. help from Dmitrius.
It's very satisfying to stay active w. Sacred 2.
Putrid Defiler, don't you just love this creature?
The way it desintegrates & splashes all around you.. I can't resist slashing them!
I finally came 'round to making a Rayne model (asked for by Veracious about a year (!) ago..).
Thing was that I only had a high-poly model and a very low poly model, and both weren't very good for a straight import into Sacred 2.
'Took the high-poly model (from http://zayrcroft.deviantart.com/art/Rayne-Next-Gen-DL-310431350) & reduced it in 6 stages, from ~64000 polys to ~15000 polys.
I recolored some of the textures, because I don't like too much bright red on a model.
Here's my spin ("Rayne_as_HE.rar" in https://onedrive.live.com/?id=C74367DE5EF781A2%21150&cid=C74367DE5EF781A2):
For some time now I've done a few conversions of lady models from other games, demo's and examples.
Lately I added Maya from Borderlands 2 and Valkyrie Hana from Black Desert, and I thought I just like to share these screenshots.
Some of them have been added to the D2 mod, but others didn't quite make it.
I have no intention of publishing them as mods, but if you really want to try such a mod, then send me a PM.
I'll remove it..
I've put the tool here:
<Edit> Link removed.
You need this:
GR2 modding effort with Divinity: Original Sin:
This one's more Blender-friendly, but I don't know whether the GR2 files produced with it can be used in Sacred 2..
Wow, that's a very unusual edit, nice find!
The animation for 'Inferno' is new, isn't it?
Yes, congratulations are in place Flix!
And a very big thank you, for your enthusiasm and your effort. It's simply great and in my experience extraordinary to work with such talent!
Neith is ready as a replacement for the default seraphim:
(look for the file "Neith_as_Sera.rar").
No problem, just convert the sword from this model:
.. or DL here (for Sacred 2):
I have the model of 'worldweaver Neith' ready for Sacred 2:
But the default Neith I've just downloaded (http://lezisell.deviantart.com/art/Smite-Neith-pack-XPS-ONLY-468010862 right image).
It also has another version: http://lezisell.deviantart.com/art/Smite-Instakill-Neith-XPS-ONLY-560792101
I'll let you know when the default Neith is ready.