When exporting a level sequence to an animation sequence, the bones used will be based on the LOD for the current camera location, instead of exporting LOD0.
This is very noticable if you pull the camera far away, then do an export.
To work around this, we need to have the camera close to the character, or set Forced Lod Model value to 1.
Steps to Reproduce
When exporting a level sequence to an animation sequence, the bones used will be based on the LOD for the current camera location, instead of exporting LOD0.
This is very noticable if you pull the camera far away, then do an export.
To work around this, we need to have the camera close to the character, or set Forced Lod Model value to 1.
Thanks Dustin. Would you mind talking with the engineering team and see if they have any suggestions for a fix we could try ourselves? This is proving to be a pretty big workflow issue for us.
Yep, the primary tool we recommend using is USkinnedMeshComponent::SetForcedLOD. A good place to add this would be in FFbxExporter::ExportLevelSequenceTracks. Towards the end of that function we export the anim sequence and you could add a call to set the forcedLOD there and then set it back after that is complete.
// Add
for ((USkeletalMeshComponent* SkeletalMeshComponent : SkeletalMeshComponents)
{
SkeletalMeshComponent ->SetForcedLOD(1); //This is 1 based for legacy reasons.
}
UnFbx::FLevelSequenceAnimTrackAdapter::FAnimTrackSettings Settings;
Settings.MovieScenePlayer = MovieScenePlayer;
Settings.MovieSceneSequence = MovieSceneSequence;
Settings.RootMovieSceneSequence = RootMovieSceneSequence;
Settings.RootToLocalTransform = RootToLocalTransform;
Settings.bForceUseOfMovieScenePlaybackRange = false;
for (USkeletalMeshComponent* SkeletalMeshComponent : SkeletalMeshComponents)
{
Settings.AnimTrack = SkeletalAnimationTrack;
FLevelSequenceAnimTrackAdapter AnimTrackAdapter(Settings);
ExportAnimTrack(AnimTrackAdapter, Actor, SkeletalMeshComponent, 1.0 / DisplayRate.AsDecimal());
// Add
SkeletalMeshComponent ->SetForcedLOD(0); Setting it to 0 turns lodding back on.
}
I tried this, as well as cherry picking 42651937. But neither fixed the issue of the bones appearing stretched on the first frame of the exported animation sequence.
I found that this change did the trick. I’ll try to create a pull request later with this, but you can test locally as well.
void FAnimRecorderInstance::InitInternal(USkeletalMeshComponent* InComponent, const FAnimationRecordingSettings& Settings, FAnimationSerializer *InAnimationSerializer)
{
[...]
if (InComponent)
{
CachedSkelCompForcedLodModel = InComponent->GetForcedLOD();
InComponent->SetForcedLOD(1);
// START - need to run UpdateLODStatus() after SetforcedLOD is used
InComponent->UpdateLODStatus();
// END