Ready to use models with animations


#1

Mixamo characters with animations ready for use for Urho3D - https://github.com/Lumak/Urho3D-Assets/tree/master/Models
How to get mixamo char/anims - page2 of this thread.

notes:

  • the model faces the opposite Z direction, so you’ll need to spin it by 180
  • avoid adjusting the “Head” node due to the above reason (or just fix it)
    **How to spin your char by 180 - note: this change, along with the Mutant char, was added to Urho3D/master as of August 16, 2016.

models:

AssetImporter:
Modified AssetImporter to suppress “$AssimpFbx$” nodes that’s generated for Mixamo characters. Of course, this works for all fbx files.
The option is now enabled by default. To disable it, use:

AssetImporter model <input file.fbx> <output file> -np
AssetImporter anim <input file.fbx> <output file>  -np

This was added to Urho3D/master, Aug 22, 2016.

Edit: added info about the assetImporter merge.


#2

the model faces the opposite Z direction, so you’ll need to spin it by 180

If u use Blender exporter, you can choose forward direction for result model


#3

Thanks for sharing! i guess this useful for prototyping game


#4

This is great, but way more useful would be to know method how you did it. There are tons of animations and we would love to be able to do same thing for other animations ourselves. Naive attempt i tried (just converting fbx to mdl/ani) did not produce a working animations.


#5

[quote=“1vanK”]
If u use Blender exporter, you can choose forward direction for result model[/quote]
That’s good to know, but I primarily use Maya LT to retarget animations. I could probably figure out how to do it in Maya, but adding an adjustNode to spin it 180 is simple to do…

It might become more beneficial than just for prototyping when I provide skeleton.fbx files.

I discover that most models on the site have pivot rotation which causes “$AssimpFbx$” node insertion. This ends up inflating the skeleton bone count - I had a few models that ended up with 200+ bones! To correct it, you’ll have to zero out the rotation pivot, but take the rotation pivot value and add it to the transform rotation field. Essentially, you’re elevating the rotation pivot to its parent transform.

note
Added another model to the repository and run anim for x_bot.


#6

I have completed the Swat standing rifle pack animations. I know there are at least three ppl making a shooter game in the community, hope these animations help.

Edit: link https://github.com/Lumak/Urho3D-Assets/tree/master/Models/Swat


#7

Added Mutant model/anim https://github.com/Lumak/Urho3D-Assets/tree/master/Models/Mutant.


#8

If possible, including source fbx/blend/collada in repo with import settings documented would be great for being able to import/export to future mdl runtime representations or asset importer improvements.

EDIT: Noting probably not possible due to source of files :slight_smile:

EDIT2: Looks like github.com/Lumak/Urho3D-Assets/ … els/Mutant needs a LICENSE.TXT

Thanks! Great stuff!


#9

mutant/license.txt added along with a few more anim files.

I’ve added _skeleton.fbx file for each model which can be used to skin your own custom mesh **(acian uses x_bot) .


#10

[quote=“jenge”]If possible, including source fbx/blend/collada in repo with import settings documented would be great for being able to import/export to future mdl runtime representations or asset importer improvements.

EDIT: Noting probably not possible due to source of files :slight_smile:

EDIT2: Looks like github.com/Lumak/Urho3D-Assets/ … els/Mutant needs a LICENSE.TXT

Thanks! Great stuff![/quote]

That indeed would be great so we could replicate the process ourselves. Lumak either seems to not be interested in telling us how to do that or we are having some miscommunication here since i already asked for same thing in my previous post.

Btw Lumak arent all mixamo models using same skeleton?


#11

[quote=“rku”]
That indeed would be great so we could replicate the process ourselves. Lumak either seems to not be interested in telling us how to do that or we are having some miscommunication here since i already asked for same thing in my previous post.
Btw Lumak arent all mixamo models using same skeleton?[/quote]

On the contrary, I have shared my process on how I did it and are described in my reply to you in this post and in http://discourse.urho3d.io/t/mixamo-animations-characters-free/1999/1. I will reiterate it here but in a step-by-step manner for clarity. But before I do, let me clarify/answer a couple of things:

  1. As jenge himself realized, mixamo license prohibits distribution of character/animation file in editable format. And this restriction is the only reason I cannot provide model.fbx or animation.fbx files in the repository.
  2. “Do models use same skeleton?” - They are not the same. While the base joint names are the same, i.e. named as “Hip”, “Neck”, etc., some models have different prefix added to the base, e.g. “mixamorig:Head”, “swat:Head”, “Mutant:Head”, etc.

Mixamo character/animation port process using Maya

As I mentioned numerous times in my posts, I use Maya LT for the porting process. I will describe this process first then will describe what I discovered just using the animation mapping process in mixamo.com.

  1. prerequisite: have Maya or Maya LT installed

  2. goto mixamo.com and download your model.fbx (t-pose) and animation set (or single animation) in .fbx format.

  3. open your model.fbx in maya, open HumanIK editor, choose Create Character Definition, map all joints of your model to the character definition until it becomes “green” lit -> save your model file (maya format) -> export as fbx format with animation box unchecked.
    note1 clear any non-zero pivot rotation - the values found “jointOrientation” needs to be elevated to the parent transform, i.e. add it to the transfrom field for the same joing.
    note2 even doing note1 sometimes result in wonky animation. If this happens, you’ll need to reskin the model or replace the rig(skeleton) with a known working rig and re-skin.

  4. for each animation that you want to port, open the animation.fbx file in maya, goto frame -1 (negative 1) and set it to t-pose (frame -1 because animations typically start at frame 0), key all your joints in frame -1, open HumanIK editor, select Create Character Definition, map all joints -> save the file (maya format).

  5. open your saved maya model file,
    from the file explorer drag in your saved animation file into maya,
    in the HumanIK editor- character control panel, select “Character:” as your model’s character, select “Source:” as the animation’s character
    set the key frame range of the animation
    in HumanIK, choose Bake > Bake To Skeleton
    delete the animation rig
    save the file as model_animation or w/e
    export to .fbx file format, w/ the animation box checked

  6. using AssetImporter and arguments:
    for model - AssetImporter model your_model.fbx output_file.mdl
    for animation - AssetImporter anim your_model_animation.fbx output_animation_file.anim
    note output file will contain something like “Take-00” or w/e, remove that and rename it as ouput_animfile.anim
    note2 you may have to use an additional option -t to Generate tangents for models with normal bump map


Porting character/animation right out of mixamo.com

I have not done this process until just a few minutes ago, and it seemed to work.

  1. goto mixamo.com -> Browse Animation -> select “Creature Pack” as an example
  2. At the right of the window, it shows “19 animation in Creature Pack on X Bot” (for me at least), click on “Change Character” and select the Mutant character.
  3. click on the “Add To My Assets” button, once it completes the button changes to “View/Download” -> click it
  4. on the left side of the window there’s a check box next to the trash can, selecting it will select your animation(s) -> click Queue Download -> pop up confirmation : .fbx, t-pose , and every other option as default
  5. once the progress completes, check your animation, click download.
  6. unzip your In_Progress.zip (following the creature pack/mutant example got me this file)
  7. using AssetImporter and arguments:
    for model - AssetImporter model Mutant.fbx output_file.mdl
    for animation - AssetImporter anim mutant_idle.fbx Mutant_Idle.anim
    note the output file will contain a string “_mixamo.com.ani”, just remove the "_mixamo.com"
    note2 you may have to use an additional option -t ->Generate tangents for models with normal bump map

things to do outside of assetImporter

  1. you’ll need to extract the textures using something like Blender. I did this once but I think it was: choose geom > material > output texture (can’t remember exactly)
  2. the model in Urho3D is huge - scaled by 100 from the looks of it - fix this in Blender or scale the node by 0.01f (this works properly)
  3. some animations have root motion - fix it in Blender

I hope this wall of text helps.

Edit: clearing pivot rotation needs to happen in Maya step 2, not 3
Edit: added scaling info in *problems 2)
Edit: added info about additional option -t using the assetImporter for normal bump map


#12

No one asked how to spin your model by 180 in code. I guess everyone already knows how to do this, but here is how-to for some who don’t know.

Using 18_CharacterDemo, snippets of relevant sections.

Spinning your model by 180 in code

CharacterDemo.cpp

void CharacterDemo::CreateCharacter()
{
    ResourceCache* cache = GetSubsystem<ResourceCache>();

    Node* objectNode = scene_->CreateChild("Jack");
    objectNode->SetPosition(Vector3(0.0f, 1.0f, 0.0f));

    // rotate model by 180 ****************************
    Node* adjustNode = objectNode->CreateChild("AdjNode");
    Quaternion qAdjRot(180, Vector3(0,1,0) ); // rotate it by 180 
    adjustNode->SetRotation( qAdjRot );

    // Create the rendering component + animation controller
    AnimatedModel* object = adjustNode->CreateComponent<AnimatedModel>();

    //********************* change the model and material name
    object->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
    object->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
    object->SetCastShadows(true);

    adjustNode->CreateComponent<AnimationController>();

      // ******************** rename it to proper head joint name // Set the head bone for manual control
    object->GetSkeleton().GetBone("Bip01_Head")->animated_ = false;

. . .
}
void CharacterDemo::HandlePostUpdate(StringHash eventType, VariantMap& eventData)
{
    if (!character_)
        return;

    Node* characterNode = character_->GetNode();

    // Get camera lookat dir from character yaw + pitch
    Quaternion rot = characterNode->GetRotation();
    Quaternion dir = rot * Quaternion(character_->controls_.pitch_, Vector3::RIGHT);

    // ************* rename it to proper head joint name // Turn head to camera pitch, but limit to avoid unnatural animation
    Node* headNode = characterNode->GetChild("Bip01_Head", true);
    float limitPitch = Clamp(character_->controls_.pitch_, -45.0f, 45.0f);
    Quaternion headDir = rot * Quaternion(limitPitch, Vector3(1.0f, 0.0f, 0.0f));
    // This could be expanded to look at an arbitrary target, now just look at a point in front
    Vector3 headWorldTarget = headNode->GetWorldPosition() + headDir * Vector3(0.0f, 0.0f, -1.0f); // -z direction ****************************
    headNode->LookAt(headWorldTarget, Vector3(0.0f, 1.0f, 0.0f));
    // Correct head orientation because LookAt assumes Z = forward, but the bone has been authored differently (Y = forward)
//    headNode->Rotate(Quaternion(0.0f, 90.0f, 90.0f)); //************************* dont need this

. . . 
}

Character.cpp

void Character::FixedUpdate(float timeStep)
{
    /// \todo Could cache the components for faster access instead of finding them each frame
    RigidBody* body = GetComponent<RigidBody>();
    AnimationController* animCtrl = node_->GetComponent<AnimationController>(true); //********** recursive get

. . . 
}

Edit: changed comment to “recursive get”


#13

Wow, great docs on the model import process! High quality 3D models have always been one of the most challenging assets for projects. This is really awesome. thanks for the models and trailblazing the process :smiley:


#14

You’re welcome.

I was really surprised by how easy it was to download then import character/animations using the Porting character/animation right out of mixamo.com method.
It was my first attempt and didn’t expect to have an animating character in Urho3D following this process**. Can’t get any easier than that!

Edit: **rephrased


#15

Great work Lumark!! This is just what I need

Unfortunately when I import the models into the editor and setup the materials I get an unlit material like shown below


When I edited the material’s technique from “Techniques/DiffNormalSpec.xml” to “Techniques/DiffNormalSpecEmissive.xml” it seemed to correct but I noticed that it flickers on and off based on camera angle.

I honestly have no idea what is going on and I really need to use these models, most importantly their animations :frowning:


#16

i found that the models from that were in the repo, were not compatible with the latest version of github, as they were missing vertex declarations.

to test, don’t supply a material when using, and it will use the default white material.

i had to export the models myself, which given the above process was simple! (GREAT job btw).

Once i got the steps down, it was easy to follow and import.

I now can test a handful of things i have been wanting, but couldn’t because of lack of animation skill.


#17

Current Urho runtime code should load both the old & new models, that means without or with vertex declarations.

Where exactly did you run into trouble?


#18

If you use the “Mutant” model as an example.

The material provided has a technique of DiffNormal.xml, this will render no model, but the shadow is animated.

If you modified the material to be just Diff.xml, the model will render properly (just not with a normal).

If you enable D3D11_CREATE_DEVICE_DEBUG, you get the following output

D3D11 WARNING: ID3D11Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'BLENDINDICES'/0 and component(s) of the type 'int32'. However, the matching entry in the Input Layout declaration, element[6], specifies mismatched format: 'R8G8B8A8_UINT'. This is not an error, since behavior is well defined: The element format determines what data conversion algorithm gets applied before it shows up in a shader register. Independently, the shader input signature defines how the shader will interpret the data that has been placed in its input registers, with no change in the bits stored. It is valid for the application to reinterpret data as a different type once it is in the vertex shader, so this warning is issued just in case reinterpretation was not intended by the author. [ STATE_CREATION WARNING #391: CREATEINPUTLAYOUT_TYPE_MISMATCH] D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]

If you run the fbx model provided by mixamo thru the AssetImporter, then the model will just drop right in properly.

Hope this helps


#19

That’s probably from missing tangents in the model, which are required for normal mapping techniques. D3D11 is strict in that sense and fails to create the input layout when shader wants data that isn’t there in the buffer (resulting in failure to render), while D3D9 and OpenGL would just fetch invalid data, probably zeroes.


#20

@ Bluemoon
Is it possible that it’s the same issue Cadaver mentioned with missing tangents? Try using an additional option -t in the assetImporter.

@NiteLordz, the models in my repo didn’t work for you? Hmm, I’m using OpenGL renderer and it works for me, although, I also forgot to generate tangents.