Monday, March 25, 2013

How to Rig a Poser Prop

This is going to be an overview of the steps and some of the tricks in turning a completed mesh into a pose-able item that will open in Poser or DAZStudio.

It assumes you have some familiarity with Poser, and a general comfort level in crawling inside huge blocks of markup text to make changes.  There are many ways to rig Poser items, and many tools that you may be able to use (depending on your platforms of availability); the below is simply the way I am most comfortable with.  It is relatively fast, and it gives me the degree of control I prefer.




First off -- prop or figure?


The way the Poser libraries work, you can place practically anything in practically any folder.  The major difference between prop (in the Poser file sense, aka a file ending in .pp2 or the compressed equivalent) and figure (aka a file ending in .cr2 or equivalent) is that a figure has multiple actors.  Aka, more than one body part.

The main advantage of a prop is that it can be smart-propped.  That is, it will react to the pose of a selected figure and snap to a desired location on that figure when loaded.  This is very handy (pun intended) for knives, bracelets, necklaces.  The main disadvantage to a prop is that the only moving parts possible are with morphs.

(There are two other technical issues with props.  Alternate geometry channels tend to break.  Pose files -- such as used to load textures in one click -- won't apply unless there is a figure also in the workspace.)

I build almost everything as figures.  This allows moving parts with rotating motions (which are hard to get with morphs).  And the lack of smart parenting is actually not that big a problem; you can build a semi-conforming prop that will "snap to" in exactly the same way as a smart prop; it only requires the end-user take the second step of conforming the prop to the desired figure.

I'll explain more about that trick later.



My next preference for props is extensive ERC.  In my current set, I have several gear boxes filled with moving gears.  Instead of rigging them so the end-user selects each gear and animates it in turn, I have hidden all the individual body parts and presented the end-user with but a single master control channel in the default actor.  That master channel operates all the gears, in synchronization.

I tend to dial-clean extensively; I hide all the dials that aren't useful (such as spinning the cylinder of a revolver at right angles to the gun), and re-name the dials that are to be used (such as "pressure" instead of "xRot" for the pointer on a gauge.)

The main tool to achieve this is a text editor.  I also make use of a very nice shareware tool from PhilC called "Poser Pocket Knife."  It runs in Poser Python right in the workspace.  You can do everything in text, but tools like PPK make it faster.



So let's to it.


There are essentially four ways to create a new figure.

1) Setup room.  I wish I could say more about this, because I don't use it.  I can do everything the room offers more accurately and efficiently using other tools.  (The Setup Room is really optimized towards humanoid figures and gets a little odd about something like an airplane or a monkey wrench).

2) Donor cr2.  This is the best way to rig conforming clothing.  You start with a "stripped" .cr2 (DAZ makes these available for their major figures).  You edit it to point at your clothing geometry.  I may go into detail in a later essay.

3) PHI.  Create a short text file in a specific format and, within the Poser workspace, use the "Convert heir file" command.  This is a more efficient way to rig custom figures with a large number of body parts -- I used it to create a pose-able moth some time back.

4) Hierarchy Room.  This is the method I'll be talking about.

To use the Hierachy Room method, you need to be able to select each intended body part in the Poser workspace.  The simplest way to do this is by importing each body part separately; each is then recognized by Poser as a "prop."  As an example, if you are rigging a pair of pliers, import "leftArmAndJaw" and "rightArmAndJaw" into Poser.


My modeling method gives me a single .obj file that contains the necessary groups already.  So what I typically do is import the .obj file, then open the Grouping Tool and use the command "Spawn Props."  That creates one prop for each group in the .obj file.  Then I delete the original prop from the workspace.
 

If you don't have a grouped object, you can attempt to group it within Poser.  The Grouping Tool will allow you to select individual vertices but it is difficult to be precise and complete with it.  Using the Setup Room, you can define bones and let Poser figure out the slicing.  This is just fine for organic figures, but works quite poorly on mechanical figures where different actors are not welded into a contiguous mesh, but act as distinct individuals within the workspace.

If you have a mesh of some complexity you have to group, the best place to do it is within a modeling application.  There, you can either export each selection as an individual model (and assemble them in Poser), or use what the application may call "Name polygon groups" or similar.

In the actual .obj file format, object group tags appear in the "faces" section of the file:
g  gear_box
usemtl tin
f 59/59/59 72/72/72 62/62/62 19/19/19
f 62/62/62 72/72/72 29/29/29 11/11/11
f 28/28/28 73/73/73 60/60/60 10/10/10
 The "usemtl" tag refers to materials, which can appear at any position within the "faces" section, and like the "g" tag applies to all polygons up to the next appearing tag of the same kind.

I mention this for two reasons.  One is that by opening the .obj file in a text editor you can confirm if your modeling application of choice is creating the right kind of tags.  The other is because neither modeling applications nor Poser are always respectful of the names...you may find, as I find, it is easier to fix some of the group and materials names in text rather than struggle with the application de jour.

(One "trick" I use a lot is that my modeling application creates "g" tags for everything that was an actor in its own workspace, regardless of grouping.  So when I open the .obj file in text, I take "porthole," "glass," "rivet_1," "rivet_2," "rivet_3" etc and rename them all "porthole."  They will then open as a single mesh object in Poser.)

(Re-grouping can also be done in Poser, by using the Grouping Tool.  Use the "Add Group" button and then "Create Prop" to make a new prop that contains all the selected props.)

(You can also adjust groups and materials zones within UVmapper -- a handy little free application for the Mac.)



Assuming every part you want control over is showing up as an individual prop within Poser.  Open the Hierarchy Window, drag them on to each other in the desired relationship; pick one part as the base, and for most props everything else will be a child of it.  For instance, a revolver might have "frame" as the base, "cylinder," "hammer," and "trigger" as children.  If it is a swing-out cylinder such as the Colt Police Positive, the nesting may be deeper; the "crane" is child of the "frame," and the "cylinder" is child of the "crane."

Think about the basic layout, and how much flexibility you may need later.  Basically, make a body part for anything you want to easily grab later.  You can always hide them from the end-user (they'll still show up in the Hierarchy Window for those power users among us.)

Here's something un-obvious.  If you have a complex prop that will be getting one little morph, slice off just the polygons that the morph will have to apply to, and make that a child part.  Now, the morph will be smaller, taking up less file space.

Here's another idea.  Instead of making a smart prop, add a laser sight to our putative handgun as another child.  Then by using "hide/unhide" (the visibility checkbox in the Poser workspace), you can customize the weapon on the fly.

It helps if you also set the rotation order at this stage.  Basically, pick the axis you think it most likely you will be spinning around, and drag that to the top of the rotation order.

Then hit the "Create New Figure" button.  A caution; the first figure is going to be a bit messy, and Poser can get antsy about opening it.  So quit Poser, re-start it on a clean workspace, then open the new figure.  Which, incidentally, is found at the root runtime under "new figures."  No -- you can't have Poser create it in the folder of your choice!



IF you intend your new figure to go into general distribution, the standard is external geometry.  The biggest drawback to the Hierarchy Room method is that Poser will stick all the geometry inline with the cr2.  External geometry is in my opinion much easier to work with.  It means you have a standard Wavefront .obj file that can be opened by a modeler for mesh repairs, or in a UVmapping application, and so forth.

There are tools to do this, but the old text editor makes quick work if you know what you are doing.

Here's the top part of a newly-created figure:

{
version
    {
    number 3.0
    }
actor BODY
    {
    }
actor handle
    {
    storageOffset 0 0 0
    geomCustom
        {
        numbVerts    3743
        numbTVerts    4212
        numbTSets     8128
        numbElems   2032
        numbSets    8128
        v 0.001643 0.323945 -0.000863
        v 0.001643 0.328677 -0.000863
        v 0.001895 0.328677 0.000400
        v 0.001895 0.323945 0.000400
And many, many more "v" lines to go!

The two things you need to do is delete everything that occurs inside "geomCustom {  }," replacing it with a pointer containing the name of the object group:

actor handle
    {
    storageOffset 0 0 0
    geomHandlerGeom 13 handle
    }
And add a file reference to the external geometry file in two places; at the top of the cr2 and directly following the actor definitions:

{
version
    {
    number 6
    }
figureResFile :Runtime:Geometries:Princess:Steam_Props:paramescope.obj
       
actor BODY
    {
    }
actor handle
    {
    storageOffset 0 0 0
    geomHandlerGeom 13 handle
    }
  ...

actor gear_one
    {
    storageOffset 0 0 0
    geomHandlerGeom 13 gear_one
    }   
actor gear_two
    {
    storageOffset 0 0 0
    geomHandlerGeom 13 gear_two
    }           
     
figureResFile :Runtime:Geometries:Princess:Steam_Props:paramescope.obj   

It is worth noting at this juncture that the geometry group name, the internal actor name, and the displayed actor name do not have to be the same.  The pointer line (geomHandlerGeom) is the only reference to the "g" tag of the .obj file.  However, there is no real benefit and much potential confusion in having them be different! 



You'll notice I glossed over a step.   What external geometry file?

If you were lucky and you had a perfectly sized and positioned mesh object already, then that is the answer.  If, however, you had to import from your modeling application and adjust it to properly fit the Poser universe, or worse yet Frankenstiened one out of a collection of random props, then the only accurate geometry is....that which is in the Poser workspace when you created your new figure.

Which makes the solution simple; select "Export Wavefront OBJ" from the "File" menu.  In the checkboxes, uncheck everything but "Include existing groups in polygon groups."

Oh...in the step before that, Poser will flash up what looks like the Hierarchy Window display.  Uncheck the Universe, then check back only those props that will actually be part of your final figure.  Don't include Ground -- you don't need it!

And before you can set the file location, you have to, well, create that location.  I find it easiest to either create a bunch of empty folders on the Desktop, or just copy a random Runtime directory and delete file in it.

This is the necessary skeleton of the directory:

:Runtime 
    :Geometries
        :myRevolver.obj
    :Libraries
        :character
            :myRevolver.cr2

Or in standard parlance, Runtime/Geometries/myRevolver.obj and Runtime/Libraries/character/myRevolver.cr2

You can nest within these folders; most vendors will have at least one deep (see the examples above).

So.  The big "Gotcha" here is that Poser doesn't know anything about workspace scaling.  When a figure .cr2 references an external geometry file, it treats the locations of the vertices in absolute space according to its own peculiar interpretation of scale.  The simplest way of achieving that correct scale -- and having the geometry appear in the correct location where it will look like you meant it to and all the joints will work correctly -- is by exporting a clean Wavefront .obj from Poser itself.




So.  Restart Poser, navigate to your newly-created figure/Runtime directory, and click.  If you've done everything right, the new figure will appear looking about the right size and without any missing body parts.  The tough part is over.

Well, not the tough part to do.  The tough part to learn.  This is where most of the pitfalls are.  The rest is mostly tweaking.

Now here's a tricky thing.  You can think of a .cr2 -- or any of the related family of Poser files -- as being markup language.  They aren't exactly code.  They are more like HTML.  Anyhow, the odd thing is that Poser doesn't just read them.  It interpolates them.  If you open a .cr2, and then save the figure back to the Poser directories, it will come back with a lot of lines that weren't there before.

This is sometimes a help.  Put the bare bones in, and Poser will flesh out the rest.  Delete all the materials from the .cr2; Poser will create new (randomly colored) materials from the "usemtl" tags it finds in the .obj file.  And at other times it is a hindrance!  As one for-instance, it doesn't matter what sensitivity you set on a morph dial; Poser will make up a new value at random when it loads the file.

Anyhow.  As an overview, the rest of the steps in creating your brand-new pose-able prop are:

1) Set joint centers
2) Adjust Joint Parameters
3) Set joint limits
4) Set preferences for smoothing and bending
5) Create morphs
6) Create ERC
7) Clean extraneous dials
8) Set materials

As one of those delightful Poser habits, the last step in creating a custom figure is to take the final saved .cr2 into a text editor and search-and-replace the Poser-created file paths with proper :Runtime originated paths.



And this is long enough for one entry.   Next entry will concentrate on JP's and how to achieve sliding motions in your pose-able prop.



3 comments:

  1. Good article until this point:
    The two things you need to do is delete everything that occurs inside "geomCustom { }," replacing it with a pointer containing the name of the object group:

    Where did the names like Princess:Steam_Props come form?
    Everything was easy to follow until then.

    ReplyDelete
    Replies
    1. Yeesh!

      I was trapped in the third-party cookie bug (along with half of Blogger's users...you'd think they might want to work on that!)

      And of course your profile has no available email or IM.

      Anyhow, belated answer. As explained earlier (either this post or one of the previous Poser posts), the folder names are user-created and arbitrary.

      The only necessary directory pointer is:

      figureResFile :
      the_prop.obj

      Poser begins search from the current Runtime directory, however, so it is best to at LEAST put the geometry in ":Runtime:the_prop.obj"

      The traditional location is inside the Geometries folder, which sits at the root of a Runtime folder. But, since you really don't want Poser to grab the first "a_ball.obj" it finds in a large Runtime, and you don't want to have to name EVERYTHING "my_other_ball_the_red_one.obj" then it makes sense to create a new folder inside the ":Runtime:Geometries" folder set.

      I happen to nest mine two deep; for no particular reason, everything I do is in a master folder containing my brand name, and then is within a folder within that with the current product name. You can nest as deep as your operating system will allow you, but two deep is plenty for most of us!

      Thus, you might chose ":Runtime:Geometries:My_stuff:My_current_project:my_prop.obj"

      Delete