Dreaming381 / Latios-Framework

A Unity DOTS framework for my personal projects
Other
896 stars 76 forks source link

Mixed/broken results with SkinnedMeshes and Kinemation #6

Closed gabriel-proxima closed 2 years ago

gabriel-proxima commented 2 years ago

Hi! First of all I'd like to say that I really appreciate what you've built here.

I was very excited to try Kinemation, and I'm currently past Part 2 of Getting Started. With several mixed and broken results.

Here's the repro steps:

  1. Create a new project with Unity 2020.3.30f1 (with entities, hybrid renderer and URP)
  2. Import Latios framework via git url
  3. Right Click -> Create -> Latios -> Bootstrap -> Minimal Injection World
  4. Add Kinemation.InstallKinemation to 1LatiosBootstrap.Initialize`

` public unsafe bool Initialize(string defaultWorldName) { var world = new LatiosWorld(defaultWorldName); World.DefaultGameObjectInjectionWorld = world;

    var systems = new List<Type>(DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default));
    BootstrapTools.InjectSystems(systems, world, world.simulationSystemGroup);
    KinemationBootstrap.InstallKinemation(world);//add this line

`

  1. Create a implementation for ICustomConversionBootstrap
[UnityEngine.Scripting.Preserve]
public class LatioConversionBootstrap : ICustomConversionBootstrap
{
    public bool InitializeConversion(World conversionWorldWithGroupsAndMappingSystems, CustomConversionSettings settings,
        ref List<Type> filteredSystems)
    {
        KinemationConversionBootstrap.InstallKinemationConversion(conversionWorldWithGroupsAndMappingSystems);
        return false;
    }
}
  1. Follow the guide on Getting Started - Part 2 to setup the model

Results are the following:

image

I will try to continue the Getting Started tutorial with Unity's Mannequin + Optimized Game Objects and see how it goes, and update this post tomorrow.

Dreaming381 commented 2 years ago

Hi! Thanks for the report. I think I pinpointed the issue. LatiosConversionBootstrap returning false breaks Kinemation's installer, because it expects the Hybrid Renderer's systems to already be there if they are going to be there. I will fix this in a patch. In the meantime, use the following which is functionality equivalent to returning "false" other than that the installer will work.

[UnityEngine.Scripting.Preserve]
public class LatiosConversionBootstrap : ICustomConversionBootstrap
{
    public bool InitializeConversion(World conversionWorldWithGroupsAndMappingSystems, CustomConversionSettings settings, ref List<Type> filteredSystems)
    {
        var defaultGroup = conversionWorldWithGroupsAndMappingSystems.GetExistingSystem<GameObjectConversionGroup>();
        BootstrapTools.InjectSystems(filteredSystems, conversionWorldWithGroupsAndMappingSystems, defaultGroup);

        Latios.Kinemation.Authoring.KinemationConversionBootstrap.InstallKinemationConversion(conversionWorldWithGroupsAndMappingSystems);
        return true;
    }
}
gabriel-proxima commented 2 years ago

Hi @Dreaming381! Thanks so much for the quick response.

I just tested it and it worked perfectly for the Unity mannequin. Mixamo's xbot is still broken (just so you know), but it's a weird skeleton so I won't worry too much about it.

I'll continue to follow the tutorial as soon as I can. Thanks again for building this framework!

Dreaming381 commented 2 years ago

I have trust issues with Adobe, but I will try and find a way to test that model.

Multiple skinned meshes are supported. One of my test models has 7 skinned meshes, one of which has 3 submeshes, a rigid mesh parented to a bone, and 293 bones. Something really weird must be happening for that xbot to not work.

gabriel-proxima commented 2 years ago

I have trust issues with Adobe, but I will try and find a way to test that model.

Multiple skinned meshes are supported. One of my test models has 7 skinned meshes, one of which has 3 submeshes, a rigid mesh parented to a bone, and 293 bones. Something really weird must be happening for that xbot to not work.

That's good to know. I totally didn't have the time to go deeper into it yet (which I want to). I'll start a project from scratch with this model on Friday and post it here if I find anything useful (or if I can't make it work)

Dreaming381 commented 2 years ago

Good news!

I have reproduced the issue and have a fix locally. The fix will arrive in the compatibility update this weekend.

I am re-opening this issue for awareness until the compatibility release arrives.

In the meantime, please experiment with only one mesh prefab type in the scene at a time (the bug can also affect different prefabs with a single mesh each).

Thanks for the report!