Using DAZ Studio to Create Characters and Animation

From Multiverse

Jump to: navigation, search

DAZ Studio is 3D Character modeling and animating software. It is free for download from their site. It has thousands of users and loads of free and reasonably priced content for 3D worlds. This tutorial will show you how to use DAZ Studio to export a 3D Character with animations to Multiverse and place it in your world as a selectable character. It will not go in detail on how to use DAZ, as there are many great tutorials on the web and included with the software for the overall use of the tool. It will describe how to take these assets in DAZ and get them to MV. This will require some tweaks to a couple of Multiverse python programs to make work correctly and I have included this new code within the article.

Contents

Creating initial character

To create a character model:

  1. Start DAZ Studio.
  2. Import a model and rig it. For the model, you can use one of the models provided with DAZ or purchase one of the DAZ starter kits with models. This tutorial uses the standard Second Life avatar that is publicly available as a poser model, shown here.

You can download the meshes and OBJ files from here: http://secondlife.com/community/avatar.php


Image:DazImage1.jpg

You can modify this character as you wish in DAZ, but, for this tutorial I will take it "as is".

Exporting the model to COLLADA format

To export a model, simply choose File | Export.


Image:DazImage2.jpg

Export the character to a COLLADA (.dae) file. I called it testmale.dae. Just accept the defaults when asked for options.

The current DAZ exporter has a limit of 1001 polygons per submesh it builds. This will really screw things up later. So you must go into the DAE model that was exported and join any submeshes that share a given material. For example, in the model I exported it ended up creating six sub-meshes. Three shared material1 and two shared material2 and only one submesh used material0. I went into the DAE and just combined the three submeshes into one for material1 and the two submeshes into one for material2. It took five minutes, but, it will allow you to fit clothes properly to the model as described in a later tutorial.


Image:DazImage3.jpg

Importing the model

Use the Multiverse COLLADA Import Tool to convert the .dae file to Multiverse format and import it into your Multiverse asset repository. Select to create mesh, material, skeleton, physics and textures.


Image:DazImage4.jpg

You could bring the mesh in world as an asset if you just want to take a look at it at this point by importing using the asset importer. But, we want to use it as a player character. So, we need to do some more things.

Create Animation for Character

Animations are attached to characters through their skeleton. So, in this portion of the tutorial we will add an animation to our DAZ character and import it into Multiverse. When first adding a character you should create an animation named "idle". This is because the Character Factory and Sample Character Creation is expecting to have an idle animation when characters are first displayed for selection on the first screen you see when running the Multiverse Client for your world.

Since my character I am using was a Second Life avatar derivative there are literally hundreds of BVH animation files available for it. The Biovision Hierarchy (BVH) character animation file format was originally developed by Biovision, a motion capture services company (now defunct), as a way to provide motion capture data to their customers. It is a type of animation known as key frame animation. While I am using existing BVH files in this tutorial, you could just create your own inside of DAZ using their Puppeteer tool.

Get back into DAZ with your model of your character shown in the main window. Now go to the File / Import selection and search for and select BVH files. Select a BVH file. Just choose the defaults from the options on the import. I chose an idle animation that was the character talking. My avatar will be much like myself in real life. I never shut up!


Image:DazImage5.jpg


After you import the BVH file you need to test it in the DAZ. You do this by selecting View / Tabs / Timeline. That will pop up a timeline control. It has options for loop, rewind, play and fast forward. Just choose play to see the animation in action.


Image:DazImage6.jpg


Image:DazImage7.jpg


Now that you have created and tested an animation for your character in DAZ you need to get animation integrated into your Multiverse Avatar. You do this by first exporting the DAZ Character with the animation to a new DAZ File. I named the file testidle.dae. Now you need to create a batch file that you will use over and over for creating animations. Get into your Multiverse Tools / Multiverse Model Viewer directory. Copy your skeleton file named testmale.skeleton from your skeletons folder in your Multiverse Client/ Worlds/ <yourworld> folder. Also, copy the DAE file for your animation that you just created named testidle.dae into the Multiverse Tools / Multiverse Model Viewer directory.. Now create a batch file named testAnim.bat in the Multiverse Tools / Multiverse Model Viewer directory.. Enter the following as the command:

ConversionTool --base_skeleton testmale.skeleton --animation idle testidle.dae --out_skeleton testmale.skeleton

This will call Conversion Tool and apply the animation in the testidle DAE file and save it as a new skeleton file, I used the same name testmale.skeleton so it just saves over the original skeleton file. The parameter after the --animation is the name that you want to use for the animation in Multiverse. I used the same name testmale.skeleton. After this batch file runs your skeleton now has the idle animation. This overall process is described of adding animations with Conversion tool is discussed in http://update.multiverse.net/wiki/index.php/Model_Conversion_Tool. Now copy the testmale.skeleton back into Multiverse Client/ Worlds/ <yourworld>/ Skeleton over your old skeleton file.

You can test this new testmale model with it's animation using model viewer. Get into model viewer and load your testmale mesh. Click on the animation tab. You should see the idle animation listed. Click on the animation name to highlight and then click play and watch your model do the animation.


Image:DazImage8.jpg

Follow the same process to add more animations. As a minimum, you need to add a walk animation so that your avatar will look fairly normal when you first bring it into your world to test it. Always remember to copy the skeleton back to your world to make sure it gets the animations.

Putting Your Character in the Character Selection Screen

This next section will talk about how to get this animated character into your character creation factory and then into your game. The current Character_Factory and SampleCharacterCreation python code was written to utilize the characters that have been brought in following a specific exacting format. Unfortunately, your DAZ avatar you just created will not follow this format because of some things that ConversionTool did when creating the mesh in terms of naming submeshes. So, I have rewritten parts of SampleCharacterCreation.py and Character_Factory.py to be more generic and handle both the default Multiverse Characters from Sample World and any other character you bring in from tools like DAZ. You can get this code at http://mymultiverse.com/download/.


Once you have downloaded this code and installed it over the existing code, you will need to change it. First go into SampleCharacterCreation.py and find the meshInfo variable at the top of the program.

meshInfo = { "human_female.mesh" : [[ "bodyShape-lib.0", "human_female.skin_material" ],
                                    [ "head_aShape-lib.0", "human_female.head_a_material" ],
                                    [ "hair_bShape-lib.0", "human_female.hair_b_material" ]], 
             "human_male.mesh" : [[ "bodyShape-lib.0", "human_male.skin_material" ],
                                  [ "head_aShape-lib.0", "human_male.head_a_material" ]]}

Now get back into the Model Viewer and open your mesh. Go to the submeshes tab. For each, submesh look at the bottom of the screen and write down the mesh name and the material name.

Image:DazImage9.jpg

Now create your meshInfo information and insert it into the variable as follows:

meshInfo = { "human_female.mesh" : [[ "bodyShape-lib.0", "human_female.skin_material" ],
                                    [ "head_aShape-lib.0", "human_female.head_a_material" ],
                                    [ "hair_bShape-lib.0", "human_female.hair_b_material" ]], 
             "human_male.mesh" : [[ "bodyShape-lib.0", "human_male.skin_material" ],
                                  [ "head_aShape-lib.0", "human_male.head_a_material" ]],
            "testmale.mesh" : [[ "geometry.1", "testmale.Material_lowerbody" ],
                                [ "geometry.0", "testmale.Material_Upperbody" ],
                                [ "geometry.2", "testmale.Material_Head" ]]} 

Now cut and paste this meshInfo variable setting code from SampleCharacterCreation and paste it over the code in Character_Factory.py. Save both these files. Go back into SampleCharacterCreation.py and add the following code to make your model selectable.

original code:

       self._male_models = [ 'human_male.mesh' ] 

modified code:

       self._male_models = [ 'human_male.mesh' , 'testmale.mesh' ] 

Save the python file. At this point, if you had brought in the modified code and then made the modifications for your new character you should be able to go into Multiverse and when you hit create in the login screens and then toggle through the male models, you should should see two models with the second one being yours. If you didn't use the modified code from me it will not work because the current SampleCharacterCreation.py file in the distributions doesn't work for adding more than one character per sex.

If this is a new animation that is not one of the default animations, such as walk, run or idle, you need to add a client command handler to the extensions_proxy.py as described in Defining Command Handlers. I have done this and added a number of animations. It is fairly straightforward to do.

Summary

At this point, you have:

  1. Created a character in DAZ,
  2. Exported it as a Collada DAE,
  3. Imported it into Multiverse as a mesh, material and skeleton,
  4. Created an animated character in DAZ using an imported BVH file
  5. Exported the animation as a Collada DAE
  6. Created and run a batch file that adds the animation to the original Multiverse skeleton
  7. Gotten and installed my more generic versions of SampleCharacterCreation.py and Character_Factory.py
  8. Modified the python scripts to use your created characters by identifying new displayContexts
  9. Added a Client Command Handler for the animation if it is not a standard animation name
  10. And lastly have a new character type from DAZ with animations successfully in Multiverse for players to choose from

This took me a couple of weeks to figure out, so any questions, just message me in the forums. How I have used this in action is I generally get all my animations for my character done in DAZ to start with. Then I write a pretty big animation batch file with all the skeleton creations in it. I will tend to reuse this batch file over and over, as I will create many characters but still want to reuse the animations on all of them. This way I can have many different looking characters, but, they all have the same movements in-world.

I may go make a Mindies add-in named DAZ2MV like the Blend2MV, SU2MV and SL2Blend to automate this somewhat laborious task. If I do, I will publish it for everyones' use.

Personal tools