Jump to content

Importing Skinned Model Produces Wrong Results


ByteBack
 Share

Recommended Posts

I have an issue with importing skinned models.

In the png preview, ythe model looks "sort of" ok. Except it's orientated so that the body is aligned with the x-axis (see barbarian_png_preview.png). When I open the model in the model viewer, I end up with the model looking extremely deformed as I play the animations (barbarian_preview_animated.png). 

It looks to me as if the importer isn't taking into account for the node offset matrix in the skin weights. 

barbarian_png_preview.png

barbarian_preview_animated.png

Update
If I fix the model & skeleton rotation in Blender (and mess with the mesh scale) and re-export; the model imports as expected. However, thanks to how the asset was made, if I scale the skeleton, it deforms into a twisted mess. But if I import with the skeleton scale set, the model is 182 units high in Blender, but somehow is only 1.82 units high in the previewer. 

 

Edited by ByteBack
Adding more info
  • Confused 1
Link to comment
Share on other sites

Okay, so fortunately glTF is an open standard with support across many different programs, including Windows 3D Viewer, which is included in Windows 10 and 11. We can use this to get a second opinion and see if the glTF file is exporting correctly.

When I open your .glb file in this program I see two issues. It's very big, and it looks like maybe the faces are flipped?

It's difficult to investigate anything else when we know there are these issues present, so I recommend seeing if you can fix your export process from Blender first.

image.thumb.png.ce2a50e992466f4881be5e395324a4ba.png

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

As I mentioned in the original post, I did manage to get the model to look almost right by mucking around with the mesh rotation and root joint rotations in Blender and re-exporting. I figured that's going to be the way forward - don't have root joint rotations or mesh rotations.

I will add though that the issue I'm seeing with the joints is pretty much the same if I were to export as an FBX and not take into account for the joint offset matrix in the skinning weights. This was an issue I had a while ago in my little toy-engine when I used this as a test asset. In the preview png in the editor, that looks to have had the model baked out as a static mesh without joint deformations; it's rotated exactly the way I would expect to be without taking into account for the joint offsets. Because this was how the mesh looked when I first tried it, and didn't bother with those matrices.

I also think that the issue with Windows 3D viewer is that it's also not handling the joint offset matrices correctly. Because without the mesh scaling applied, the mesh IS huge. 

 

 

Link to comment
Share on other sites

If that is the case, that probably indicates some kind of error in your Blender export process, like something needs to be "baked" or something. I am not a blender expert, but their support forum might be able to help you.

If you find a situation where Ultra is not loading a model that works in other third-party programs, then that would indicate a problem, and I would definitely like to see it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

11 hours ago, Josh said:

If that is the case, that probably indicates some kind of error in your Blender export process, like something needs to be "baked" or something. I am not a blender expert, but their support forum might be able to help you.

If you find a situation where Ultra is not loading a model that works in other third-party programs, then that would indicate a problem, and I would definitely like to see it.

Fair point, Josh. I'm not 100% convinced but at the same time, this isn't a hill I want to die on :) 

The solution is just to apply the transforms to the mesh and armature in Blender, and then it will more or less import as expected. If there's a wiki or something somewhere about importing models, I think it would be worth adding that info there if it's not already been noted. 

 

11 hours ago, Andy90 said:

I got the same problem josh. Is this a Mixamo model ?

I originally imported it from a FBX into blender to export as gltf into the engine. So if you're seeing similar issues, import into blender and apply rotations and scales  to your  mesh and skeleton. Either gltf doesn't have the scope to deal with certain transforms from FBX or many gltf implementations/loaders just don't deal with it accordingly. And given that mixamo is now owned by Autodesk, it probably uses whatever internal fbx handling they have to deal with manipulating the model in the app. 

 

@Josh Do you think it would be worth adding certain post-process tools into the model viewer such as "Scale meshes and animations" to deal with any hiccups when exporting from Blender? I get the feeling that a lot of users are going to be using assets that they bought from asset stores that have a variety of issues that are not easy to fix in the tools available to them such as Blender. 

 

For example, I tried to apply the scale to the transforms but it messed up my model really badly, and I couldn't work out why. So I just exported "as is" and figured I'd have to scale it some way in the engine. But because Blenders handling of units sucks, it exported at its normal size. It was a bit of a gamble though., and as I said; a lot of users are probably going to have similar issues.

 

Link to comment
Share on other sites

as i sayed same problem. I downloaded an mixxamo character with an animation. Drop it in blender and export it to gltf. If i drop in the fbx file direct the mesh gets converted on a proper way. But there is the problem that you are not able to edit anythin on this model. Otherwise you loose all animation. Also maybe you should consider to support also fbx. I think the most ppl have an assset libary with only fbx files because every other engine is using this file format. 

I mean its not even possible to export gltf from maya without any 3rd party plugin.

Link to comment
Share on other sites

5 hours ago, ByteBack said:

Do you think it would be worth adding certain post-process tools into the model viewer such as "Scale meshes and animations" to deal with any hiccups when exporting from Blender? I get the feeling that a lot of users are going to be using assets that they bought from asset stores that have a variety of issues that are not easy to fix in the tools available to them such as Blender. 

For example, I tried to apply the scale to the transforms but it messed up my model really badly, and I couldn't work out why. So I just exported "as is" and figured I'd have to scale it some way in the engine. But because Blenders handling of units sucks, it exported at its normal size. It was a bit of a gamble though., and as I said; a lot of users are probably going to have similar issues.

While some of these features may be useful as general tools, I am wary of committing time trying to fix issues that belong to Blender. The whole idea of an open standard is it makes it clear where any problems are. Blender gets a lot of free money from various corporations, they should be able to improve their workflow without my help. If you find a glTF file that loads properly in other programs but does not in Ultra, that is what I should be focused on.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

3ds max does support glTF:
https://help.autodesk.com/view/3DSMAX/2023/ENU/?guid=GUID-5B4C8EC2-2230-4F9F-B3C6-48D9E347E37D
https://help.autodesk.com/view/3DSMAX/2023/ENU/?guid=GUID-7ABFB805-1D9F-417E-9C22-704BFDF160FA

Maya doesn't appear to support it. There are some third-party exporters, but I don't know how well those work.

An FBX to glTF converter is included in Ultra, and it should just work if you drop the FBX file in your project.

The main problem with FBX is it doesn't support PBR materials, so you wind up having to adjust a lot of materials after importing the model, whereas glTF just works.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

 

38 minutes ago, Andy90 said:

but indeed something with the rigged models are wrong. Eighter no one of us knows how to export that we can use it within ultra or the import itself got problems.

Here you have an Model with the same problem.

https://1drv.ms/u/s!Aum5gwXzTrOywAa7_gzAjoeWozU1?e=cIvaNX

The problem here just seems to be that the model is really big.

image.thumb.png.7cdfd19bff58f9ae4e35d3c4b35a4add.png

In the glTF spec it states:

Quote

The units for all linear distances are meters.

So the best solution is to point out to the maker of whatever software you are using that the glTF units are always in meters so that they can fix the error. Since we have an open specification that describes exactly how things work, we don't have confusion about who should fix what. We all just conform to what the spec says.

If you know the name of the top-most model, you might be able to manually edit the gltf file in a text editor and insert a scale property, since it's just a JSON file.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

That is interesting. I assumed the camera in Windows Object Viewer was always the same scale.

I will take a closer look at this after the live chat is done.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 4 weeks later...

I've found that using the Autodesk FBX converter to change everything to 2013 standard first can help with this issue too. Also, this isn't confined to Ultra any other editor I've used in the past is capable of this problem including Godot; Game Guru Max and even Unity. I've attached the program but its available from here in case it doesn't attach for any reason: FBX Converter 2013 for Windows 64 : autodesk : Free Download, Borrow, and Streaming : Internet Archive Often, the most reliable way to convert to glTF is to convert from a different model format such as .OBJ or .MDL - this seems to have a more stable conversion than from FBX which is unreliable (not in Ultra, everywhere).

fbx20133_converter_win_x64.zip

Link to comment
Share on other sites

17 hours ago, Andy90 said:

@Joshdid you found allready a solution for this issue? Got the same problem. Just drag the character into the scene. Scale it to 1.0 and play the animation. Wired things happen

image.thumb.png.5f7cf3d07641cb34e643e7410e6d8a18.png

image.thumb.png.2d25184dfa8806180cac8fad60c06c0e.png

Here is the gltf from the model.

Human_2.zip

Okay, the scale issue is an error in their exporter that they need to fix. You can refer them to the glTF specification and point out that in glTF, units are always in meters. The model seems to be tiny, just 8 mm tall:

Untitled.png.5df86c4c5d3b17d192776f5ad8427be9.png

However, there does seem to be an animation issue that is separate, and I am investigating this.

This is a useful tool for examining glTF files: https://sandbox.babylonjs.com/

Model looks nice, BTW.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

On 3/7/2024 at 3:19 PM, Andy90 said:

@Joshdid you found allready a solution for this issue? Got the same problem. Just drag the character into the scene. Scale it to 1.0 and play the animation. Wired things happen

Here is the gltf from the model.

Human_2.zip

If I drag him into a viewport, then scale and rotate him he actually looks fine.

image.thumb.png.94ad192e575087c7a4dce93c13361088.png

However, the moment animation is applied, he turns into The Thing:

image.thumb.png.87d7e522e5b52fcfb5e16d8c85d31d16.png

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I've poked around in the file but I can't find anything that's unique about it that would be causing a problem when many other animated glTF files load correctly.

There is a problem in my loader, because both Windows Object Viewer and the Babylon.js glTF viewer both load it correctly, but I don't know how to solve it.

I recommend running this through Blender or whatever other method you were using that makes it export a model Ultra can load correctly.

I am attaching the model here for future investigating, but I don't plan to continue working on this for now.

Human_2.zip

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I also want to note that the animations themselves seem to be coming through perfectly. The skeleton looks correct. So in the future I will be looking more closely at the skin bind matrices and initial orientation of the model, which seem wrong.

Untitled.thumb.png.2e1bc00d8d338c7d24b8f67574f17f83.png

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. 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.

 Share

×
×
  • Create New...