Geometry + Rig / RefModels in 6.0

February 1st, 2007 by Helge Mathee - Viewed 12126 times -




After a couple of chit chats about referenced models in 6.0, I would take to take a few minutes to explain how you can use the delta referencing system to separate rig and geometry into two different files, which can be edited independently from one another.

geo_rig_ref.jpg


Okay so here’s how it works:

  1. Create your geometry and rig
  2. Put rig and geometry into two different models
  3. Create the connection (envelope, constraints etc)
  4. Export FIRST the geometry, and SECOND the rig.
  5. Go to a new scene and import FIRST the rig and SECOND the geometry as referenced models.
  6. To ensure the models are loaded in the right order in the future, also name them alphabetically in that order. (in my example I am using numbers to set that order)
  7. Put both ref models into a new one and export it as the “fullmodel”.

You end up with three files. The first one includes just the geometry + envelope operator and weightmaps, the second one includes just the rig, and the third one, the “fullmodel”, includes just two file pointers to the previous two.

If you want to go ahead and make changes to the rig, you can externally, while just loading the rig up and modify it. If you are about to change the geometry, and you don’t want to loose the envelope, just open up the fullmodel, localize the submodels and do your edits, afterwards convert the geometry back to referenced, and reload the “fullmodel”.

Below you can see a working example in the explorer, and a repro script to generate this setup. All steps (also changes on the geometry after the connection has been established) are part of that script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var project = ActiveProject.path;
NewScene(false,false);
 
// create objects
CreatePrim("Cylinder", "MeshSurface");
Create2DSkeleton(0, 3, 0, 0, 0, 0.5);
AppendBone("eff", 0, -3, 0);
 
// create models
CreateModel("root", "_0rig");
CreateModel("cylinder", "_1geo");
 
// reset the transform of the models so
// they are in the center of the world
SetUserPref("SI3D_NODETRANSFORM_CHILD_COMPENSATE", 1);
ResetTransform("_0rig", siObj, siSRT, siXYZ);
SetUserPref("SI3D_NODETRANSFORM_CHILD_COMPENSATE", 0);
 
// create the envelope (connect the rig)
ApplyFlexEnv(
"_1geo.cylinder;"+
"_0rig.bone,_0rig.bone1"
);
 
// export to files
ExportModel("_1geo", project+"\\Models\\geo.emdl");
ExportModel("_0rig", project+"\\Models\\rig.emdl");
 
// new scene
NewScene(false,false);
 
// import both as referenced
SICreateRefModel(project+"\\Models\\rig.emdl", "_0rig");
SICreateRefModel(project+"\\Models\\geo.emdl", "_1geo");
 
// create a new model including both
CreateModel("_0rig,_1geo", "fullmodel");
 
// export this model again
ExportModel("fullmodel", project+"\\Models\\fullmodel.emdl");
 
// new scene
NewScene(false,false);
 
// import the fully rigged, separated model as referenced
SICreateRefModel(project+"\\Models\\fullmodel.emdl", "fullmodel");
 
// change the geometry while maintaining the connection
MakeModelLocal("_0rig", null);
MakeModelLocal("_1geo", null);
Translate("_1geo.cylinder.edge[67]", 0,0, -1.5);
ConvertToRefModel("_1geo", project + "\\Models\\geo.emdl");
 
// reload the full model
UpdateReferencedModel("fullmodel");

Here’s a link to the script file so you can download it and try it out.

I hope this helps!
Helge

4 Responses to “Geometry + Rig / RefModels in 6.0”

  1. Helge Mathee says:

    Just wanted to mention, using the technique above you can also create multiple different geometry resolutions which all connect to the same rig, which you can choose using the active resolution of the “_1geo” model in this example.

  2. Daniele Niero says:

    Hi Helge,

    This is ok, but unfortunately when two or more “fullmodel” are imported in a scene, the geometry models are all connected to the first rig model imported. I guess this because these new models, like the old ones, don’t support “namespaces”, am I correct?

    We can always fix it changing by hand the “Models to Reconnect to” parameter, and point to the correct model. This probably is also an easy task for who has a medium technical and scripting knowledge in XSI, but still potentially a huge problem for all the rest.

    Anyway, the new models are ten times better then the old ones.

    Daniele

  3. Ahmed Barakat says:

    i did try this before reading this post as a part of testing the new refmodels and delta but with no success
    stupid me didn’t think off the loading order this completely slipped my mind

    thanks helge

  4. David says:

    This sounds powerful, yet a bit daring :P
    I’ve used reference models extensively in production, quite a boost in speed and productivity.
    Yet, we only used one resolution which contained two groups that had the high res and the low res rigs separate, then with a button, I would then switch between them :P
    in XSI 4 you had a problem when you loaded a low res model with no shape clips and then created a high res with the shape clips, they would not load :( so that spooked the guys at my studio and we never played with that again in 5.
    This sounds cool tho.
    GO XSI GO!!!