FBX IO: better default settings for anim curve preservation and pipeline integration #105172

Closed
Roland-Vyens wants to merge 1 commits from Roland-Vyens:fbx_fix_default_settings into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

Problem:

  1. Animation curves gets detroyed with current default anim export settings: blender/blender-addons#105058
    屏幕截图 2024-02-10 163920.png

  2. Enable "NLA Strips" and "All Actions" will cause error if you want to import your camera or other stuff to Unreal Engine as well as other DCC software for some of them doesn't support multiple anim channels in 1 fbx file.

  3. Import animation won't align with the desired frame range (offset 1 frame).

Solutions:

  1. Just set the simplify to 0.005, the cam will be perfect with no shift at all, also the unkeyed properties will not get force baking keys while the simplify is set to 0.

  2. The "NLA Strips" and "All Actions" should be disabled by default.

  3. set default import offset to 0 for animations align with their desired frame number.

**Problem:** 1. Animation curves gets detroyed with current default anim export settings: blender/blender-addons#105058 ![屏幕截图 2024-02-10 163920.png](/attachments/d6f2a067-9a66-4045-9053-1d11d6e24115) 2. Enable "NLA Strips" and "All Actions" will cause error if you want to import your camera or other stuff to Unreal Engine as well as other DCC software for some of them doesn't support multiple anim channels in 1 fbx file. 3. Import animation won't align with the desired frame range (offset 1 frame). **Solutions:** 1. Just set the simplify to 0.005, the cam will be perfect with no shift at all, also the unkeyed properties will not get force baking keys while the simplify is set to 0. 2. The "NLA Strips" and "All Actions" should be disabled by default. 3. set default import offset to 0 for animations align with their desired frame number.
Roland-Vyens added 1 commit 2024-02-10 18:07:32 +01:00
8a2f618fea More useable default settings for fbx i/o
I made 4 default value changes based on my one-year long continuous testing and practicing in real production environment. 

Here is a description of the problems caused by currently used default settings: blender/blender-addons#105058

What these changes does: 

1. The new default settings are optimized for maxmium precision of animation curves, which solves the existing default settings ruining animation curves (especially for camera animation). 

2. Out of box compatibility for animation with other 3D packages, mainly unreal engine (export all NLA and action will make Unreal engine confuse).
Roland-Vyens requested review from Bastien Montagne 2024-02-10 18:08:34 +01:00

Wouldn't mind second opinion (@Mysteryem maybe?), but I think changing defaults like that is not really a good thing. It will 'fix' some issues in some cases, but break things in others.

That's the reason why we do have presets, so that default behaviors can be tweaked as needed for each pipeline.

Wouldn't mind second opinion (@Mysteryem maybe?), but I think changing defaults like that is not really a good thing. It will 'fix' some issues in some cases, but break things in others. That's the reason why we do have presets, so that default behaviors can be tweaked as needed for each pipeline.
Author
First-time contributor

Wouldn't mind second opinion (@Mysteryem maybe?), but I think changing defaults like that is not really a good thing. It will 'fix' some issues in some cases, but break things in others.

That's the reason why we do have presets, so that default behaviors can be tweaked as needed for each pipeline.

From a user perspective, I personally think 1 and 3 is OK though... Other DCC software's default import/export settings for animation generally tend not to modify the anim offset or automatically simplify animation curves.

As a volunteer Q&A guy in Chinese blender community, I often see a lot questions about exporting fbx not working as expected or animation curves changed, each time I have to teach them modify simplify factor and turn off NLA and All Action over and over again… so I think change these default settings can make the newbies' experience instantly better without ever needing to ask a question. It would be really nice if you consider about solution 1 and 2 together 😄 Or maybe add 2 toggle for simplify and force baking all unkeyed property? But that's some good amount of work to deal with…

> Wouldn't mind second opinion (@Mysteryem maybe?), but I think changing defaults like that is not really a good thing. It will 'fix' some issues in some cases, but break things in others. > > That's the reason why we do have presets, so that default behaviors can be tweaked as needed for each pipeline. From a user perspective, I personally think 1 and 3 is OK though... Other DCC software's default import/export settings for animation generally tend not to modify the anim offset or automatically simplify animation curves. As a volunteer Q&A guy in Chinese blender community, I often see a lot questions about exporting fbx not working as expected or animation curves changed, each time I have to teach them modify simplify factor and turn off NLA and All Action over and over again… so I think change these default settings can make the newbies' experience instantly better without ever needing to ask a question. It would be really nice if you consider about solution 1 and 2 together 😄 Or maybe add 2 toggle for simplify and force baking all unkeyed property? But that's some good amount of work to deal with…
Member

I'll preface this by saying that I don't personally work with animation much and what I do is pretty much all humanoid animations from external sources or simple humanoid animations I've created myself in Blender.

  1. Just set the simplify to 0.005, the cam will be perfect with no shift at all, also the unkeyed properties will not get force baking keys while the simplify is set to 0.

For humanoid animations that I occasionally work with, I think the default Simplify setting is fine, I don't think I've ever had to adjust it, and Unity, which I'm using, resamples imported FBX animation curves and performs keyframe reduction by default anyway.

The provided example case seems to be one that specifically requires high precision, in which case I think it would make sense that the default Simplify setting is not suitable, but I'm not sure that alone that means the default value needs adjusting.

Also, as brought it up before in #104978, comparing the animations in a Blender exported FBX, that has been re-imported, to its original .blend is not very useful because Blender and FBX have fundamentally different ways of storing Object transforms such that some information will always be lost in the conversion to/from FBX. The simplification step in particular happens after the conversion to FBX tranforms, so there's also no simple way to directly compare the before and after of the simplification step.

  1. The "NLA Strips" and "All Actions" should be disabled by default.

I don't actually know how to use NLA and there's a fairly old bug (#66272) with exporting shape key animations, so I have both of these disabled in my export presets. I think disabling both "NLA Strips" and "All Actions" could make the default export simpler, but I don't personally have much use for either of the options, so I'm not familiar with their uses.

  1. set default import offset to 0 for animations align with their desired frame number.

I think this is a similar argument to the 'arrays start at 0' vs 'arrays start at 1' argument of programming languages. Blender's default startup file has a 250 frame animation that starts on frame 1 and ends on frame 250, so I think that the default import offset of 1 makes sense for Blender. Unless there's some other issue with the default import offset?


Ideally, if it produces good results, I'd like to replace the current simplification algorithm with using the same functions as the F-Curve decimation operator. I've been trying to figure out how to convert Blender keyframe tangents to FBX so that the Allowed Change mode of F-Curve decimation could be used since its more similar in design to the current simplification algorithm than the Ratio mode, but I've not had any luck getting the tangents to work so far.

I'll preface this by saying that I don't personally work with animation much and what I do is pretty much all humanoid animations from external sources or simple humanoid animations I've created myself in Blender. > 1. Just set the simplify to 0.005, the cam will be perfect with no shift at all, also the unkeyed properties will not get force baking keys while the simplify is set to 0. For humanoid animations that I occasionally work with, I think the default `Simplify` setting is fine, I don't think I've ever had to adjust it, and Unity, which I'm using, resamples imported FBX animation curves and performs keyframe reduction by default anyway. The provided example case seems to be one that specifically requires high precision, in which case I think it would make sense that the default `Simplify` setting is not suitable, but I'm not sure that alone that means the default value needs adjusting. Also, as brought it up before in https://projects.blender.org/blender/blender-addons/issues/104978, comparing the animations in a Blender exported FBX, that has been re-imported, to its original .blend is not very useful because Blender and FBX have fundamentally different ways of storing Object transforms such that some information will always be lost in the conversion to/from FBX. The simplification step in particular happens after the conversion to FBX tranforms, so there's also no simple way to directly compare the before and after of the simplification step. > 2. The "NLA Strips" and "All Actions" should be disabled by default. I don't actually know how to use NLA and there's a fairly old bug (#66272) with exporting shape key animations, so I have both of these disabled in my export presets. I think disabling both "NLA Strips" and "All Actions" could make the default export simpler, but I don't personally have much use for either of the options, so I'm not familiar with their uses. > 3. set default import offset to 0 for animations align with their desired frame number. I think this is a similar argument to the 'arrays start at 0' vs 'arrays start at 1' argument of programming languages. Blender's default startup file has a 250 frame animation that starts on frame `1` and ends on frame `250`, so I think that the default import offset of `1` makes sense for Blender. Unless there's some other issue with the default import offset? --- Ideally, if it produces good results, I'd like to replace the current simplification algorithm with using the same functions as the F-Curve decimation operator. I've been trying to figure out how to convert Blender keyframe tangents to FBX so that the Allowed Change mode of F-Curve decimation could be used since its more similar in design to the current simplification algorithm than the Ratio mode, but I've not had any luck getting the tangents to work so far.
Author
First-time contributor

The provided example case seems to be one that specifically requires high precision, in which case I think it would make sense that the default Simplify setting is not suitable, but I'm not sure that alone that means the default value needs adjusting.

This camera problem was discovered when we just start using blender in our pipeline. At that time we are doing a project that use blender to render character and unreal engine to render background, at compositing stage of that project, I see big shift in position of the 2 renders, and at that time I didn't know it was because simplify, so I had to align those frames by hand.
It do looks fine after imported into unreal engine, but when I combine blender render with unreal render, things became super obvious. So I definitely recommend to tweak the default simplify factor, less is better, even 0 should be considered as default value in terms of production robustness. @Mysteryem

Also, as brought it up before in #104978, comparing the animations in a Blender exported FBX, that has been re-imported, to its original .blend is not very useful because Blender and FBX have fundamentally different ways of storing Object transforms such that some information will always be lost in the conversion to/from FBX. The simplification step in particular happens after the conversion to FBX tranforms, so there's also no simple way to directly compare the before and after of the simplification step.

I also provide a simplify 0.01 fbx file, it perfectly aligns with blender original camera animation curve. Also no problem in unreal engine at all.

> The provided example case seems to be one that specifically requires high precision, in which case I think it would make sense that the default Simplify setting is not suitable, but I'm not sure that alone that means the default value needs adjusting. This camera problem was discovered when we just start using blender in our pipeline. At that time we are doing a project that use blender to render character and unreal engine to render background, at compositing stage of that project, I see big shift in position of the 2 renders, and at that time I didn't know it was because simplify, so I had to align those frames by hand. It do looks fine after imported into unreal engine, but when I combine blender render with unreal render, things became super obvious. So I definitely recommend to tweak the default simplify factor, less is better, even 0 should be considered as default value in terms of production robustness. @Mysteryem > Also, as brought it up before in #104978, comparing the animations in a Blender exported FBX, that has been re-imported, to its original .blend is not very useful because Blender and FBX have fundamentally different ways of storing Object transforms such that some information will always be lost in the conversion to/from FBX. The simplification step in particular happens after the conversion to FBX tranforms, so there's also no simple way to directly compare the before and after of the simplification step. I also provide a simplify 0.01 fbx file, it perfectly aligns with blender original camera animation curve. Also no problem in unreal engine at all.

About the "NLA Strips" and "All Actions" options, afair these were requested and are used by artists creating assets for games. They usually have a collection of actions e.g. for each character, and need to get them all with their assets.

About the "NLA Strips" and "All Actions" options, afair these were requested and are used by artists creating assets for games. They usually have a collection of actions e.g. for each character, and need to get them all with their assets.

Regarding changing defaults: in general, there needs to be a very good reason to change defaults of existing settings. Mainly because changing default of an otherwise unmodified feature will break people's pipelines, without any way to work around it or even warn about it.

Even when improving or re-working a feature, we try to keep the default behavior as close as possible from the previous one, for the same reasons.

Thanks for the PR, but presets are the recommended way to tweak the IO behavior for any specific requirements.

Regarding changing defaults: in general, there needs to be a _very_ good reason to change defaults of existing settings. Mainly because changing default of an otherwise unmodified feature _will_ break people's pipelines, without any way to work around it or even warn about it. Even when improving or re-working a feature, we try to keep the default behavior as close as possible from the previous one, for the same reasons. Thanks for the PR, but presets are the recommended way to tweak the IO behavior for any specific requirements.
Bastien Montagne closed this pull request 2024-02-13 11:09:36 +01:00
Roland-Vyens deleted branch fbx_fix_default_settings 2024-02-16 14:19:44 +01:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#105172
No description provided.