EnoxSoftware / CVVTuberExample

CVVTuberExample(Computer Vision Virtual YouTuber Example) is an example project of controlling 3D humanoid model ("Unity-chan!" Model) using WebCamTexture.
https://assetstore.unity.com/packages/templates/tutorials/cv-vtuber-example-118186
89 stars 10 forks source link

I want to implement runtime import for VRM avatar. #5

Closed Takumi1209 closed 1 month ago

Takumi1209 commented 1 month ago

Thank you for creating these assets. I am developing based on this asset. However, I am currently hitting a wall. After Runtime importing a VRM avatar, I am unable to enable face tracking on that avatar. I have to put the meta information into VRMLoader.cs in the Runtime, but even if I do that, the avatar does not work. What should I do?

EnoxSoftware commented 1 month ago

We have created and tested a small component for testing and it works fine with runtime loaded VRM. Please add the attached test component to the VRMCVVTuberControllManager object in the VRMCVVTuberExample scene and try it out.

Place the unzipped "RuntimeVRMMetaLoader.cs" in the "Assets\CVVTuberExample\CVVTuber\Addons\VRMCVVTuber\Scripts" folder.

RuntimeVRMMetaLoader.zip

VRMCVVTuberExample_RuntimeV

Takumi1209 commented 1 month ago

Thank you for creating the script. It helped me a lot. I have a mechanism that I would like to create. I would like to implement a mechanism whereby I can place a button on the scene and press that button to access a file on the PC and freely exchange VRM avatars. How can I implement that? I added the following script to the script you gave me but it did not work. I would appreciate it if you could help me.

public UnityEngine.UI.Button LoadVRMButton;
ExtensionFilter[] extensions = new[] {
new ExtensionFilter("VRM Files", "vrm", "VRM"),
};

public void LaodVRM()
{
    string[] paths = StandaloneFileBrowser.OpenFilePanel("Load VRM File", "", extensions, true);
    // Vrm10Instance vrm10Instance = await Vrm10.LoadPathAsync(paths[0]);
    string path = paths[0];

    GameObject currentVrm = GameObject.Find("VRM");

    if (currentVrm != null)
    {
        Destroy(currentVrm);
    }

    ImportVRMAsync(path);

}
Takumi1209 commented 1 month ago

When I Build the script you sent me, I found a problem with the avatar not reflecting. Also, when I transition from the title screen to the avatar screen, the avatar does not work.

EnoxSoftware commented 1 month ago

Attached is a new example unitypackage with a button added to swap models by opening the file dialog and selecting the VRM file. Import it into your existing project. Then open the “VRMCVVTuberExample_RuntimeVRMTest” scene and try it out.

This example was constructed using ad hoc code, so we believe it needs significant refactoring to be practical.

VRMCVVTuberExample_RuntimeVRMTest.ZIP

Takumi1209 commented 1 month ago

Thank you very much. Thanks to you, I was able to implement that mechanism. However, there are two problems. The first is that the avatar's body does not move after loading, only the face. This causes loss of presense. Second, after bulid, when I press LoadVRM, it does not respond. Thank you in advance for your response.

EnoxSoftware commented 1 month ago

Regarding the first problem, our example does not originally implement the ability to move the arms of the VRM character. If you wish to add such a feature, you will need to create it yourself. (e.g., detecting body pose from the input image and reflecting it in the movement of the 3D character).

The second problem is that the file selection dialog is only compatible with the unity editor. You need to fix it so that you can get the file path using the file selection dialog that corresponds to the platform you want to run on in some way.

Takumi1209 commented 1 month ago

Regarding the first issue, I was not clear enough. My apologies. What I meant to say was that normally the avatar's upper body moves in a left-right direction depending on the movement of the head. However, the problem is that only the head moves while the upper body is fixed in the frontal position. I am not referring to moving the arms, but to the fact that we are no longer able to do what we were originally able to do.

EnoxSoftware commented 1 month ago

Sorry, I was careless. I have attached a new modified version, Please import it over the project.

VRMCVVTuberExample_RuntimeVRMTest_240720.ZIP

Takumi1209 commented 1 month ago

Thank you for the correction. I have something I would like to implement. It is to load any VRM avatar automatically at the start of the execution. I would appreciate if you could tell me how to implement this. Also, after loading VRM, when I try to load other VRM avatars again, only blendshape is applied and not the body behavior. How can I fix this problem?

EnoxSoftware commented 1 month ago

A new version of CVVTuberExample has been released to the AssetStore.

CV VTuber Example 1.1.0 [Common]Changed the minimum supported version to Unity2021.3.35f1. [Common]Separated the examples using the Built-in Render Pipeline and Scriptable Render Pipeline. (Except UnityChanCVVTuberExample and VRMCVVTuberExample.) [Common]Updated for UniVRM-0.124.1_e606.unitypackage. Added RuntimeVRMMetaLoader functionality. [Common]Updated for CubismSdkForUnity-5-r.2.unitypackage.

We have tested switching between several different VRM avatars using the “LoadVRM” button and did not encounter any issues with body movements not being applied. Could you please let us know the results of your tests with the latest CVVTuber?

Takumi1209 commented 1 month ago

Thank you for your excellent work. I have tested it and it is working fine and after bulid it is still working fine. Thanks to you I was able to achieve what I wanted to achieve. I will now close the issue. Thank you very much.