Jump to content
Hash, Inc. Forums

he Install Rig Part II - Constraint Compensate Offsets.


rickh

Recommended Posts

When a rig is installed into a new character model, there are usually lots of constraint compensate offsets that have to be reset so that bones do not move when the model is put in an action or choreography window.

 

For very complex rigs like the Squetch rig, resetting all these offsets can be an extremely daunting task. You have to switch the poses first to particular modes before adjusting a constraint's offsets, you often have multiple constraints on each bone and so you may have to set them all to 0% first. You can easily make a typing mistake when you a returning the constraint back to its intended enforcement percentage. In the case where bone has two identical contstraints each to a different target, the method you need to correctly reset the offsets is particularly wierd and wonderful.

 

And to top it all off, if the target bone itself was out of positon (becuase the target bone, a parent or a bone controlling via an expression has an unreset constraint offset), then all that effort was a waste fo time and all the new compensate mode offsets will be wrong.

 

I was trying to work out how to eliminate the need to have to reset these offsets using the install rig, and it struck me that the problem is this is wrong way to set the offsets completely.

 

For 99.9% of situations what we want is offsets based on the constrained bone and the target bones position in the modelling window - not their altered position in the action window. In fact, this could be something automatically calculated without any need for us to set the offsets at all! For most cases, the correct bone compenstate mode offset is something that should be calculated in total isolation without the effects of any other constraint, bone movement, expression or anything else.

 

An action windows is just not the right plae for this to be done.

 

One solution would be for someone to write a plugin to take a model and based on the bones edsignated postions in the model, calculate all the offsets for all constraints if, say, a bone had "_OFFSET_" in its name.

 

Volunteers?

 

As a nicer solution that I have suggested to Hash that they add a "Auto Offset" tick box to all constraints which, when ticked, will just calculate offsets based on the modell's bone postions automatically. This will calculate the offset correctly, even if the enforcement is set to 0%.

 

I believe this would mean we would never have to touch constraint offsets again during the rigging process.

 

For any of the Hash Fellows who want to view my proposals in reports, my reports username is "rickh" and the reports are:

 

0003920 Adding an "Auto-Offset" tickbox to constraints

0003919 Incorporating the Install Rig Plugin Into A:M

 

Have I got this all wrong somehow?

 

Richard Harrowell.

Link to comment
Share on other sites

In case an case anyone is wondering why I added this issue to the Install Rig discussion - my suggestion is really based on having the "Install Rig Plugin" functionality.

 

Before the plugin, when rig is installed in a new character, some of the control bones may only point in the correct positions after they go into an action window.

 

Say for example you had a bone whose purpose was to aim at the ankle joint and then you had geometry bones contstrained with compensate mode offsets to this pointer bone.

 

Pre-"Install Rig", you need the Aim at Ankle constraint to be working before you adjusted the geometry bone constraints.

 

Now we have the Install Rig Plugin, it is easy to ensure that this pointer bone does point exactly to the ankle in the modelling window, no matter what geometry the new character model has.

 

 

Richard Harrowell.

Link to comment
Share on other sites

I've suggested plugin - type help for this same problem... If one follows movie tutorials it just turns out that there are way too many bones to re - compensate... I have installed the rig in one of my characters and (no re- compensating of the constraints) everything seems to work fine, but then there are some unussual and quirky movements...

 

I don't know if that has something to do with this or it was mistake somewhere else, but automatic re-compensating of the constraints would save loads of work...

Link to comment
Share on other sites

If one follows movie tutorials it just turns out that there are way too many bones to re - compensate... I have installed the rig in one of my characters and (no re- compensating of the constraints) everything seems to work fine, but then there are some unussual and quirky movements...

 

With the current way of resetting compensate mode offsets, you do have to have a lot of familiarity with how the model works.

 

Basically is is useless resetting some offsets before you have reset compensation on all the target bones, but how does a beginner know what order is needed? The squetch rig is particularly confusing because it has FK/IK switches. So, for example, there are offsets in the leg dependant on correct offsets in the foot and there are offsets on the foot dependant on correct offsets in the leg.

 

Some rigs are easy because they have a pose switch that turns off all constraints, and then you can just go straight to relationships in the PWS and just go down through the list resetting all the offsets. Boring, but it can be done fairly fast.

 

This approach doesn't work in many of the complex rigs though and that really slows the job down.

 

Richard Harrowell.

Link to comment
Share on other sites

An automatic way to reset compensates was something I asked about because of how many there are in the Squetch Rig, Richard. Since I'm not a programmer, I have no idea how hard it would be to code. There are still a couple of places that I'm pretty sure you would have to set manually even if there were an automated way...like the IK thigh and bicep. For those, you want compensate on the 'Y' and 'Z', but not on the 'X' axis.

 

I guess that making a switch or something that changes the rotation of any bone in all constraints in a pose to "0" on all axes (both on and off) would do it...except for the IK thigh and bicep. That makes sense to me, but it may not make sense in a programming context.

Link to comment
Share on other sites

I had a quick look at the SDk and in HConstra.h , there are function calls to read the offset values in constraints but not ones to write the values.

 

I do not know about the SDK enough to say whether there is another way to write to the offset values.

 

I was thinking of trying out the idea by just extracting the bone coordinates from the .mdl file, calculating the requied offsets, and adding the offsets back into the mdl file.

 

Definitely not a good permanent solution but it would test the concept.

 

Richard Harrowell.

Link to comment
Share on other sites

I've tried do analyze compensated and not compensated mdl file (just two bones in the model) but it turns that it is above my knowlege (or perhaps beyond my ability to understand) anyway, I am eagerly awaiting new developments

 

The way to undersand it is to start off with extremely simply models.

 

Taking a V13 .MDL format, for example, the first thing you need is to find the bone positions and orientations.

 

There will be a section in the MDL file starting with <BONES> and ending with </BONES> - that where you find all the bones info. In this part of the file, look for something like this

 

 
<SEGMENT>
Name=Bone1
BoneColor=255 0 0 255
Start=0 0.586933 -1.86697e-007
Rotate=-0.707012 0.0115449 -0.0115449 0.707012
Length=10.864
</SEGMENT>

 

That is the bone position, orientation and length. It looks like the End position is not stored - it is calculated.

 

IE Start: X = 0.0 Y = 0.58693 Z = -1.86697e-007 (close enough to 0.0)

Rotate: X = -0.707012 Y = 0.0115449 Z = -0.0115449 W = 0.707012

Length=10.864

 

Now here is a typical ordinary constraint - an Orient Like constraint for Bone3:

 

<OBJECTSHORTCUT>  
MatchName=Bone3  
<ORIENTLIKECONSTRAINT>  
BoneTarget=..|Bone1  
<CHANNELDRIVER>  
atchName=Enforcement  Interpolation=1  
<SPLINE>  
1 0 0  
1 1:40:0 100  
</SPLINE>  
</CHANNELDRIVER>  
</ORIENTLIKECONSTRAINT>  
</OBJECTSHORTCUT>  

]

 

 

The bit in the <SPLINE> section means that when the ON/OFF pose containing this constraint is at OFF (0%) , the enforcement should have a value of zero. When the Pose is at ON (100% = 100 seconds = 1:40), the enforcement should be at 100%.

 

The last issue is "what does an compensate mode offset entry look like?"

 

For the orientlike constraint between </CHANNELDRIVER> and </ORIENTLIKECONSTRAINT> , there are extra lines like this:

 

<QUATERNIONROTATEDRIVER>
MatchName=Rotate
<CHANNELDRIVER>
MatchName=X
<SPLINE>
1 0 0
1 1:40:0 20.9124
</SPLINE>
</CHANNELDRIVER>
<CHANNELDRIVER>
MatchName=Y
<SPLINE>
1 0 0
1 1:40:0 57.761
</SPLINE>
</CHANNELDRIVER>
<CHANNELDRIVER>
MatchName=Z
<SPLINE>
1 0 0
1 1:40:0 26.862
</SPLINE>
</CHANNELDRIVER>
<CHANNELDRIVER>
MatchName=W
<SPLINE>
1 0 100
1 1:40:0 74.1942
</SPLINE>
</CHANNELDRIVER>
</QUATERNIONROTATEDRIVER>

 

 

From this, you get the information that the offset is stored in Quaternion format and for this bone, the rotational offset is:

 

X = 20.9124 Y = 57.761 Z = 26.862 W = 74.1942

 

This offset is equal to the angle you would have to the transform rotate the bone would have in an action if it had the same constraint without any offset.

 

So basically it comes down to calculating the amount of Quaternion rotation to get one bone to rotate to match the alignment of the target bone. If you can do this, then a program has to just fit the result back into a <QUATERNIONROTATEDRIVER> section for a bone.

 

Each different type of constraint will probably need a to be handled seperately in this program.

 

Why this approach is a bad long term solution is that at any time, Hash might add new features that might break a program that tries to work with the MDL format.

 

Using the SDK is the right way of doing things like this - if the SDK actually allows the Constraint offsets to be overwritten.

 

I hope that is a start.

 

Richard Harrowell.

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...