Archive 17/01/2023.

How to programmatically access Morph Target in FBX file?

csteaderman

I have been provided an FBX file, generated with Autodesk 3ds, that contains two Morph Targets that I would like to control in my application. I have managed to get the models generated using AssetImporter (needed to import FBX into Blender and then export FBX in order to get past “FBX-Tokenize (offset 0x34) block offset is out of range” error). Unfortunately, I do not see any Components in my DOM that allow me to change the Morph Targets. Some investigation leads me to think that AssetImporter does not support Morph Targets? Is that correct? If it does support them, how can I reference the Morph Target in my code.

Modanung

I think you’re looking for AnimatedModel::SetMorphWeight.

Also; welcome! :confetti_ball: :slightly_smiling_face:

csteaderman

Thanks for the response, and the warm Welcome!

I thought I should use that, but when I load my model/scene (using Scene.InstantiateXml(...)) none of the models are of type AnimatedModel, only StaticModel. That is part of what is making me think that perhaps AssetImporter is stripping the Morph Targets from my FBX file.

Charlie

Modanung

Then they must be defined as StaticModels in the scene’s XML.
I don’t use AssetImporter, maybe it has parameters to specify this, but I don’t know. I’d say you could either edit the scene file, or ignore it altogether.

csteaderman

OK. I’m done for the day, but will continue looking into it tomorrow morning.

FYI - I just looked in the XML file and, sure enough, they are StaticModel.

Modanung

Btw, the Developer Talk category is meant for discussing development of the engine, not with. For questions about its use, there’s the Discussions → Support section.

Eugene

For a record, FBX AssetImporter is a trash that cannot properly load half of FBX files, issue tracker be my witness.
I had to manually make GLTF importer in order to actually load complex models correctly.

So, there is always a possibility that AssImp just failed to import your model, and there isn’t much you can do besides trying to debug AssImp or just importing stuff yourself.

Modanung

FBX is a proprietary file format.

csteaderman

Well, I have made progress. I do believe that the Scene/Models generated by AssetImporter do not have the Morph Targets in them. So I installed an older version of Blender (2.79) so that I could use the Urho-Blender Add-on. By playing with the export options, I was finally able to get an exported Scene/Models that present the Morph Targets and am able to manipulate them via code as I needed.

Thanks for all your guidance. It is unfortunate that there is not a more robust method to get 3D assets converted into Urho format. The 3D assets that I am using are being provided by an external resource, and I don’t have the ability to control his workflow (Autodesk 3ds).

SirNate0

I’ve had plenty of success with the addon with Blender 2.83, you just have to make sure you use the correct branch from GitHub (I think it’s 2_80 or something like that). Though I don’t use vertex morphs, so no comment on that aspect.

Modanung

Simply check the Morphs (shape keys) box.


I never know which add-on repository to link to since I stopped updating Blender. :slight_smile:
2.79b is still the best Blender version out there, as far as I’m concerned.

Eugene

Yes, and damn I hate so much that FBX became de-facto standard for 3d assets.

It’s just so dumb in the grand scheme of things. Imagine having old *.doc format instead of Markdown as documentation standard :expressionless: On the other hand, open 3d formats were always either trash or insufficient until GLTF.

I only hope that FBX will get replaced with GLTF in time.

Modanung

I tend to take it from scratch, but Poly Haven keeps growing, and provides glTF.